Closed sojharo closed 3 years ago
I have looked into Web view and how we can build html pages which load in webview and provide additional functionality to our bot.
Ways to launch WebView from Messenger:
Integrate data flow between Messenger and Web view app
Messenger provides Messenger Extensions SDK that can act as bridge between Messenger and our HTML app loaded inside Web View. With help of this SDK, we can send information from HTML app on web view to our server directly.
We can receive subscriber sender id and page id from context in our HTML app in web view. Based on this information, we can call our server using http requests and send user actions on our app to our server such as which date user picked (in case our HTML app is date picker).
Our Usage
Up till now, we have only used Web View for displaying simple HTML pages (and not interactive apps). We had done it in Social Security chatbot that we had built. Web view has power to build interactive applications in it which can get information based on user interactions. Messenger Extensions SDK will then send information back to Messenger and our server.
Actions on Web View using Messenger Extensions SDK
We can perform following actions, in our HTML app on Web view using Messenger Extensions SDK:
KiboPush Approach towards this feature
The purpose of Web view is to give rich user experience to subscriber which may not be possible in normal chat messages such as letting them pick date or manage todo list.
These web views can be considered mini html applications which load inside Messenger Web View. These can get information of subscriber and page from Messenger Extensions SDK and then depending on this can provide experience to subscriber.
There are two approaches we can take to add this feature into KiboPush.
References
https://developers.facebook.com/docs/messenger-platform/webview
https://developers.facebook.com/docs/messenger-platform/webview/extensions
As per our discussion, I have further worked on it and have created a feature design document. This is under construction. I have thought of high-level infrastructure and design. Now, it needs low-level technical descriptions.
why there is no update?
Do you understand the process?
Yes, I had worked further on the document and forgot to put the comment here. The document is under construction and about to get completed.
I have worked further on this yesterday and adjusted the document according to our discussion. I have now started working on calendar picker Messenger Component as an experiment to interact with Messenger. This is under construction.
I worked on this and have been able to use Mesenger Extensions SDk to get context and sender Id of subscriber however, the page id is not being sent to me. They have given a hash code that we need to break using our app id to get the page id. I am working on that part to break and get the page id. Next, I will send the selected date to our server so we know what date was selected.
I have completed the work on sample date picker web view. We are able to get the date using date picker and also recognize the subscriber and page id. After this, with help of our server, we are able to acknowledge the subscriber that what date you picked.
I think we should see the demo and open the tasks for this milestone.
This is complete now. I have modified the document according to discussion and opened the milestone yesterday. We can close this task.
This was discussed with Hamza in a call today. He wants to have a calendar appear on Messenger so that subscriber can pick up the date. Calendar is not native functionality of Messenger. However, the link that he provided as an example shows that we can do it with help of web view.
https://www.chatbot.com/help/moments/how-to-start-with-moments/
In this task, I will investigate the webview (specially from calendar use-case point of view) and understand the possibilities and way of implementation.
On high level, my understanding is as follows:
This can be done with help of webview where we can show a calendar application which will interface with Messenger and send the data (date picked in this case) to Messenger. We will get that data using webhooks on our servers.