bot仍未接收到messages

bot仍未接收到messages

本文介绍了即使已将Webhook订阅到这些事件,Facebook bot仍未接收到messages_game_plays webhook事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在测试一个Facebook即时游戏应用程序,希望我的机器人在游戏会话结束时收集messaging_game_plays事件以记录用户数据.

I'm testing a facebook instant games app and want my bot to collect messaging_game_plays events to log user data at the end of a play session.

我已经建立了一个应用程序页面,一个应用程序,并上传了一个已移至测试阶段的构建.我也有一个带有已成功验证的带有公共Webhook的机器人. Webhook当前已订阅messaging_game_playsmessages.我在机器人中内置了简单的回声功能,可以启动手机上的Messenger应用程序,向页面发送消息,并完美接收回声.

I've set up an app page, app, and uploaded a build that I have moved to the testing stage. I also have a bot with a public webhook that I have successfully verified. The webhook is currently subscribed to messaging_game_plays as well as messages. I have simple echo functionality built into the bot and can spin up the messenger app on my phone, message the page, and receive an echo perfectly.

当我进入Messenger应用的游戏部分,玩游戏,然后退出游戏时,就会出现问题.我希望我的机器人在 https中收到一个messaging_game_plays事件://developers.facebook.com/docs/messenger-platform/reference/webhook-events/messaging_game_plays/,但是在bot服务器的日志中我没有收到任何指示,称任何东西都称为webhook(即使等待了大量时间也是如此.

The problem arises when I go to the games section of my messenger app, play the game, and then exit the game. I expect my bot to receive a messaging_game_plays event per https://developers.facebook.com/docs/messenger-platform/reference/webhook-events/messaging_game_plays/, but I don't receive any indication in the logs of the bot server that anything has called the webhook (even after waiting a significant amount of time).

所以我的问题是/问题是:我是否缺少将messaging_game_plays发送到我的机器人所需的内容?有什么我需要添加到我的应用程序构建中的特定事件来触发的吗?在手机上启动游戏并退出游戏足以测试此事件吗?

So my question is/questions are: am I missing something that is required for the messaging_game_plays to be sent to my bot? Is there anything that I need to add to my app-build specifically for this event to trigger? Is launching the game on my phone and exiting the game sufficient for testing this event?

我没有幸运地搜索过论坛和文档,但也许我一路上错过了一些东西.我已经检查了以下问题: Facebook Messenger的Webhook设置,但未触发 ,这帮助我成功触发了我 am 收到的messages事件,但我似乎无法收集messaging_game_plays事件.

I've searched forums and documentation with no luck but maybe I've missed something along the way. I have checked this question: Facebook Messenger webhook setup, but not triggered, and that helped me successfully trigger messages events which I am getting, I just can't seem to collect messaging_game_plays events.

我对此过程比较陌生,因此我可能会遗漏一些小东西,对您的帮助将不胜感激!

I am rather new to this process so I may be missing something small, any help would be greatly appreciated!

供参考:

app Webhook订阅

app webhook subscriptions

推荐答案

您的 fbapp-config.json 文件说什么?如果您的漫游器选择加入参数为'opt_in_dev''opt_in_public',则在发送任何Webhook之前,您需要调用subscribeBotAsync方法以将您的用户订阅到漫游器.

What does your fbapp-config.json file say? If your bot opt-in parameter is 'opt_in_dev' or 'opt_in_public' you will need to call the subscribeBotAsync method to subscribe your user to the bot before any webhooks will be sent.

Messenger机器人仅需要从1月19日开始启用(请参见此处: https://www.facebook.com/fbgaminghome/blog/important-game-bots-update ).

Messenger bots will need to be opt-in only from January 19th (see here: https://www.facebook.com/fbgaminghome/blog/important-game-bots-update).

我们正在进行此更改,以确保更好的播放器体验.

We're making this change to ensure a better player experience.

如果要在不要求选择漫游器的情况下传输播放器数据,则可以将标准JavaScript fetch/XMLHttpRequestgetSignedPlayerInfoAsync结合使用,以避免篡改.

If you want to transfer player data without requiring the bot to be opted-in, you can use standard JavaScript fetch/XMLHttpRequest with getSignedPlayerInfoAsync to avoid tampering.

这篇关于即使已将Webhook订阅到这些事件,Facebook bot仍未接收到messages_game_plays webhook事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-27 14:03