Pass input back to engine

We are working on a bot for Facebook, which means we can’t make any changes to frontend code and we can’t make two outputs in sequence.

Explanation of flow: we have a “search” flow which shows a carousel if the search got a hit. After the carousel we want the user to be able to make a new search right away without having to trigger the flow again (i.e we still want to stay in the flow), but we also want the user to be able to ask a completely new question (i.e leave the flow) without having to ask their question twice.

What we have done now:

  1. the first user input received after carousel is stored in a variable
  2. output from Teneo asking the user if they want to make a new search or not
    3.1 if yes - make new search with the value in the stored variable
    3.2 (and this is the part we need help with) if no - send new input asking the user to ask the question again.

What we want:
1 - 3.1 same
2.3 if no - break flow and pass variable to Teneo engine to trigger the right flow.

We have tried using postback buttons but we haven’t managed to get the user input be passed as value. Do you have any ideas?

Hi Sofia!
Here is one idea that might work as inspiration for you:

The user has just said something that triggered the “search in the carousel flow” and the answer is given. Next:

  1. in a transition, we add a listener after match that is picking up whatever the user says next and saves it to a global variable userQuestion

  2. After that, we add a script node that sets a global boolean ReplaceText to true

  3. The Bot asks if user wants to make a new search. If input is yes → if I understand correctly, you are already dealing with this scenario.

  4. If the input is “no” → we add a global pre-processing script that only is evaluated if the boolean ReplaceText is true, and is replacing the user input text if the text is ‘no’ (this could of course be more elaborated and flexible with some regex to allow for other inputs than just ‘no’) with whatever is stored in the variable userQuestion. In the flow, we ensure the output node is not set to revisitable. This makes the flow drop if the “yes” transition isn’t matched and the user input text (now replaced from “no” to the previous question) is sent to the solution as a new input to be triggered by one of the triggers in the solution.

  5. As the flow is dropped, the boolean ReplaceText should be set to false again (in the flow script, on drop)

I hope this helps!
Regards Lina