Opt-In/Out Handling

Airship handles requests to opt in and opt out of SMS notifications.

Users must opt in to receive SMS messages from your Sender ID and can opt out at any time. There are four ways users can opt in or opt out of your SMS audience:

SMS Data Protection and Compliance

Requests to opt in to or out of SMS notifications are processed by the Airship Service, but the obligation to comply with such requests remains with the customer. Our opt-in and opt-out database is encrypted and is also segregated from campaign content. For opt-ins and opt-outs that occur via mobile-originated messages, Airship stores date/time data for those opt-ins and opt-outs for a rolling 4 years.

Mobile-Originated Opt-Ins

A mobile-originated message is a message sent from a member of your audience (originating from the mobile handset of a user) to you.

Single Opt-In

Single opt-in is the process of registering users and considering them opted in when they send you a single message containing a keyword. This method does not require users to confirm that they want to opt in through a second mobile-originated (MO) message.

While a single opt-in is a simple way to register users, it may not always be an optimal opt-in method. Airship mobile-originated opt-in handling defaults to a double opt-in process. Contact Airship Support if you want to take advantage of a single opt-in workflow.

The response to the keyword is a confirmation text message that provides information about the text program. The message usually:

  • confirms that the user has subscribed to an ongoing text program.
  • provides the number of messages the subscriber can expect to receive.
  • informs the subscriber where they can obtain more information and how they can opt out.
Example:
BrandX: Welcome to the BrandX Info and Alerts Program! Message frequency varies by use. For help, reply HELP. To end, reply, STOP. Msg&DataRatesMayApply.

Double Opt-In

Double opt-in requires a user to send you a keyword indicating that they want to receive mobile messages, and a second keyword confirming their choice:

  1. Your audience texts a keyword to trigger the opt-in process.
  2. Airship sends your audience a message requesting confirmation using a keyword.
  3. Your audience texts the confirmation keyword, opting in to your audience.

Because each message in the opt-in workflow supports unique keywords, the double opt-in method provides multiple indices to categorize users as they opt in to your audience; you can add, remove, or replace tags for any of the opt-in messages, ensuring that you precisely segment your audiences and target future messages to the right users.

Keywords

You can add additional keywords to trigger an opt-in or opt-out. See: SMS keywords.

Non-Mobile Single Opt-In

If users provide consent to receive text messages without a mobile-originated keyword — like through your website or app — you can register them through the API in a single step. Use the /api/channels/sms endpoint with the date-time when the user opted_in.

 Tip

It may take up to an hour before you can message new users. If you want to message a new SMS user immediately, you can register new SMS users and send a message simultaneously using the create-and-send API or the Upload Users Audience option to send your SMS message.

POST /api/channels/sms HTTP/1.1
Authorization: Basic <application authorization string>
Accept: application/vnd.urbanairship+json; version=3
Content-Type: application/json

{
    "msisdn" : "15035556789",
    "sender": "12345",
    "opted_in": "2018-02-13T11:58:59"
}

When registering your audience without a mobile keyword, it is your responsibility to obtain express written consent from users. If users have not provided sufficient consent, you should perform a double opt-in.

Non-Mobile Double Opt-In

If users provide their phone numbers and express interest in SMS messages through your website or app but do not give sufficient consent to receive SMS messages from a particular sender, you can register them through the Airship API without an opted_in value.

When you register a user through the API without an opted_in value, Airship sends them a message prompting them to opt in. The user must then respond with a valid keyword to opt in to notifications.

 Tip

Airship generates a channel_id even when you register users who have not opted in. You can add tags to these channels and associate them with named users before audience members opt in.

sequenceDiagram Participant Audience Participant You Participant Airship Audience->> You: Registers via webform/app You->> Airship: Register user through API Airship->>Airship: Creates channel ID for audience You-->> Airship: (Optional) add tags to new channel Airship->> Audience: Sends opt-in request via SMS Audience->> Airship: Texts opt-in keyword to Airship note over Audience, Airship: Your audience/channel ID is opted in and can receive messages

When registering your audience without a mobile keyword, it is your responsibility to ensure that your users understand that they are agreeing to receive SMS messages from you and provide express written consent to receive SMS messages from you.

For mobile websites, you can set up a hyperlink or a button on a page that will open up the device’s messaging app and prepopulate the long or short code and keyword for the SMS opt-in.

 Note

This feature will work on most mobile devices as well as a few desktop devices, but is not guaranteed to work on every mobile device model or operating system.

HTML Hyperlink Template:
<a href="sms://CODE?&body=KEYWORD">Click Here to Opt-In</a>
HTML Hyperlink Example:
<a href="sms://54321?&body=JOIN">Click Here to Opt-In</a>

Update Opt-in Status

If your audience opts in to messaging outside of a standard opt-in flow — through your website or app — you can update the channel’s opted_in value to add them to your messaging audience.

You can also update a channel to change its time zone and locale information.

 Note

You must know the channel_id to update a channel. You can look up a channel by msisdn and sender combination to find the channel identifier that you want to update.

Update the opted_in value for a channel
PUT /api/channels/sms/{channel_id} HTTP/1.1
Authorization: Basic <application authorization string>
Accept: application/vnd.urbanairship+json; version=3
Content-Type: application/json

{
   "msisdn": "15035556789",
   "sender": "US:12345",
   "opted_in": "2018-02-13T11:58:59",
   "timezone": "America/Los_Angeles",
   "locale_country": "US",
"locale_language": "en"
}

Opt out of SMS messages

If your audience opts out of messaging, you can mark the channel as opted-out (inactive) and they will not receive alerts even when they are addressed in the future. Use the /api/channels/sms/opt-out endpoint and specify the sender and msisdn.

Opt-out of SMS messages
POST /api/channels/sms/opt-out HTTP/1.1
Authorization: Basic <application authorization string>
Accept: application/vnd.urbanairship+json; version=3
Content-Type: application/json

{
   "sender": "US:12345",
   "msisdn": "15035556789"
}

Automated Opt-In Interactions

You can define automated responses to opt-in keywords based on whether an msisdn is opting in for the first time or is currently opted in. Contact Airship Support to set up automated opt-in interactions. Examples:

  • First time opting in — Send a welcome message: “Thanks for joining BrandX! Here is your offer code….”
  • Currently opted in — Send a welcome message without an offer: “Looks like you are already subscribed to BrandX.”

Manually Triggered Keyword Interactions

You can trigger a keyword interaction on behalf of your audience, without receiving a mobile originated (MO) message, using the Airship API. You may want to do this to test your keywords or to trigger keyword interactions on behalf of your audience — including keywords that opt users in or out of your messaging audience.

For example, if a member of your audience requests to be removed from your messaging audience over the phone, you could use the following operation to opt them out. This triggers the mobile terminated message confirming that the user has been removed from your messaging audience.

Trigger a “STOP” Keyword Interaction
POST /api/sms/15035556789/keywords HTTP/1.1
Content-Type: application/json
Authorization: Basic <master authorization string>

{
   "keyword" : "stop",
   "sender_ids" : [ "US:54321", "1234"]
}