bootbot icon indicating copy to clipboard operation
bootbot copied to clipboard

Handle close of webview

Open cmdgazal opened this issue 7 years ago • 6 comments

I want to be able to handle the close of a webview.. How do i do that

cmdgazal avatar Jan 05 '18 12:01 cmdgazal

Does this help? https://github.com/Charca/bootbot/issues/47#issuecomment-346943146

mraaroncruz avatar Jan 05 '18 12:01 mraaroncruz

#47 is actually closer to my question(s), but since it is closed and it's referenced here, I guess its rather a good place to start instead of new issue. Let me specify first what I want/need to do:

During a conversational question/step that includes a web_url button that triggers a webview, I want to be able to collect/access values gathered on such webview on either the answer or callbacks of the original question/step.

As far as I've investigated, this is not possible through the provided MessengerExtensions API. Not cool at all, especially because of misleading third comment on the Recommended Design Flow subsection of the docs which implies this is possible when it reads: You may want to send content to the thread during or after the webview interaction..

Anyways, I reached the same conclusions as recommended on the above comment: Have my webview post something back into my service, which in turn sends a message to that specific user(Id) with the desired information.

Now my question is: Knowing that this message/interaction is originating from the bot, will the conversation's answer of any of it callbacks be triggered? Will I have access to the Text?

And lastly, this is a bit of topic. Is it possible to send any form of meta/scalar data the bot service could use? Or Am I bound to do something like: You've choose this _value_ and then have my bot sort of figure out how to extract this value?

jhenriquez avatar Feb 01 '18 05:02 jhenriquez

I am also trying to find out how to bring the values from the webview form into the ongoing conversation.

vijayrajasekaran avatar Feb 07 '18 10:02 vijayrajasekaran

Have you tried something like what I describe above? @vijayrajasekaran

I just have not had the time to try it out. But I'm almost certain that could work I've seen at least one bot do it this way.

jhenriquez avatar Feb 07 '18 16:02 jhenriquez

I am able to postback the values to the server from the webview but unable to add it to the ongoing conversation thread.

vijayrajasekaran avatar Feb 07 '18 16:02 vijayrajasekaran

🤔 not even by using the send API directly. My theory is that if somehow I managed to pass on the (securely) the conversation id to the web view, then from the web view back on to the server I could either use the Bot.sendTextMessage or the even try to post directly to the API.

I need to make some time to try these things myself, but I guess it would be even better if someone beats me to it 😌

jhenriquez avatar Feb 09 '18 03:02 jhenriquez