How to execute Utter_message in sequence in while loop?

i am printing text using dispatcher.utter_message() using while loop from action class. its printing all messages but missing its sequence. how to execute utterances in order?

why do you want to make that??

i am getting data from WEB API, so first i have to print all web api data using while loop, later want to print static message,… ex: j = 0; while j< datacount: dispatch.utter_message(data[‘name’][j]) j–; after while loop, dispatcher_message(‘Thank you…’)

but here sometimes ‘thank you’ printing in middle of while loop data. i want to print ‘thank you’, after all loop data completed.

I think that will be better if you run that loop in a function

def getMessageOfApi(self, data):

 ***here put you loop and all the logic***

 return "FullMessage" + "\nThank you"

in the utter_message just like this:

dispatch.utter_message(getMessageOfApi(data))

1 Like

Good Idea.

one more doubt: how can i remove/hide intent name after button click? i want to print only utter_msg directly on button click . is it possible?

I answer that quesntion here: http://forum.rasa.com/t/using-buttons-in-rasa-improving-the-user-experience/35389

its working , when there is less records in while loop, when there is >20 records its not printing

strallMessages = 20 messages

utter_message(strallMessages + “\nThank you”) is not printing.