Add subscribers

You can use the Subscribers API to add (opt-in) subscribers to your Attentive list programmatically. After you add a user, the subscriber receives a welcome message that includes the legal text for compliance. Additionally, subscribers can be onboarded with optional metadata (such as age or gender) that can later be used for targeting and reporting.

Important! There is legal disclosure language that is required to be displayed in a clear and conspicuous manner. Make sure to edit the company name and terms & privacy links with URLs provided by your dedicated Client Strategy Manager or our White Glove team (whiteglove@attentivemobile.com). This legal disclosure language may not be hidden behind a link.

Note the following:

  • If you aren't already using this legacy API, it is recommended that you use the Subscribers API.
  • 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/add-subscribers

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
phone Phone number of a subscriber. 555-555-5555 string Required
visitorId The visitorId attribute needs to be pulled dynamically from your website.

The Attentive visitor ID is stored as a cookie with the name __attentive_id. Javascript with the below code:

var attentiveVisitorId = document.cookie.replace(/(?:(?:^|.*;\s*)__attentive_id\s*=\s*([^;]*).*$)|^.*$/, "$1");

1a2b3c4d5e6f7g8h9i0j string Optional
metadata Additional details to append to the subscriber’s record. Note that this includes the creativeId and email. {"creativeId":"1234", "email":"test@gmail.com", "first_name":"John", "age":30,"prior_purchase_skus ":[ "17382", "29811", "19181" ]} string Optional Must be structured as an array. We can accept any key/value combinations.
creativeId A unique identifier that can be used for tracking purposes. This informs you of which creative a user subscribed from. 1234 string Optional
email Email address of a subscriber. test@gmail.com string Optional

Sample JSON request

curl 'https://api.attentivemobile.com/1/add-subscribers' \
 -X POST \
 -H 'Authorization: Bearer 1a2b3c4d5' \
 -H 'Content-Type: application/json' \
 -d '{"phone": "555-555-5555", "visitorId":"1a2b3c4d5e6f7g8h9i0j", "metadata": {"creativeId":"1234", "email":"test@gmail.com", "first_name": "John", "age": "30", "prior_purchase_skus": [ "17382", "29811", "19181"]}'

Status codes

The following table lists the returned HTTP status codes.

Code Description Notes
200 OK Request successful. Existing subscriber.
201 Successful New subscriber created.
400 Bad request Data is improperly formatted.
401 Authorization error API key is incorrect.
500 Attentive server-side error n/a

Legal disclosure language

The following legal disclosure language is required to be displayed in a clear and conspicuous manner. This legal disclosure language may not be hidden behind a link.

Note that you must edit the company name and terms & privacy links with the URLs provided by your dedicated Client Strategy Manager (CSM) or our White Glove team (whiteglove@attentivemobile.com).

If subscriber must check a checkbox (e.g. checkout) to opt-in:

Note: Checkbox must be unchecked as default on page load.

By checking this box, you agree to receive recurring automated promotional and personalized marketing text messages (e.g. cart reminders) from {Company} at the cell number used when signing up. Consent is not a condition of any purchase. Reply HELP for help and STOP to cancel. Msg frequency varies. Msg & data rates may apply. View Terms {Terms_Hyperlink} & Privacy {Privacy_ Policy_ Hyperlink}.

If subscriber must manually enter number and click submit (no checkbox) to opt-in:

By submitting this form, you agree to receive recurring automated promotional and personalized marketing text messages (e.g. cart reminders) from {Company} at the cell number used when signing up. Consent is not a condition of any purchase. Reply HELP for help and STOP to cancel. Msg frequency varies. Msg & data rates may apply. View Terms {Terms_Hyperlink} & Privacy {Privacy_ Policy_ Hyperlink}

Additional requirements

You must send your final opt-in implementation to your dedicated CSM or our White Glove team before it goes live, so Attentive can review it.

You must also maintain records of customer opt-ins through the Subscriber API. For example, if a customer opts in through a checkout checkbox, you need to retain records showing the opt-in.