Transactional Messages

Transactional Messages

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 Transactional Messages API to send both SMS and MMS messages to your subscribers. For example, we have various integrations with customer service platforms, such as Zendesk and Kustomer, that leverage the Messages API to send customer service messages. Additionally, you can send transactional messages to customers containing information related to their order.

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://api.attentivemobile.com/1/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.
We sanitize the to field on all inbound API requests to account for discrepancies in phone number format.
bodyBody of the SMS/MMS* message.
*Note that messages sent with a mediaUrl will automatically be converted to MMS.
Your order of XYZ has been placed for $49.99. You will receive another text
alert when your order ships.
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.
typeThe type of message.
Currently, the only option available is transactional.
TRANSACTIONALstringRequiredNote that this field is case-sensitive.
linkThe shortened URL configured and provided by Attentive.client.attn.tvstringOptional
mediaUrlURL of image that accompanies MMS.http://website.com/some_url.pngstringOptionalMessages 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://api.attentivemobile.com/1/messages' \
  -X POST \
  -H 'Authorization: Bearer 1a2b3c4d5' \
  -H 'Content-Type: application/json' \
  -d '{"to": "555-555-555", "body": "Your order of XYZ has been placed for $49.99. You will receive another text alert when your order ships.", "mediaUrl": "http://website.com/some_url.png", "type": "TRANSACTIONAL"}'

Status codes

CodeDescriptionNotes
200OKThe message was sent successfully.
400Bad RequestThe message was not sent. The following issues could have occurred:
  • Missing "type": "TRANSACTIONAL" parameter.
  • Missing to parameter (phone number must be present).
  • Invalid or unmatched phone number.
403ForbiddenInvalid API token.

Note the following:

  • Messages can only be sent to opted-in subscribers.
  • Messages are sent using the shortcode assigned during the onboarding process.
  • There is validation to prevent delivery of the same message to the same user in a short period of time. This prevents duplicate messages from being delivered.