Alexa connector with Rasa

@rctatman Hi, I was following your very good tutorial for Alexa connector here. There is something that does not work. When my Rasa stories have more than 1 action to return (2 or 3 in a row), Alexa just says the first one. What do I need to change to make Alexa speak all Rasa actions (not just the first one). Thanks

From looking through the Alexa docs, it seems that multiple consecutive turns (what we’d call responses in Rasa) by the chatbot aren’t allowed.

You’ll probably have to combine your multiple responses into a single one before you send it to Alexa.


@rctatman I see, thanks for your help. I was looking at your code this line:

responses = [m[“text”] for m in out.messages]

And it looks like you loop through the text from Rasa response. Is that not supposed to get all text from consecutive actions too? For example: action1, text: "Hello there", actions 2, text: "How are you?"

Do you have any suggestion on combining the multiple Rasa responses? Is this done in Rasa actions or Alexa connector (I guess the last one ?)


responses = [m[“text”] for m in out.messages]

This line of code in the Alexa connector does combine all the chatbot’s responses into a single response message to be sent to Alexa

@Vin I tried to concatenate using this but does not work. Do you have a solution for this?

responses = [m["text"] for m in out.messages]
message = ""
for i in responses:
   message += str(i) + " "

@userRasa03 I have used the same and it works for me.

When you say it didn’t work, are you getting one response and not the rest or no response at all from Alexa ? Also did you check whether multiple responses are being given correctly by the chatbot on rasa shell ?