Web View
Web Webview
Webview allows you to create complex UI using custom html code. Since webview communicates with chatbot to exchange data, just any URL would not work until relevant code has been added to establish communication.
To create a webview the most important parameter is template URL. It can be URL of any webpage. There must be few scripts defined in the webpage for the following
Send a ready event to parent when webview is ready, so that bot can remove loader and show the webview.
Listen to postMessage for msgId(and optional data) and save it.
When interaction with webview is over, postMessage to parent along with msgId and option data.
Below is the sample script to demonstrate the same.
Please paste the script given below to your html so that loader is removed and webview is shown.
You need to call closeFrame
function to close the webview.
You can also check out sample webview URL and use it in the webview to see how it work. http://webview.intelliticks.com/common/datepicker.html
Check the source of above URL to understand it more.
Facebook Webview
The Messenger Platform allows you to open a standard webview, where you can load webpages inside Messenger. This lets you offer experiences and features that might be difficult to offer with message bubbles, such as picking products to buy, seats to book, or dates to reserve.
Setting Webview Template URL (Required Domain Whitelisting)
To display a webpage in the Messenger webview you must whitelist the domain, including sub-domain, in the whitelisted_domains property of your page Messenger Profile. This ensures that only trusted domains have access to user and node information available via SDK functions.
For more information on whitelisting domains, see the whitelisted_domains reference
If you facing any issue on whitelisting domains please contact at support@intelliticks.com
Setting Webview Height
You can specify the height of the webview when it opens in messenger by setting the Webview Display Mode property when configuring webview node. The following sizes are supported:
COMPACT
TALL
FULL
Adding the IntelliTicks Messenger Extensions SDK
1. Include the Messenger Extensions JS SDK
Add the Messenger Extensions Javascript SDK to the page being loaded in the webview with the code below. You should insert it directly after the opening body tag on each page you want to load it:
2. Wait for the SDK load event
iticksInit
will be called when the IntelliTicks Messenger Extensions JS SDK is done loading. You can use this as a trigger to call other functions available in the SDK.
IticksMessengerExtensions
and its methods are available in the Messenger webview when you include the IntelliTicks Messenger Extensions JS SDK.
Function
Description
getWebviewData()
Retrieve node Req Body for the person that opened the webview.
sendWebviewData()
Send data back for the person that engage with webview.
requestCloseBrowser()
Close the webview and return to the Messenger conversation.
Get Webview Req Body Data
The getWebviewData()
method retrieves Req Body information of the node. It is useful for creating interactive group experiences, as well as restricting any content that was intended to be shared only to a certain thread.
Send Webview Data
The getWebviewData(text, jsonData)
method send back data to conversation and help to proceed flow further.
Closing the Webview
It is a good idea to close the webview after a transaction is complete, especially if actions the user took will result in a message in the thread. This can be done with the IntelliTicks Messenger Extensions SDK just call
Setting Webview Title
As with any webpage, the <title> tag sets the text displayed in the title bar for the webview.
Last updated