How to send an Instant App using Prompt.io's API
You can use our API to send Instant Apps (small applications built inside the platform) to your contacts!
The Send To Customer POST
On your swagger page, locate /messages/send_to_customer under the Messages section, and click to expand it. Click "Try it out." We're going to edit the JSON key values with the necessary information to send an Instant App and message to a mobile user.
Edit the Message
In this example, we're going to send our contacts an Instant App designed to schedule meetings to talk about specific topics—in this case, the topic will be voting rights. Let's set our message to something that will prompt our contact to click on our instant app link!
Next to our "message," inside the quotes, we'll replace the word
string
with
Let's schedule a time to talk about voting rights! STOP2END
Select an Instant App to send
Next we're going to choose the Instant App we wish to send to our contact and copy-paste in its instantAppSchemaApiId. To locate the instantAppSchemaApiId of your Instant App, go to your organization's Full Suite dashboard, click Instant Apps, then choose the desired Instant App, and locate the API ID field under the Instant App Info tab.
Setting the TO & FROM channels
Now let's edit the TO and FROM fields:
orgChannelApiId
Think of this as a unique string that represents one of the organization's purchased phone numbers. To find this value, go to your Full Suite dashboard, then Channels, then locate the desired channel, click the ellipses on the right-side, then view, then copy the orgChannelApiId from the API ID field.
customerChannelKey
This is the phone number of the contact we wish to send our Instant App to. For this, we can simply enter their 10-digit phone number.
customerChannelId
This field can be deleted (or left untouched), because we're already providing a reference to the contact via customerChannelKey.
Passing Down Props
The Instant App in our example is meant to be a meeting scheduler for specific topics. Since the topics change from time to time, rather than hard-coding the topics in the Instant App, we can set it dynamically per broadcast.
To do this, let's create a key-value pair in the instantAppParameters curly-braces.
"topic": "voting rights"
Then in our Instant App, if we provide a parameter with the Parameter ID "topic," any time the Instant App sees the variable
{topic}
it will interpret it as the text, voting rights.
Let's test it!
When we hit the button "execute" the following should take place (assuming no errors):
The POST call will run once, and the contact will receive the message with the Instant App.
A curl will generate, which will allow you to run the code from your terminal.
A Request URL will generate, which will allow you to run this call in any application that allows API requests.
You'll receive a Response Body in JSON format