Passing user session id in rasa webhook calls

If you are using the Rasa API, the “sender” is used to distinguish between conversations… for example, we have an API that processes a queue of messages to send to RASA. We use something like this to forward to Rasa (I’ve removed exception handling code to make it easier to understand):

CHATBOT = "http://localhost:5005/webhooks/rest/webhook"

payload = '{"sender": "' + user + '", "message": "' + message + '"}'
r = requests.post(CHATBOT, data=payload).encode('utf-8')

response = json.loads(r.content)

If you look in the rasa.conversations collection (mongoDB), there are separate entries for each sender.