You are here:
Create a Dynamic WhatsApp Flow
To create a dynamic WhatsApp Flow, create an Apex-based form messaging component and then add a Flow format to it.
Required Editions
| View supported editions. | |
This article applies to:
|
Enhanced WhatsApp channels |
This article doesn’t apply to:
|
Enhanced In-App Chat, Enhanced Web Chat v1, Enhanced Web Chat v2, Standard and Enhanced Facebook Messenger, Standard and Enhanced SMS, Enhanced Apple Messages for Business, Enhanced LINE, and Bring Your Own Channel |
To make the Flow dynamic, you can:
- Add dynamic references to set Flow properties based on conditions.
- Use If and Switch conditional logic to conditionally show screens and content within a screen.
- Add conditions based on any input data that the flow receives.
- Create a Form Based on an Apex Class
Apex-based forms offer more flexibility than global action-based forms, enabling you to create both static and dynamic WhatsApp messages. To create an Apex-based form, create the Apex class, and then link it to a form messaging component. When the messaging end user submits their responses to the form, Salesforce executes the Apex, sending the data to Salesforce. You must configure how to save that data. - Use Case: Use a Switch Element to Show Screens Based on Conditional Logic
Use the Switch screen element to dynamically show or hide content. It compares a single field value against one or more specified values, and then displays the content associated with the first value that is an exact match. If no match is found, it returns the preconfigured default value. Unlike the If element, Switch is limited to performing an exact match comparison on a single field and doesn’t support complex logical operators like AND or OR. - Use Case: Use If Condition to Show Content Based on Complex Logic
Use the If Condition screen element to dynamically show content or screens. For example, you can use the If Condition to add a footer that navigates to a different screen based on the previous selection. With the If Condition screen element, Salesforce evaluates one or more conditions in sequence and displays the content if the condition evaluates to true. If the condition is false, the logic returns the other preconfigured content. Unlike the Switch conditional logic, If Condition logic supports complex criteria by combining conditions using AND and OR logical operators. - Use a Screen Flow to Pass Input Data to a Dynamic WhatsApp Flow
The screen flow can collect customer data and securely pass it into variables. These variables can then serve as input for the dynamic WhatsApp Flow that is created with an Apex-based form messaging component. To add personalized content to the message, in the Apex-based form messaging component, add dynamic references to this input data. For example, to schedule a veterinary appointment, the screen flow collects specific details, such as the type of animal and the issue, and dynamically passes this information to the Apex-based form messaging component. - Considerations when Adding a Flow Format to a Form
Keep these considerations in mind when you add a Flow format to a form messaging component.
Did this article solve your issue?
Let us know so we can improve!



