Loading

Engagement - Managing WhatsApp Opt-Out Requests in Salesforce Marketing Cloud

Дата публикации: May 29, 2026
Описание

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.

Решение

Note:

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.

Prerequisites

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 NamePrimary KeyData TypeRequired
ContactkeyYesTextYes
MobilenumberNoPhoneYes
LocaleNoLocaleYes


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 NamePrimary KeyData TypeRequired
ContactkeyYesTextYes
MobilenumberYesPhoneYes
OptoutstatusNoNumberYes
LocaleNoLocaleYes


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 NamePrimary KeyData TypeRequired
ContactkeyNoTextYes
OptoutstatusNoNumberYes

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 NamePrimary KeyData TypeRequired
ContactkeyNoTextYes
MobilenumberNoPhoneYes
Date_optedoutNoDateYes


Note: Select 'Use current datetime' for Date_optedout.
 

Handling Opt-Outs Using CTA Message Templates

Here are the steps to handle opt-outs when using Call to Action (CTA) message templates:

  1. Generate a landing page in Marketing Cloud Engagement and copy the URL.
  2. Create a message template in your WhatsApp Manager within your META account.
  3. Choose a CTA button, bearing in mind that a message can only have a maximum of two CTA buttons.
  4. For "Type of Action", select "Visit Website."
  5. Enter button text such as "Opt Out" or "Stop Promotions."
  6. For "URL Type", choose "Dynamic."
  7. In the "Website URL" field, enter the URL from the Landing page you created.
  8. For "Add Sample URL", enter an example like "[Your_Landing_Page_URL]?attribute1=value1&attribute2=value2."
  9. Save the message template and await its approval.
  10. Navigate to Content Builder and create a WhatsApp template message (Create -> Chat Messaging -> WhatsApp Template Message).
  11. Choose the WhatsApp template you just created.
  12. Scroll to the CTA button handling the opt-outs.
  13. In the Variable box, input the following AMPscript: %%[ set @parameters=concat('?','mobilenumber','=',[mobilenumber],'&','Contactkey','=',[Contactkey]) ]%% %%=v(@parameters)=%%

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."
 

  1. Return to the landing page dedicated to the CTA opt-out process. You will need to input the following AMPscript:
%%[
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)=%%
*/
  1. Scroll down for automation setup and import process.


 

Handling Opt-Outs Using Quick Reply Message Templates

For handling opt-outs when using Quick Reply message templates, follow these steps:

  1. Create a message template in your WhatsApp Manager within your META account.
  2. Choose the language for this message at the top left.
  3. Click "Add a button" at the bottom and select "Quick Reply -> Marketing Cloud Opt-out."
  4. Tick "I understand that it's [Your Business name's] responsibility to stop sending marketing messages to customers who opt out."
  5. Take note of the button text name; it is static according to the language used in the template.
  6. Compose the rest of your message, save, and wait for the message approval.
  7. In Marketing Cloud Engagement, create a Journey with an INBOUND CHAT ENTRY EVENT.
  8. Choose the application channel.
  9. Enter the button text name in the KEYWORD section and save the entry event.
  10. Drag and drop an "Update Contact" activity into the journey.
  11. Select the data extension "Whatsapp_QuickReply_OptOuts".
  12. Update the attributes as follows:
  • Attribute 1: Select "Contactkey" and insert the following Handlebars syntax {{Contact.Key}}
  • Attribute 2: Select "OptOutStatus" and set it equal to 1
  1. Set up an automation with a query activity that joins data extensions "Whatsapp_Subscribers" and "Whatsapp_QuickReply_OptOuts" and APPEND the results in "Whatsapp_OptOut_Requests."

QUERY TO USE:​​​​​

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.
 

Automation Configuration to Handle WhatsApp Opt-Out Requests

  1. Create a chat messaging import definition.
  2. Set the source as "FROM EXISTING DATA EXTENSION" and select "Whatsapp_OptOut_Requests."
  3. Fill in the Chat Messaging App and App Channel according to the channel you wish to manage.
  4. Map the attributes to (_ContactKey, _MobileNumber,_Locale,_OptOutStatusID).
  5. Insert a SQL query activity into STEP 1, inserting the query from point 14 from "How to handle opt-outs when using Quick Reply message templates."
  6. For STEP 2, input the chat messaging import definition you created.
  7. For STEP 3, insert a SQL query activity. This query should APPEND the results into the data extension "Whatsapp_OptOut_History."


QUERY TO USE:

select Contactkey as Contactkey, mobilenumber as mobilenumber from [Whatsapp_OptOut_Requests]

Verify Opt-Out Status

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

 
Загрузка
Salesforce Help | Article