2
votes

SDK

Issue Description

Hi, I searched for this for a long time now but I haven't found an answer. I was wondering if there is a way to bind some URL parameters to the User's Bot Session. For example, if for a specific chat dialog, I set my Endpoint URL to:

http://localhost:3978/api/messages?pronuntiation=british

is there a way to get that url parameter named "pronuntiation" down in the session object like...

bot.dialog("/", function(session){
    var desiredPronuntiation = session.someUrlParameters.pronuntiation;
    if( desiredPronuntiation == "british"){
          ///blah
    }
});

I think it is possible in C# SDK but I was trying to do this in NodeJS...

I already debugged the proces from the server.post('/api/messages', connector.listen()) down to the ChatConnector.verifyBotFramework() where at the end I found it calls _this.dispatch(req.body, res, next); (ChatbotConnector.js on line 149) passing only the post body but not the request object itself...

So at a first glance I think this is not possible, I just wanted to be sure that I didn't miss anything... Thanks, Luis

1
I don't think BotBuilder framework exposes that kind of data. Just ask the user for locale(pronunciation), when he interacts with the bot for the first time, and save the response in session.privateConversationData. For subsequent visit by the user, get the locale info from session.privateConversationData. You can also save in session.userData, etc... docs.microsoft.com/en-us/bot-framework/nodejs/… - Master Chief
This document gives an example of how to prompt the user for locale info => docs.microsoft.com/en-us/bot-framework/nodejs/… - Master Chief
Which channel you are using? - Gary Liu
I'm using WebChat. - Luis Pablo Linietsky

1 Answers

2
votes

As far as I know, this isn't supported by the Bot Framework, however I don't see why you need to do it this way. This is something you want to store in the state, for example the userData. You can read more here about managing state in the Bot Framework.

If you want to pass user data to the bot, it depends on the channel. For example Facebook and Webchat allow you to pass data direct to the bot, without user input.