-->

MessengerExtensions : how to send a message by mes

2019-09-15 11:37发布

问题:

I use webviews with my messenger chatbot.

On my webapp's view, I used MessengerExtensions.requestCloseBrowser() to close the webview on iOS and Android.

It works perfectly but, i have no idea how i could give feedback to my user by send a message when the webview is closed

Could you help me please ?

Thx.

回答1:

You can do a server round trip.

closing webview has a success callback. You can make an api call to one of your webservice. You pass the page scoped user id to this service. Then once you know who the user is, you can send the message to the user using the Send API

Another approach. In case you are asking the user to login in webview, you can use the login button. In this case once the user is redirected to the messenger (i.e. after webview is closed) you will get a webhook event and using that you can send the message to the user.