MessengerExtensions:如何通过信使向用户发送消息? [英] MessengerExtensions : how to send a message by messenger to users?

查看:19
本文介绍了MessengerExtensions:如何通过信使向用户发送消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将 webviews 与我的 Messenger 聊天机器人一起使用.

I use webviews with my messenger chatbot.

在我的网络应用程序看来,我使用 MessengerExtensions.requestCloseBrowser() 来关闭 iOS 和 Android 上的 webview.

On my webapp's view, I used MessengerExtensions.requestCloseBrowser() to close the webview on iOS and 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

你能帮我吗?

谢谢.

推荐答案

您可以进行服务器往返.

You can do a server round trip.

关闭 webview 有一个成功回调.您可以对您的网络服务之一进行 api 调用.您将页面范围的用户 ID 传递给此服务.然后一旦知道用户是谁,就可以使用 发送 API

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

另一种方法.如果您要求用户登录 webview,您可以使用 登录按钮.在这种情况下,一旦用户被重定向到 Messenger(即关闭 webview 后),您将收到一个 webhook 事件,并使用它可以将消息发送给用户.

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.

这篇关于MessengerExtensions:如何通过信使向用户发送消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆