Passing a variable from URL

Hi,

I would like to pass a variable with the chat URL to my bot. For example let my bot URL: xxx.xxx.xxx:3000/s/bot1

I would like to send the link as xxx.xxx.xxx:3000/s/atb?var=“some string”

so that when user clicks the link, it will load the bot with a greetings message depending on the value of the variable in the link.

Is there a way to do that?

Many thanks in advance.

Utku

Hi @utkufk,

Short answer, no. Long answer is you could find your way around when you include the embed the webchat on your page. This way, you could capture the url params on the webpage and send the data to the webchat in a postback event. Then you would need to create a before incoming hook to capture this event and from there, use the botpress sdk to send the user a greeting message with that data.

I know this doesn’t sounds trivial but it’s doable. If you find this solution worth exploring and there is something you don’t understand, let me know I can clarify.

Hi Francois,

I understand your solution but I am not embedding it to my website, I use fullscreen mod instead. So I won’t have chance to use it with proactive messages. I thought maybe I could add some code to the section where shortlinks are converted to long links like XXX.XXX.XXX:3000/lite/bot1/?m=channel-web&v=Fullscreen&options= … etc

Thanks.

Utku