When using WhatsApp messaging in Salesforce Marketing Cloud Engagement, contacts who opt out must be properly unsubscribed to comply with Meta's messaging policies and respect customer communication preferences. This article covers how to set up the required data extensions and configure opt-out handling for both Call To Action (CTA) button templates and Quick Reply button templates, including the automation needed to process opt-out requests and update contact subscription status. The article culminates by illustrating the automation process required for handling WhatsApp requests, ensuring you maintain customer satisfaction while abiding by their communication preferences.
Extensive testing has been conducted to ensure the functionality of the WhatsApp opt-out requests management process in Salesforce Marketing Cloud Engagement. It is strongly advised that users thoroughly test and verify the performance of all processes both before and after the implementation in their Salesforce environment. This includes the creation and updating of the necessary data extensions, the handling of opt-outs using Call To Action (CTA) and Quick Reply message templates, and the automation configuration for handling WhatsApp opt-out requests. In case of any support requests related to issues with the process, it may be necessary to disable the settings to facilitate troubleshooting. As always, maintaining customer satisfaction and respecting their communication preferences is of utmost importance throughout this process.
Before beginning, ensure that you have created the necessary data extensions to store all your WhatsApp chat messaging contacts and opt-out requests.
Create a non-sendable data extension named "Whatsapp_Subscribers", which should be updated hourly using an external import process. This extension requires the following three columns:
| Field Name | Primary Key | Data Type | Required |
|---|---|---|---|
| Contactkey | Yes | Text | Yes |
| Mobilenumber | No | Phone | Yes |
| Locale | No | Locale | Yes |
Note: Only use a 2-character locale value.
Next, construct a non-sendable data extension named "Whatsapp_OptOut_Requests". This extension will store all opt-out requests and should have a retention set to 7 days. It needs the following columns:
| Field Name | Primary Key | Data Type | Required |
|---|---|---|---|
| Contactkey | Yes | Text | Yes |
| Mobilenumber | Yes | Phone | Yes |
| Optoutstatus | No | Number | Yes |
| Locale | No | Locale | Yes |
Subsequently, create a sendable data extension named "Whatsapp_QuickReply_OptOuts" to store opt-out requests from Quick Reply buttons this should have a retention set to 7 days. It needs two columns:
| Field Name | Primary Key | Data Type | Required |
|---|---|---|---|
| Contactkey | No | Text | Yes |
| Optoutstatus | No | Number | Yes |
Finally, create a non-sendable data extension named "Whatsapp_OptOut_History" to record the history of successful WhatsApp opt-outs. It should contain the following columns:
| Field Name | Primary Key | Data Type | Required |
|---|---|---|---|
| Contactkey | No | Text | Yes |
| Mobilenumber | No | Phone | Yes |
| Date_optedout | No | Date | Yes |
Note: Select 'Use current datetime' for Date_optedout.
Here are the steps to handle opt-outs when using Call to Action (CTA) message templates:
NOTE: When creating the Journey where you will send this WhatsApp message, within the entry data extension there should be two columns for mobile number and contact key respectively. In the example above, these columns are referred to as "mobilenumber" and "Contactkey."
%%[
var @mobilenumber, @Contactkey, @insertRow, @locale
/* Retrieve the URL parameters */
set @mobilenumber = QueryParameter('mobilenumber')
set @Contactkey = QueryParameter('Contactkey')
/* Lookup locale from the "Whatsapp_Subscribers" Data Extension */
set @locale = Lookup('Whatsapp_Subscribers', 'locale', 'Contactkey', @Contactkey)
/* Insert data into your Data Extension */
set @insertRow = InsertDE('Whatsapp_OptOut_Requests', 'mobilenumber', @mobilenumber, 'Contactkey', @Contactkey, 'locale', @locale, 'optOutStatus', '1')
]%%
/*
Only for testing to see if the values are coming through
Mobile: %%=v(@mobilenumber)=%%
Contactkey: %%=v(@Contactkey)=%%
Locale: %%=v(@locale)=%%
*/
For handling opt-outs when using Quick Reply message templates, follow these steps:
select WS.contactkey as Contactkey, WS.mobilenumber as mobilenumber, WS.locale as locale, WQR.optoutstatus as optoutstatus from [Whatsapp_Subscribers] as WS join [Whatsapp_QuickReply_OptOuts] as WQR on WS.contactkey = WQR.Contactkey
Note: Refer to "Automation Configuration to Handle WhatsApp Requests" below for further details.
QUERY TO USE:
select Contactkey as Contactkey, mobilenumber as mobilenumber from [Whatsapp_OptOut_Requests]
To confirm a contact has been opted out, navigate to their contact record in Contact Builder and click the Attributes tab. Scroll to the Chat Message Demographics section and click the mobile number to open the Chat Message Subscriptions page. The contact should appear as Opted Out.
Marketing Cloud - Importing WhatsApp Contacts
https://help.salesforce.com/s/articleView?id=004461740&type=1
WhatsApp Business Platform - WhatsApp sends fail due to '131026' Error
https://help.salesforce.com/s/articleView?id=001245415&type=1
Marketing Cloud - WhatsApp-First Business Messaging (Meta) FAQ
https://help.salesforce.com/s/articleView?id=000396933&type=1
Marketing Cloud Chat Messaging Extract
https://help.salesforce.com/s/articleView?id=mc_es_chat_messaging_extract.htm&type=5
AMPscript InsertDE() Function Reference
https://ampscript.guide/insertde/
000395648

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.