Reputation: 149
Can we somehow get the curret state of website where the bot is embedded as IFrame?
As in for example, the bot validates whether the user is logged in or not, or his login credentials. Hence, I should be able to pass user's account id along with some other info as well into the bot's code. Then, accordingly, the bot displays the options differently.
I've seen such bots implemented on Industry Websites using bot framework itself. So, any idea how to work this around?
Upvotes: 2
Views: 226
Reputation: 1153
I should be able to pass user's account id
You can pass the user's id and name using the embedded code.
<iframe src='https://webchat.botframework.com/embed/bothandle?s=YOUR_SECRET_HERE&username=YOUR_USER_NAME&userid=YOUR_USER_ID'></iframe>
To pass details other than the user id and user name you need to use the backchannel method in the web-chat repo. Here is a sample doing the same.
Upvotes: 2
Reputation: 14619
Hence, I should be able to pass user's account id along with some other info as well into the bot's code. Then, accordingly, the bot displays the options differently.
Use webchat's backchannel functionality. You will have to switch from the basic iFrame to a few more lines of code, but it's working well.
See my other reply around this functionality here: How do I get the locale in conversationUpdate activity?
Upvotes: 3
Reputation: 39082
While it is possible to access the parent page from IFrame
using JavaScript's window.parent
, I doubt that it is the ideal approach. A better solution would be to expose an web API that would provide the required data, which would the bot's code call to access required information.
Upvotes: 2