Laravel 的 Webhook - 接收重复消息的命中

Webhook with Laravel - receiving hits of repeated messages

我正在使用 Laravel 5.3 作为 webhook 来分别测试 Facebook 和 Telegram 的 ChatBot API 。问题是,当我向我的机器人(在两个平台上)发送一条消息时,我的服务器收到很多点击,这些点击已经从用户那里收到了消息(检查了唯一的消息 ID,它们确实是重复的)。正因为如此,如果我想回复我从他们 API 收到的每条消息,我会淹没聊天。那是正常的吗?我应该检查用户是否自己发送了消息吗?

Facebook 的 API 在我 select 永久菜单中的项目时正常工作。

他们在 Telegram 文档中提到:

In case of an unsuccessful request, we will give up after a reasonable amount of attempts.

所以也许您不 return 可以接收更新和电报,认为您的服务器有一些内部错误。然后它再次发送更新。

此外,如果重复接收更新,您可以使用 update_id。看看 Telegram docs:

The update‘s unique identifier. Update identifiers start from a certain positive number and increase sequentially. This ID becomes especially handy if you’re using Webhooks, since it allows you to ignore repeated updates or to restore the correct update sequence, should they get out of order.