Loading
Prepare for Email to Become the Default Login ExperienceRead More
Contact Center
Use Case: Use an Endpoint to Populate a Screen with an External Data Source

Use Case: Use an Endpoint to Populate a Screen with an External Data Source

An endpoint connects an external data source to your Apex form messaging component for dynamic WhatsApp Flows. Present information from an external source on a screen in a form. For example, a doctor’s office could create a form that asks a customer which body part hurts, and then present a list of doctors who specialize in that ailment.

Required Editions

View supported editions.
Checkmark This article applies to: Enhanced WhatsApp channels
X icon This article doesn’t apply to: Enhanced In-App Chat, Enhanced Web Chat v1, Enhanced Web Chat v2, Enhanced Facebook Messenger, Standard and Enhanced SMS, Enhanced Apple Messages for Business, Enhanced LINE, and Bring Your Own Channel
User Permissions Needed
To create messaging components:

Customize Application AND View Setup and Configuration

OR

System Administrator

To send and receive messages in Messaging: Messaging Agent

Before you attempt to create something similar to this example, familiarize yourself with Meta’s Implement Endpoints for Flows documentation.

  1. Open the Flow format of an Apex-based form messaging component.
  2. Fill in the Enable Endpoints section of the Initial Message.
    1. In the Enable Endpoint field, select True.
    2. In the Endpoint URL field, enter your endpoint.
      Enable Endpoints section filled out with Enable Endpoint set to True, and URL populated in the Endpoint URL field.
  3. To create a screen that asks the customer which body part is hurting, navigate to the Screens section and click + Add Screen.
  4. Under Flow Screen Title, in the Text field, enter the title that customers see at the top of this screen in the flow. In this example, we’ll enter Patient Intake.
  5. Click +Add Content, click to expand the Selection list, and then select Single-Select Question. Click Done.
    This Single-Select Question screen element lets you create a list of body parts for a customer to choose from. Based on their selection from that list, you’ll present a list of compatible doctors on the following screen. Click to expand the Single-Select Question element, and fill in its fields.
    1. Under Field ID: Text, name it medical_need.
    2. Under Title: Text, add the question that presents to customers. Something like, Where are you experiencing pain?
    3. Under Options: Options Mode, select Static Options.
    4. Click Manage Options.
    5. Click + Add.
    6. Under Option 0, in the ID field, enter the internal ID for this field.
    7. In the Label field, select Literal, and enter a body part that your doctor practice can treat, such as Arm, in the field below it.
      The Manage Options modal expanded with menu selections filled out. ID and Label text fields are both set to the word Arm, which is a possible menu selection.
    8. Click + Add to create menu selections for additional body parts that you have doctors for.
  6. Save your changes.
    At this stage, your form preview shows the Patient Intake screen with your single-select question and its body part options.
    Screen preview showing the Flow Screen Title, the question Title, and two single-select menu options.
  7. Back under Screen Elements for the same screen, click to minimize the Single-Select Question element that you just created.
    In this next step, create the button that a customer clicks to confirm their answer to the question Where are you experiencing pain?
  8. Click + Add Content, click to expand Other Content Types, select Footer, and click Done.
  9. Under Footer Button, in the Text field, enter Continue.
  10. In the Footer Action section, in the Footer Action field, select Data Exchange.
  11. Click Configure Payload.
    1. Under Name, enter the Field ID of your single-select question. In this case, we named it medical_need.
    2. For Type, select Reference.
    3. For Value, select [Input] Patient Intake - medical_need.
      Data Exchange Payload modal window expanded. Name is set to medical_need, and Value is selected as [Input] Patient Intake - medical_need.
  12. Save your changes.
    Now your screen preview shows the Continue button beneath your single-select question.
    Screen preview with the addition of the Continue footer button.
  13. To create a new screen that presents a list of doctors from the endpoint’s database based on the selection that your customer makes in the previous screen, click + Add Screen.
  14. In the Flow Screen Title section, in the Text field, enter a header for this screen. We’ll call ours Doctor Preference.
  15. Under Screen Elements, click +Add Content, click to expand Selection, select Dropdown Selection, and click Done.
  16. Click to expand Dropdown Selection.
    1. Under Field ID, in the Text field, name it doctor_list.
    2. Under Title, in the Text field, enter the command that the customer sees on the form. Something like, Select a Doctor.
    3. Under Options, in the Options Mode field, select Dynamic Reference.
    4. In the Select Array Field dropdown, select [Data] Doctor List - array.
  17. Save your changes.
    Your screen preview shows the Doctor Preference screen with a dropdown of doctors populated from your external data source.
    Screen preview with Flow Screen Title set to Doctor Preference, dropdown field title set to Select a Doctor, and the dynamic reference dropdown field set to an array.
  18. Continue to build the rest of your flow.
 
Loading
Salesforce Help | Article