Goto label for repeat with string attribute

(SANG) #1

Hi All

I like to create repeat process in the flow and I am using go to label and attribute inside it
the problem is with the attribute , its not updated , value is always come from previous chat session

my flow is finish until the return value from http is finish or done , its look like this

  1. bot new message ( triger flow) ---->
  2. set attribute (msg_user : new.message.message ) —>
  3. repeat label —>
  4. http request parsing attribute msg value as query ->
  5. ask user with text ( text is from http result_speech_value ) filter if http result_fulliment not equal as "finish or done "
  6. set attribute ( msg :ask_user_answered value )
  7. goto repeat label if if http result_fulliment not equal as “finish or done”
  8. finish

its keep repeating until http request said finish

however the attribute driving me crazy , its not update every time I set attribute ,
the value is always from previous chat session , it make my bot is parsing same string all the time to http API request

I am using bot new message response path to set the attribute value

is there is I am missing here ??

(John Jackson) #2

Are you using the attribute given in the trigger? That won’t work because the outputs from the trigger or previous actions will always be the same.

There are 2 options in this situation:

  • Use a ‘Get an Attribute’ action to get the new value of the attribute to see what the latest value is.
  • Use the metadata field on the goto action to send new data into the top of the loop.

In your case, you could easily just test if the result is finish/done and if not, goto label, and send data for the next loop in metadata - would that work?

I kind of understand what you’re doing here but probably missing some details. Hopefully you can take it from here.

(SANG) #3

Hi john

I have test using “Get an Attribute” but the result are the same
maybe because I using the attribute from the trigger , how do I pickup attribute not from the bot trigger
because when I like to pickup attribute value (step 4 ), I only see response path from bot trigger
I try replace with pencil , however I confuse how to pickup the value on the next step

if there is example will be great , I like to pickup the new attribute value from “step 2” from my process as I describe above

On the loop I think I will using metadata

thanks jhon

(John Jackson) #4

Between steps 3 and 4, can you try inserting a ‘Get an Attribute’ action, and then use the output from this action instead of the attribute value from the trigger when you send the HTTP request?

The output from a ‘Get an Attribute’ will be up-to-date each time it runs.

(SANG) #5

Hi jhon

Its work using get attribute not using flow default response path
however now I need to get multiple attribute value at ones,
as far as I test get attribute only can get one attribute at a time

however its ok , I can use code to declare variable , and parsing its as one for http request

many thanks jhon
Sang