Messages (ARCHIVED)
Attentive is a comprehensive personalized mobile messaging solution that can integrate with a variety of different platforms to send mobile messages programmatically. Make calls to the Messages API to send both SMS and MMS promotional and marketing messages to your subscribers. We have various integrations with third-party partners that currently leverage the Messages API. Before you begin, ensure that you're working with a member from our White Glove team (whiteglove@attentivemobile.com) or an engineer at Attentive to coordinate sending test messages with this API.
Note: Legacy APIs and the APIs outlined in the Attentive API section need separate tokens. Contact legacyapi@attentivemobile.com for a legacy API token.
URL
POST https://client-api.attentivemobile.com/v1/messages
Headers
Header name | Description | Value | Required |
Authorization | You must provide an access token. Contact legacyapi@attentivemobile.com for this token. | Bearer <token>
|
Required |
Content-type | The format of returned data. | application/json
|
Required |
Parameters
Parameter | Description | Example | Type | Required | Notes |
to
|
Phone number of a subscriber. | 555-555-5555
|
string | Required | Currently, Attentive only supports phone numbers from the United States, Canada, and the United Kingdom. |
body
|
Body of the SMS/MMS message. | 30% off sitewide sale going on now. Use code SAVE30.
|
string | Required | Attentive automatically prepends the customer’s name to all outgoing messages.
If you want to include a URL, it must be sent with the body. |
messageId
|
The unique identifier that is assigned to a campaign message. You need to work with our White Glove team (whiteglove@attentivemobile.com) or an engineer at Attentive to send test messages to generate a messageId .
This can be used for tracking purposes in Attentive’s platform. |
123456789
|
string | Optional | |
type
|
The type of message. Currently, the only option available is transactional .
|
TRANSACTIONAL
|
string | Optional | Note that this field is case-sensitive. |
mediaUrl
|
URL of image that accompanies MMS. | http://website.com/
|
string | Optional | Messages sent with a mediaUrl will automatically be converted to MMS.
The following are supported file types:
|
Sample JSON request
curl 'https://client-api.attentivemobile.com/v1/messages' \
-X POST \
-H 'Authorization: Bearer 1a2b3c4d5' \
-H 'Content-Type: application/json' \
-d '{"to": "555-555-5555","body": "30% off sitewide sale going on now. Use code SAVE30.", "messageId": "123456789"}'
Sample JSON response
{
"to":"555-555-555",
"body":"30% off sitewide sale going on now. Use code SAVE30.",
"messageId":"123456789"
}
Status codes
The following table lists the returned HTTP status codes.
Code | Description | Notes |
200 | Success | The message was sent successfully. |
400 | Bad Request | The message was not sent. The following issues could have occurred:
|
403 | Forbidden | Invalid API token. |
404 | Not Found | Invalid or unmatched phone number. |
500 | Internal Server Error | Missing required parameters. |
Note the following:
- Messages can only be sent to active and opted-in subscribers.
- Messages are sent using the shortcode assigned during the onboarding process.