Get `sender` value in response of `rest` API call

I am calling rasa’s rest ap /webhooks/rest/webhook from python flask app.

 "sender": "Rasa",
  "message": "Hi there!"

And i need the sender_id value in the response. like

 {"text": "Hey Rasa!"}, {"image": ""},{"sender_id":"Rasa"}

How can i get this?

Hey Kabeer,

I am not sure this what you are looking for.

In python

a = [ {“text”: “Hey Rasa!”}, {“image”: “”}, {“sender_id”:“Rasa”} ]


@MuraliChandran14 , Thanks for your answer, Unfortunately, this not what i looking for. I think your solution saying, how to retrieve the ‘sender_id’from the list of dictionaries. Actually i am not getting the sender_id` in the response from rasa.

This is the response i am getting from rasa:

[ {"text": "Hey Rasa!"}, {"image": ""}]

And this is what i need to get from rasa:

   [ {“text”: “Hey Rasa!”}, {“image”: “”}, {“sender_id”:“Rasa”} ]

I hope you got my question.

Thanks for clarifying

(tracker.current_state())[“sender_id”] or tracker.sender_id

Will help you get the sender_id in your

However, In Rasa HTTP server, sender_id is a URL route parameter, rather than a POST body parameter.

your HTTP request should look like this if you want sender_id to be Rasa :


Please refer here

Hope this helps!

@MuraliChandran14 ,
The first solution (tracker.current_state())[“sender_id”] or tracker.sender_id can use from But this is not what i am looking for. I am calling rest api call from flask app, and i need the sender_id in that file, not in actions.

And your second solution, i tried this localhost:5005/conversations/Rasa/respond, but getting below error, Error: Requested URL /conversations/rasa/respond not found

using recent current rasa version (1.9.7), you get the sender_id you need, that’s (weirdly :wink: ) called recipient_id. See curl example here:

$ curl -s localhost:5005/webhooks/rest/webhook \
          -d '{ "sender": "Giorgio", "message": "I am a bit sad"}' | json
        "recipient_id": "Giorgio",
        "text": "Here is something to cheer you up:"
        "image": "",
        "recipient_id": "Giorgio"
        "recipient_id": "Giorgio",
        "text": "Are you feeling better?"

@kabeer First, I have to apologize for misunderstanding your question. You have to get sender_id whenever you get response from the API you are calling.

I hope this it the output you are expecting. For that I assume there is no API you need to call to get sender_ID.

The ideal step is to be customizing your in your rasa folder.

you can do that by adding

collector.messages.append({"sender_id": sender_id})

at your in class RestInput(InputChannel):

This will resolve your issue I hope


1 Like

@solyarisoftware , Thanks for your answer. i updated my rasa version now it worked…

1 Like

@MuraliChandran14 , Thanks for your answer .