Creating a Web Messenger
The Flow XO Web Messenger is a bot interface that can be embedded in any website, landing page or web app. It can be accessed through a website control, directly via it's own URL, or can be embedded within the body of a webpage.
Follow these steps to create a web messenger:
- In Flow XO, click Bots on the left menu bar, then choose + New.
- Now choose Web as the platform.
- Type in a descriptive name for the messenger.
- In the Welcome Text field, you can optionally provide some welcome text. If you leave this blank default welcome text will be used.
- Select the Language and enter a Custom Prompt Message as required. View the guide on International Language support for more information.
- Select if you want to Forget conversation history when the user closes the messenger.
- Select if you want to Disable text input in the messenger. This removes the text composer and limits the user to the choices you've defined.
- Select if you want to Disable attachments. This removes the 'paperclip' upload button on the text composer.
- Select if you want the web messenger to send IP address and location information in the metadata. If your bot is governed by GDPR, only check this box if you are confident you will meet the consent requirements as IP address is considered personal information under the GDPR.
- You can change the Theme Color if you wish, which is the main color that will be used on the messenger window.
- Add an Icon if required.
- For Header Text, provide the text that you want to display on the widget label and as the title of the messenger control. You can leave it blank to use the default text, 'Message Us'.
- For Widget Popup Message, provide the text that you want to show up alongside the widget icon to attract your visitor's attention. (Shows after a short delay of 5 seconds, once every 30 days per visitor).
- For Popup Height, leave blank if you want a full height chat window, or a specific value otherwise. Be careful to use a height that will work well on mobile and desktop. You can use absolute pixels or percentages.
- Click Next to save your bot.
- The final step allows you to test the messenger (you'll see a test widget in the bottom right corner of the screen), and to copy and paste code to display on your website.
- Click Done to finish.
Installing the Web Messenger
The web messenger can be installed on your website, landing page or web app. The final step when creating/editing your web messenger will give you some code to display a control that opens the web messenger.
You should paste this code just before the closing </body> tag on your web page. The web messenger is designed not to slow down your page.
Welcoming a New User
When the user opens the web messenger for the first time, the message 'start' will be sent to it. You can look for the presence of this and welcome the user if you like.
Web Messenger API
Web Specific Features
The Web Messenger makes several useful data points available by default in the Metadata field of any flows that it executes. Which fields get included partially depends on whether or not you have opted to send the users IP address, which will also cause a few additional location related fields to be sent as well.
|firstTimeUser||Whether or not the current user is a new user, i.e. has never interacted with your bot before|
|browserName||The name of the users browser, for example "Chrome"|
|mobile||If the browser is a mobile browser, the metadata field 'mobile' will equal true. Otherwise it will be missing.|
|tablet||If the user is browsing from a tablet, the 'tablet' metadata field will equal true. Otherwise it will be missing.|
|operatingSystem||The OS of the user, for example "OS X"|
|operatingSystemVersion||The specific version of the users operating system, such as "10.16.1"|
|timeZone||The timezone of the users browser, in IANA format. Example: "America/Los_Angeles"|
|country||The country of the user, for example "United States"|
|hostUrl|| The URL of the page that is hosting the Web Messenger widget. For example: "https://mysites.com/thisPageHasABot?pageid=12"
||This is only useful when using embedding the widget into a webpage. It will not work if you are using an iFrame to embed your chatbot.|
|externalUserId||If you have used the Web Messenger SDK to set an external user identifier, this will show up in the metadata. Note that this is in addition to the users primary identifier being set to this value, instead of a random set of characters.|
|ip||The IP address of the user||This will only be populated when 'Collect Users IP Address' is selected in the channel configuration|
|region||The geographical region of the user. Varies by country. In the US, this will be the state, such as 'California'||
This will only be populated when 'Collect Users IP Address' is selected in the channel configuration
|latitude||The rough latitude as determined from the users IP. This will NOT be an accurate location of the user, but can be useful for plotting general user locations on a map with more precision than the country or region.||This will only be populated when 'Collect Users IP Address' is selected in the channel configuration|
|longitude||The rough longitude as determined from the users IP. This will NOT be an accurate location of the user, but can be useful for plotting general user locations on a map with more precision than the country or region.|| This will only be populated when 'Collect Users IP Address' is selected in the channel configuration
NOTE: When using the direct URL (sending users to the hosted chatbot page) or when embedding a chatbot into a page using an iFrame, any query string parameters appended to the embed URL will also be included as metadata elements. For example, if you are directing users to a host bot at a url like this:
then the metadata field will include properties for myParam and anotherParam. If you are embedding your bot as a widget and you want to add additional metadata you can do so using the Web Messenger API.
Does the web messenger maintain state?
The first time a unique visitor opens the messenger, a session is stored in their browser (they'll also see the bot's welcome message too, if configured). When they return to your site, they'll see all their message history. Select Forget conversation history when the user closes the messenger if you want to load the web messenger with an empty conversation at the start of the next session. This may be useful if your users share PCs, for exchanging confidential information or on compliance grounds.
A Reset conversation option is also given to the user in the top right corner of the web messenger. This will clear all conversation content from the web messenger and will end the current conversation and restart it.
If you select the option to Disable text input in the messenger, then the the web messenger is loaded with an empty conversation at the start of each new session.
No option above deletes any data from the database. If the browser's storage is reset, the history will be lost.
What is the user's name and handle set to?
The web messenger is anonymous, and so the user name and user handle properties will be empty when you interact with a web visitor. You can always ask the user for their name.
Can the visitor send a file/location/image?
Yes, the visitor can send files and images. It's not possible to send a location just yet, sorry.
Can I broadcast to the web messenger?
Yes, the web messenger works like any other platform. If you broadcast to a web messenger user, the next time the user visits your site and opens the messenger, they'll see the message(s).
Is it possible to control how/when the messenger is displayed?
Yes, you can use the Web Messenger API to control the messenger from any page that it's installed on.
Can I send metadata?
Yes, either by using the Web Messenger API or by adding parameters to the query string when you use the web messenger's direct URL (for example,
Metadata will be available inside the metadata output when you receive a new message through the bot.
Let us know how we can improve Flow XO on our feedback site.
Can I execute different flows based on the current page on my site that the user is chatting on?
Yes. If you are embedding your chatbot as a widget, you can combine a trigger filter with the hostUrl property in the metadata to select which flow(s) you want to execute based on the current page your user is on. If you are embedding the chatbot using an iFrame, then you would need to manually append the current URL to the bots URL when embedding the iFrame in your page. This would be an advanced procedure.
The Widget Popup Message is only shown once and I never see it again. Is this correct?
The default is to show the widget popup message one time per unique visitor per 30 days. However, you can customize this when you embed the widget on your page using the following data attribute. You can also customize when the popup is shown, and for how long:
<script src="http://fxo-embed.ngrok.io/embed.js?callback=messengerReady" data-fxo-widget="...my widget code..." data-hide-welcome-message-days="0" data-reveal-welcome-message-seconds="1" data-hide-welcome-message-seconds="5" async defer> </script>