Set slot in rasa when user initiates the conversation

Hi all,

I am doing an experiment with a RASA chatbot and direct my participants from my survey page to a website where my RASA Bot is hosted on. The URL link for directing the participants contains a user ID and I wanted to ask whether I can take the ID from the URL and fill a slot in RASA silently so that I can link the survey responses of that participants to their conversation with the bot. So basically I want to take the ID from the URL and set a slot when the user starts talking to the bot with that ID.

I really hope someone can help me with that!

You’ll need to get the userid from the URL in your chat widget code. For example, if you’re using the botfront rasa-widget, you would modify the source to grab your URL and submit the userid via the customData parameter.

You can then get this value in action_session_start and save it in a slot.

Thank you @stephens, getting the value is not that problem. But I do not know how to trigger that the bot starts the conversation and silently set the slot. I use the chatwidget of

JiteshGaikwad(GitHub - JiteshGaikwad/Chatbot-Widget)

Do you know how to accomplish that when the user opens the chat window?

I haven’t used that chat widget and I don’t see that it supports a customData or metadata option.

Via the rest or socket channel, you can send metadata (like your userid) either via the metadata key. You’ll see an example in this PR.

You can also send a message like: /greet{"userid":"xyzzy"}.

When Rasa receives the message at the start of a conversation, you can then capture the userid value and store it in your userid slot in action_session_start. It’s described here and further down on that page you’ll see an example of extracting the metadata in the session_started_metadata call.

Thanks for your reply but this is not what I meant as Jitesh has a function to trigger an initial action but I just wanted to adapt it somehow that it can send an initial intent.