Hi,
I need to pass some user specific data to my Web Bot, is this possible?
Thanks,
Janmajay
Hi,
I need to pass some user specific data to my Web Bot, is this possible?
Thanks,
Janmajay
You can do this using the Web Messenger API. Try the sendMessage
call which can include metadata that you’ll receive in your flow.
USE CASE:
Customers come to my web application, instruct the web bot to create a service order in a different application.
Hi Friends,
I have included a FlowXO web bot in my web application. I have a requirement where I need to create a service order. The Bot should hit the REST API of a different Service Application in order to do so. The problem is, REST API for the service application requires Primary Contact to be passed as one of request parameters.
How can I pass the logged in user details of my web application to FlowXO web bot so that it can be used in web hook while sending an HTTP request.
Please help, let me know if you have further queries
Thanks,
Janmajay
Hi John,
i tried to use sendMessage but i see messagge but i don’t have any metadata.
Is it possible to see a live demo, a html page with a widget and call to API ?
Hi John,
I tried using the Web Messenger API but seems there is a basic issue. I have included my js file after the script tag for Web Bot(Web Messenger) but I get an error in console stating that FxoMessenger object is not valid.
Below is the code in my js file.
FxoMessenger.on(‘stateChanged’, function (state) {
if (state == ‘connected’) {
alert(“Chat Bot is connected”);
}
});
FxoMessenger.on(‘messageReceived’, function (message) {
console.log(message);
});
As you can see I’m just trying to do an alert if the bot is connected. A video or a detailed tutorial on web messenger api will be very helpful.
Thanks a lot
Hi CaosMkt,
I tried using the Web Messenger API but seems there is a basic issue. I have included my js file after the script tag for Web Bot(Web Messenger) but I get an error in console stating that FxoMessenger object is not valid.
Below is the code in my js file.
FxoMessenger.on(‘stateChanged’, function (state) {
if (state == ‘connected’) {
alert(“Chat Bot is connected”);
}
});
FxoMessenger.on(‘messageReceived’, function (message) {
console.log(message);
});
In your case was the FxoMessenger object verified?
Hi Janmajay,
sometimes i have the same problem after script tag FxoMessenger does not exist, see here
and with some api i have problem, it’s for these reason that i asked for live demo of API with some simple html pages with widget and api calls
CaosMkt,
I can get past the error, it seems the browser takes some time to load the embed.js from floxo due to which FxoMessenger object is unidentified, I saved a copy of embed.js and included it on same host on which my site is. The error i no more
Hi Janmajay,
i also think the problem is loading time.
Your solution is a way but i think it should be better if widget code is rewrite using js injection of tag script
Hi John,
I used below code to pass information to web bot, but I couldn’t find the data send from web app under metadata(checked in Interactions tab for Trigger Action) due to which I’m not able to include the required fields (username and primaryContactId) in my flow.
FxoMessenger.sendMessage(‘Hi’, {
username: ‘Jay’,
primaryContactId: 2,
name: ‘Janmajay Adhikari’
});
Hi Karen,
I could figure out the problem it seems my js FlowXO.js file (which has a code mentioned below) is loading before embed.js and the object FxoMessenger is not getting identified, due to which below code is not firing, however if I manually trigger the below script in console I could see a message ‘Hi this is Jay’ as a user and metadata is also getting send as I can use it in my next Flow action (Send Welcome Message).
Anything you would like to suggest to get pass this? Also it seems i cannot use the sendMessage method only to send meta data, I have to send a message as a user which defeats the purpose because the user would like to type a initial message.
FxoMessenger.on(‘stateChanged’, function (state) {
if (state === ‘connected’) {
alert(“Chat Bot is connected”);
}
});
FxoMessenger.sendMessage(‘Hi this is Jay’,{
username: ‘Jay’,
primaryContactID: 2,
name: ‘Janmajay Adhikari’
});
FxoMessenger.on(‘messageReceived’, function (message) {
console.log(message);
});
I have some apologising to do, the docs for the WM API I think are good, except for the fact we missed out some crucial setup steps!
We’ve now updated the docs and included some full and complete examples to get you started (in the Setup section).
Can you let me know how you get on?