Use this REST API, along with your OAuth credentials to send a published SMS message to a contact source, with the ability to pass in a message name.
How It Works
Prerequisites to API SMS send
- Your Watson Campaign Automation org must have SMS enabled by provisioning.
- A database in the Watson Campaign Automation org must have SMS enabled.
- An org user with the SMS feature enabled and a valid auth token that is used when making the API calls.
- A user that has created an SMS message that is published on this org.
Note: Up to 10 concurrent requests are allowed to our API servers at any given time when using the OAuth method for authentication.
Once this is set up, you can send a published SMS message to a contact source.
End Point
/channels/sms/publishedmessages/{publishedMessageId}/sendjobs
Attribute: publishedMessageId Description: The ID (UUID) of the published SMS message that is being sent. String, required Example: e3c3d1ea-e54b-458d-b32b-18a99f63b58c – The ID of the published message can be found in your Watson Campaign Automation organization by going to the Mobile Messages And Templates area under Content. Click on the Published tab, locate the published SMS message you wish to send, and copy and paste the value found in the Content ID column. |
Attribute: ContactSourceId Description: The contact source’s ID can be provided. It can be a database, query, or contact list, and it must be enabled for SMS(or associated with a database that is enabled for SMS, in the case of the query and contact list). Long, optional
Example: 4396816 |
Attribute: externalSystemName Description: Provision for the calling system to pass a Name representing the calling system. If not passed, Watson Campaign Automation defaults this to API. String, optional Example: Campaign |
Attribute: externalSystemReferenceId Description: Provision for the calling system to pass a Reference Identifier, this will be passed back in SMS events to subscribing system. String, optional Example: Param_12345_test |
Attribute: messageName Description: Unique value for the message name. String, required Example: OfferToUpdateAPIpage |
Attribute: scheduledDate Description: Date on which the SMS is to be sent, represented in a String as per RFC 3339. If this parameter is not provided, API will process as Send now. Date, optional Example: 1970-01-01T00:00:00.000+00:00 |
Attribute: preBlockingHours Description: Value representing the blocking time before sending the SMS. Integer, optional Example: 4 |
Sample Payload
{ “externalSystemName”: “Campaign”,
“externalSystemReferenceId”: “Param_12345_test”,
“messageName”: “OfferToUpdateAPIpage”
}
Response Format
Sample output for above request:
Response Code : 201 //Success
Response Body :
{
“meta”: {
“attributes”: {},
“generalErrors”: [],
“fieldErrors”: {},
“links”: [],
“nextPageUrl”: null
},
“data”: {
“location”: “http://engage-qa1-api.adm01.com/rest/channels/sms/sendjobs/4396816”,
“id”: 4396816
}
}
Response Codes
Scenario | Response Code | Message |
---|---|---|
Success | 201 | Accepted |
Failure | 400 | Failure |
Contact source is not SMS enabled | 400 | Contact source <contactSourceId provided goes here>is not enabled for SMS. |
User calling the API is not SMS enabled | 403 | Forbidden |
Contact source does not exist | 400 | Contact source ID <contactSourceId provided goes here> does not exist. |
Contact source is not in this org | 400 | Contact source access denied |
No ID provided | 404 | |
Provided ID does not exist | 400 | Unable to find published DeliveryDraft with contentId <contentID goes here> |
Provided ID is not in this org | 403 | Forbidden |
Provided ID existed but was deleted | 400 | Unable to find published DeliveryDraft with contentId <contentID goes here> |
Contains characters NOT whitelisted for use in UI | 201 | Success |
Contains all spaces | 400 | Invalid message name |
Has leading or trailing spaces | 201 | Success |
Message name is not unique | 400 | A SMS with the name: <provided message name goes here> already exists |
value >2000 chars | 400 | Length of External System Name cannot exceed 2000 characters. |
value >2000 chars | 400 | Length of External System RefrenceId cannot exceed 2000 characters. |
Test Your API Call
Use Swagger to test your API call. To access the Swagger environment for your Org, replace {POD#} with the Pod where your Org exists:
https://api{POD#}.silverpop.com/restdoc/#!/channels/send_sms_to_contact_source_post_15
For example, here’s the link to use if your Org is on Pod 1:
https://api1.silverpop.com/restdoc/#!/channels/send_sms_to_contact_source_post_15