Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

Handling Opt-Ins

Opt-In Basics

Collecting opt-ins for your SMS recipients is a critical to responsible communications, and is part of Twilio's Acceptable use Policy. Twilio for Salesforce facilitates opt-in collection and tracking via two custom objects: Opt_In_Keyword__c and Opt_In__c.

Opt_In_Keyword__c allows you to define an opt-in keyword such as "volunteer". When a user texts in a message that matches the keyword, and Opt_In__c record will be created with the phone number, opt-in status, message text, message SID, keyword, and a lookup to the contact or lead associated with the phone number.

Note that if a recipient changes their phone number, they will need to opt-in again. If the Mobile Phone field is updated, the opt-in record will be set to inactive. Additionally, if a user replies to your message with an industry-standard block word like "STOP", opt-in status will be set to inactive.

Campaign Opt-In

Opt_In_Keyword__c allows you to associate a keyword with a campaign. When a keyword is associated with a campaign, recipients will not be messaged unless they have an opt-in for that specific keyword. You can create an Opt-In Keyword by using the app launcher to go to the opt-in keywords page.

Tip: Choose an opt-in keyword that someone isn't likely to send accidentally. For example, "Yes" would be a poor keyword choice, while "donate2019" might be a better choice.

Once you have created an Opt-In Keyword, you should be able to click into the record:

Screen Shot 2019-04-25 at 1.19.32 PM.png

Click on the "Related" tab and then click on "New" in the campaigns section.

Screen Shot 2019-04-25 at 1.19.46 PM.png

You can then create a new campaign to be associated with the keyword:

Screen Shot 2019-04-25 at 1.20.33 PM.png

Screen Shot 2019-04-25 at 1.20.48 PM.png

You can then text into your Salesforce phone number with the keyword (in this case "volunteer"). When you text in, a new Opt-In record will be created and related to the keyword and set as active:

Screen Shot 2019-04-25 at 1.22.26 PM.png

If we click into the Volunteer Campaign, we'll now see that we need to add opted-in users to the campaign before using the SMS Campaign component:

Screen Shot 2019-04-25 at 1.23.01 PM.png

Click on the "Add Opt-Ins" button to add in all new members who have texted in the opt-ins keyword:

Screen Shot 2019-04-25 at 1.23.11 PM.png

Note that now, when you send SMS campaigns, you'll see that opt-ins are reflected in your potential deliverability. Messages will not be sent to a campaign member unless they have opted in using the keyword that corresponds to the campaign.

Screen Shot 2019-04-25 at 1.23.28 PM.png

1:1 SMS Opt-In

In addition to requiring opt-ins for campaigns, you can require opt-ins for use of the 1:1 SMS Messaging component. Under Twilio Configuration > SMS Settings click on the "Require Opt-In for 1:1 SMS Messaging" toggle and then click save.

Screen Shot 2019-04-23 at 6.01.47 PM.png

Once enabled, a contact or lead must have at least one opt-in record in order to receive 1:1 SMS messages. It is not currently possible to configure a specific opt-in keyword to be used for 1:1 messaging spefically. If a user attempts to message a recipient who does not have an opt-in, they will see this message in both the 1:1 SMS Message component and the SMS Inbox:

Screen Shot 2019-04-19 at 12.51.50 PM.png

Rate this page:

Need some help?

We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the Twilio tag on Stack Overflow.