The Transactionals API is used to send transactional messages such as Order Delivery and Abandoned Cart notifications to both ReSci and non-ReSci subscribers. This API is organized around REST. The API endpoints were designed to be predictable and resource-oriented and use HTTP response codes to indicate API errors. This means that a single resource or endpoint can and often does provide different functionality based on the HTTP verb used to access it. JSON is returned in all responses from the API, including errors.
Create a new Transactional Campaign
Sending Transactional Messages with API
Create a new Transactional Campaign
You can create a new Transactional Campaign from the Transactional tab. Name your new template and then create your message.
When creating the message, you can have dynamic variables. These can be defined and passed through in the API call. To declare a variable in the message, surround the key/name of the variable with double curly brackets like {{variableName}}.
Example message:
- Hello {{firstName}}! Don't forget to buy that rug. Go to {{URL}} to complete your checkout!
Here firstName and URL can be passed through in the API Call.
Note: After saving a new template, a unique key called Template Slug is generated. You will need the Template Slug to complete the API call.
Sending Transactional Messages with API
You need to call the following API endpoint to activate the template you created above.
You will need your ReSci API Key and the Template Slug.
HTTP Request
POST: https://api.voyagetext.com/api/sms-transaction/send-sms
Headers
x-api-key:api_key
Replace api_key with your API Key.
Body
Body data should be in JSON format.
{
"templateSlug": "<template_slug>",
"toPhoneNumber": "<phone_number>",
"variables": [
{
"key" : "variable1",
"value" : "Value1"
},
{
"key" : "variable2",
"value" : "Value2"
}
]
}
- template_slug should be replaced with the Template Slug that generated when you created a new Transactional Campaign in the ReSci app.
- phone number should contain the phone number of the specific recipient.
- The variables array in the request body should contain all the variable names in key/value pair formats. This can include dynamic URLs.
Example
If you send a request for a message like 'Hi, {firstName} {lastName}!' then the SMS will be sent as 'Hi, Roger Rabbit!'
{
"templateSlug": "<template_slug>",
"toPhoneNumber": "<phone_number>",
"variables": [
{
"key" : "variable1",
"value" : "Value1"
},
{
"key" : "variable2",
"value" : "Value2"
}
]
}
Comments
0 comments
Please sign in to leave a comment.