Looping with HTTP request responses

(Splnty) #1

Hi all,

I am trying to create a workaround for the following workflows. Any ideas would be greatly appreciated.

First time user ->

Bot triggered by {{catchall}} ->

The {{catchall.message}} is sent in the body of an HTTP POST that returns a {{response_text}} ->

Bot asks {{question}} with {{response_text}}

LOOP Begins

The {{question.parsed_answer}} is sent in the body of an HTTP POST that returns a new {{new-response_text}} ->

Bot asks {{new-question}} with {{new-response_text}}

LOOP Ends

LOOP Breaks if {{new-response}} === ‘Bye!’

Returning bot user ->

Bot triggered buy catchall
Ask if they want to continue -> YES

The {{catchall.message}} and a couple of {{user_attributes}} are sent in the body of an HTTP POST that returns a {{response_text}} ->

Bot asks {{question}} with {{response_text}}

LOOP Begins again with the same break conditions as above.

Meanwhile, I will tackle this one myself :slight_smile:

I was thinking of using one flow as a catch all that checked if you had user_attribute_been_here set to true, and if so, starting up a recap conversation, before getting into asking the remaining questions. But was struggling to figure out how to pass the {{catchall.message}} to the other flows. :open_mouth:

Thanks!

(Daniel Beckett) #2

@splnty

It looks like you already have most things figured out :slight_smile:

You can loop through your flow by using Flow labels and Goto label actions. Just so you’re aware there is a maximum of 20 loops per interaction (any attempts to exceed this number causes an error and the flow will quit). For this reason you may want to implement a counter using attributes where the counter increments by one each time the loop is ran - you can then add an extra filter to the Goto label that checks the counter value and only runs if it is less than 20.

Attributes are stored against a user’s response path so if you set the attribute during your user’s first encounter to something like BeenHere = True then you can use an action for Attribute > GET Attribute in your other flows to retrieve that attribute which will let you know whether the user is talking to your bot for the first time or not.

Hopefully that helps. If you run into any problems feel free to email support@flowxo.com and we’ll be able to assist further from there. :smile:

Thanks,
Dan

1 Like
(Ian Lawrence) #3

Hi
If you are using the web messenger then you can also use the true/false flag from firstTimeuser which is set in the Metadata

1 Like
(Splnty) #4

Thanks Dan, just a question with passing a response of a bot question back to the start of the loop. What is the best method of doing this? Using attributes, or loop metadata?

I was finding that sometimes setting an attribute at the end of the loop and then getting it at the start, it wasn’t getting correctly.

Good to know about the 20 loop counter! That might answer why sometimes the flow was being abandoned.

(Splnty) #5

Cheers Ian. I am using fb messenger as well though :slight_smile: