Reputation: 278
Basically, I want to have my bot on different pages using iframes and Bot Framework Web Chat.
Depending on what page the user opens the bot, a different dialog is called.
Without Direct Line, this is as simple as adding a query parameter to api/messages and adjust the controller. But with Direct Line, I can only specify one endpoint in the portal.
I tried to change user.id in the JavaScript BotChat.App call to a different identifier and then select the correct dialog in my MessagesController based on that. BUT: my custom id doesn't seem to be available as early as the activity "ConversationUpdate" occures where I send my welcome message. I need to send a dialog-specific welcome message though (so I need to navigate there as soon as possible and not only when the user types his first message).
Upvotes: 1
Views: 466
Reputation: 3426
Take a look at the backchannel. In your scenario you can pass a parameter from the Javascript via the back channel to set some value in UserData
. Now your parameter will exist in state (in this case the IDataBag UserData
) when your user first hits the bot.
Here is a C# sample of a 2-way backchannel
another C# sample using a 1 way backchannel
Upvotes: 2