Closed PierreMarieRiviere closed 6 years ago
Maybe by broadcasting an event to your botkit controller ? I will try that. I need it too !
Guys, you can do that with Messenger Extensions JS SDK, and Her's the documentation
@ouadie-lahdioui The only problem with Messenger Extensions is that it only works for mobile devices no?
According to some people on internet, messenger Extensions only work on iOS and Android, but i can't found the confirmation on Facebook docs
The docs say extensions work on iOS and Android, but not messenger.com (aka desktop user)
Fallback url is used when user is on desktop, in that case you aren't going to close a webview but redirect the user back to your bot's m.me url. Whatever logic you use for triggering a message at the same time as that would be pretty similar across extensions and desktop.
Right before webview close or desktop redirect, I'd make a POST request to a specific endpoint on your botkit server (sending the userID along so we know who to contact), which would then trigger a custom botkit event that would bot.say at that particular user.
ALSO this assumes that the webview session is terminated by the user through some UI on the page. I don't personally know how to handle sending a request once the user closes a tab/window, I think it would be easier to just trigger that event with a user action, easier to predict and creates a smooth flow.
Ahaah :flushed:
@jonchurch +1 for your proposition
Actually on desktop its probably gonna open a tab, so a redirect wouldnt work likely.
I need to send a message after a user opens (or better, after he closes) a webview in Messenger. How can I do this?
In facebook.js