简体   繁体   English

MessengerExtensions:如何通过Messenger发送消息给用户?

[英]MessengerExtensions : how to send a message by messenger to users?

I use webviews with my messenger chatbot. 我将Messenger与Messenger聊天程序一起使用。

On my webapp's view, I used MessengerExtensions.requestCloseBrowser() to close the webview on iOS and Android. 在我的Web应用程序视图上,我使用MessengerExtensions.requestCloseBrowser()关闭iOS和Android上的Webview。

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. 谢谢。

You can do a server round trip. 您可以进行服务器往返。

closing webview has a success callback. 关闭webview具有成功的回调。 You can make an api call to one of your webservice. 您可以对您的一个Web服务进行api调用。 You pass the page scoped user id to this service. 您将页面范围的用户ID传递给此服务。 Then once you know who the user is, you can send the message to the user using the Send API 然后,一旦知道用户是谁,就可以使用Send API将消息发送给用户

Another approach. 另一种方法。 In case you are asking the user to login in webview, you can use the login button . 如果您要用户登录Webview,可以使用登录按钮 In this case once the user is redirected to the messenger (ie after webview is closed) you will get a webhook event and using that you can send the message to the user. 在这种情况下,一旦用户被重定向到Messenger(即,在关闭webview之后),您将获得一个webhook事件,并使用它可以将消息发送给用户。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM