Genesys Cloud - Main

 View Only

Sign Up

  Thread closed by the administrator, not accepting new replies.
  • 1.  Dynamic list build in Messenger Bot

    Posted 08-23-2022 11:20
    No replies, thread closed.
    I am getting anywhere from 1 to 10 values back from a back end database api all (data action).  I am trying to show these values to my customer via dynamic slot.  However i don't know the exact number of values i will get back.  Here was current code when I knew we were getting 4 values back consistently. 

    MakeList(Flow.eligibleDates_String[0], Flow.eligibleDates_String[1], Flow.eligibleDates_String[2], Flow.eligibleDates_String[3], "Choose Other Date")

    But if i only get 1 value back, this code fails.  Was trying to think of something like i +1, etc. but can't work it out.  Any thoughts on how to have makeList perform dynamically based on undetermined set of results from api call. 

    thanks, Clayton


    #ArchitectureandDesign
    #Implementation

    ------------------------------
    Clayton Curtis
    Enova Online Services, Inc.
    ------------------------------


  • 2.  RE: Dynamic list build in Messenger Bot

    Posted 08-23-2022 12:20
    No replies, thread closed.
    The advise is to not use MakeList code to generate a list. You need a Data Action that returns the dates as an Array of values and don't use MakeList to turn it into an array.

    The data action returns one pair arrays (the eligibleDates in this case and any synonyms you want) and then the Data Action is called in the Bot Flow. The Bot Flow will use the mapped key (eligibleDates) to create the slot list for you and display it

    If you want a sample, let me know and I can provide it. 



    ------------------------------
    Jane Hendricks
    Genesys - Employees
    ------------------------------



  • 3.  RE: Dynamic list build in Messenger Bot

    Posted 08-23-2022 12:49
    No replies, thread closed.
    I think i follow but would love an example to get me on track.  thanks so much for this advice!

    ------------------------------
    Clayton Curtis
    Enova Online Services, Inc.
    ------------------------------



  • 4.  RE: Dynamic list build in Messenger Bot

    Posted 08-23-2022 12:55
      |   view attached
    No replies, thread closed.
    I have attached a CSV to create a Data Table, a Data Action to consume it and a Bot and Messaging Flow to use it all. Hopefully that helps.

    ------------------------------
    Marc Sassoon
    Genesys - Employees
    ------------------------------

    Attachment(s)

    zip
    Get a Store_v1-0.zip   17 KB 1 version


  • 5.  RE: Dynamic list build in Messenger Bot

    Posted 08-24-2022 12:58
    No replies, thread closed.
    Thanks much for the code..this is good.  However, and correct me if I am wrong, this presents all the values that come back.  In my ideal scenario, assume it get 10 dates back from my search.  I want to show the first 4 dates and an "other date" option.  If they select other date, it would show dates 5-8, then 9 and 10 if they selected other again.   is that possible?

    ------------------------------
    Clayton Curtis
    Enova Online Services, Inc.
    ------------------------------



  • 6.  RE: Dynamic list build in Messenger Bot

    Posted 08-24-2022 16:28
    No replies, thread closed.
    So you have a Dynamic List and you want to present a subset of that list, but won't know how big the subset will be.
    I assume you want to present cards in messenger chat to the customer? Not have them enter the date. (I believe the max is 9 or 10 that can be displayed)
    But if you want to break it up further:

    Of the top of my head would be something like:
    Create a reusable task.
    And use a loop to populate the display list. 
    Loop where max loops == count of Dynamic list - So it will only ever go through the total Dynamic list never more.
    Then just add to your display list the value GetAt(Task.Dynamiclist, Task.LoopIndex) - So always adding the current Dynamic List item being looped through.
    if Task.LoopIndex == 4 then or Task.LoopIndex == 9 add "Other Date"
    Then at then end, do an if the loop index +1 == Count of dynamic list, End Task and go down a completed exit path for the task, otherwise End task going to a different exit path eg more loop path.
    On the more loop path just call the same reusable task, passing the LoopIndex back in so the loop knows where to kick things back off from.

    If I get some time I'll try to create a dummy flow doing this, but the above is the gist of it.

    ------------------------------
    Anton Vroon
    ------------------------------



  • 7.  RE: Dynamic list build in Messenger Bot

    Posted 08-25-2022 12:10
      |   view attached
    No replies, thread closed.
    Ok, I updated my file to include some new code. Instead of making a new list, just append an item. So I used an Update Data block after the Data Action to Create Collection of type String Collection. In the Expression, I do AddItem(Flow.Town,"Somewhere else") so you could use AddItem(Flow.eligibleDates_String,"Choose Other Date") to add the extra button to the list the Data Action retrieves.

    ------------------------------
    Marc Sassoon
    Genesys - Employees
    ------------------------------

    Attachment(s)

    zip
    Get a Store_v2-0.zip   19 KB 1 version