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 legacyapi@attentivemobile.com for a legacy API token.

URL

POST https://api.attentivemobile.com/1/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.

We sanitize the to field on all inbound API requests to account for discrepancies in phone number format.

body Body 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.

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.

type The type of message.

Currently, the only option available is transactional.

TRANSACTIONAL string Required Note that this field is case-sensitive.
link The shortened URL configured and provided by Attentive. client.attn.tv string Optional
mediaUrl URL of image that accompanies MMS. http://website.com/some_url.png string Optional Messages 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

Code Description Notes
200 OK The message was sent successfully.
400 Bad Request The 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.
403 Forbidden Invalid 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.