Sending multiple messages with dispatcher

Hey guys,

I’m building an action that confirms if user is either onboarded or not. And use dispatcher to send the message for each case.

first:"First phrase"
second:"Second phrase"
third:"Third phrase"

dispatcher.utter_message(text=first)
dispatcher.utter_message(text=second)
dispatcher.utter_message(text=third)

return []

It’s working but it’s not pretty.

There’s a better way of doing this?

Hi! :smiley:

I don’t know has another ways without make some front-end changes You can send a JSON with all message and use a front-end to read and write

or use python list

Multiple messages need some careful because rasa is asynchronously

dispatcher.utter_message(text=first)
dispatcher.utter_message(text=second)
dispatcher.utter_message(text=third)

Working because it’s small but if you want to increment (maybe, more than 5), rasa will be return timeout error

You can read more in this thread

1 Like