Messages API (Archived)

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 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 [email protected] for a legacy API token.

URL

POST https://client-api.attentivemobile.com/v1/messages

Headers

Header nameDescriptionValueRequired
AuthorizationYou must provide an access token. Contact [email protected] for this token.Bearer <token>Required
Content-typeThe format of returned data.application/jsonRequired

Parameters

ParameterDescriptionExampleTypeRequiredNotes
toPhone number of a subscriber.555-555-5555stringRequiredCurrently, Attentive only supports phone numbers from the United States, Canada, and the United Kingdom.
bodyBody of the SMS/MMS message.30% off sitewide sale going on now. Use code SAVE30.stringRequiredAttentive automatically prepends the customer’s name to all outgoing messages.
If you want to include a URL, it must be sent with the body.
messageIdThe unique identifier that is assigned to a campaign message. You need to work with our White Glove team or an engineer at Attentive to send test messages to generate a messageId.
This can be used for tracking purposes in Attentive’s platform.
123456789stringOptional
typeThe type of message. Currently, the only option available is transactional.TRANSACTIONALstringOptionalNote that this field is case-sensitive.
mediaUrlURL of image that accompanies MMS.http://website.com/
some_url.png
stringOptionalMessages sent with a mediaUrl will automatically be converted to MMS.
The following are supported file types:
  • gif
  • png
  • jpg
    Media size must be under 500KB.

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.

CodeDescriptionNotes
200SuccessThe message was sent successfully.
400Bad RequestThe message was not sent. The following issues could have occurred:
  • Subscriber not found
  • Subscriber is opted-out
  • Invalid Input - phone number or body missing from request
  • Illegal argument passed in
403ForbiddenInvalid API token.
404Not FoundInvalid or unmatched phone number.
500Internal Server ErrorMissing 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.