Search code examples
phpfacebookbotsfacebook-messenger

Facebook Messenger Bot - disable bot automatically when owner start answering questions


I have created a Facebook messenger bot that is working perfectly. I used php to create it.

Now, I want to add some new functionality. When the bot owner is online in Messenger and starts answering messages, the bot should stop responding to users.

How can i detect when the owner has started answering?


Solution

  • I did a test on this before.

    You can try subscribing to "message_echo" webhook. This webhook is called when the page AND the bot sends a message to a user. So you'll need to differentiate which "message_echo" is from the page (a person) and which is from the bot. In the json that webhook sent, messages from the bot will contain an app_id key in the message object.

    Your server will get a lot of hits by subscribing to this webhook.