Knowledge Base - Marketing Master IO

Using Dynamic Carousel feature for Messenger and IG Chatbots

In this article, you'll learn to use dynamic carousel feature for chatbots.

  1. Go to Facebook & Instagram > Chatbot Flow Builder

    image.png

  2. Create New Messenger Flow > Enter Flow Name > Add a dynamic carousel element

    image.png

    Configuring dynamic element

    Step 1: Choosing the Data Source

    Step 2: Configuring Data Source

    Step 3: Assigning Source Array

    Step 4: Assigning Carousel Item Values

  3. Choosing Data Source: Click on the dynamic carousel element > Choose Data Source (Google Sheet / HTTP Request) > Next

    image.png

  4. Configuring Data Source: Enter the request URL and parameters > Test Request

    image.png

    In this, I'm using movies API for show you the demo.

  5. Assigning Source Array: Click on the Map Response button and check the response

    image.png

  6. Assigning Carousel Item Values: Assign values by using custom variables > Confirm

    image.png

    Adding a Keyword Trigger

    We have configured a dynamic carousel element. Let's add a keyword trigger and test.

  7. Add a keyword Element in the interface

  8. Enter keyword > select match type and OK

    image.png

    Adding a "No Values Found" Message

  9. Add a text element > Enter Message

    image.png

    Making Quick Replies Dynamic

  10. Add quick replies to the dynamic carousel element

    image.png

  11. Click on Create Custom Variable

    image.png

  12. Enter variable name > fallback value and Save

    image.png

  13. Click on the dynamic carousel element > Go to step 2: Configure Data Source > Change Page value > Test Request

    image.png

  14. Add a Function element

    image.png

  15. Click on the function element > clear the existing codes and Add JavaScript code

    let page = Number({{movie_page_value}}) + 1
    return page;

    image.png

  16. Add a new function element for "back" > clear the existing codes and Add JavaScript code

    let page = Number({{movie_page_value}}) + 1;
    return page < 1 ? 1 : page;
  17. Re-route the function's next step to the dynamic carousel element and save

    image.png

  18. For Next & Back Label(Dynamic): Click on Create Custom Variable > Enter Variable Name > Enter Fallback Value

    image.png

  19. Update the Label Value: Go to Utilities > Custom Variables > Edit > Update label and save

  20. Go to chatbot flow builder > Add a function element (for the dynamic label) > Enter Javascript code

    let page = Number({{movie_page_value}});
    let limit = 20;
    
    let before = page * limit;
    let after = (page + 1) * limit;
    
    return `Next ${before} - ${after}`
  21. Save Output To Custom Variable "Next" and Save

    image.png

  22. Repeat the same for the Back label

    let page = Number({{movie_page_value}});
    let limit = 20;
    
    let before = (page - 1) * limit;
    let after = page * limit;
    
    return `Back ${before} - ${after}`
  23. Save output to the custom variable "Back" and Save

    image.png

  24. Connect the nodes as displayed below

    image.png

    Testing the Flow

    Go to Messenger > Send Trigger Keyword and test the flow.

image.png