Facebook Messenger Bot - How to disable bot and allow human to chat

Michael Self-Made picture Michael Self-Made · Jun 24, 2016 · Viewed 13.8k times · Source

so this is something I've been trying to think through for about 16 hours. I am coding with PHP / CuRl / etc - the bot works and everything is fine. My current issue is figuring out how to disable the bot and allow a human to begin chatting with the customer/sender.

Has anyone successfully, created a route for this ? I mean it's pretty hard from what I see, you'd have to disable etc etc. A lot of effort for my clients.

Thanks for any input.

Answer

laloumen picture laloumen · Nov 15, 2017

Facebook has rolled out a "Handover Protocol" which is supposed to facilitate a combined human/bot Messenger implementation.

https://developers.facebook.com/docs/messenger-platform/handover-protocol

It is a little unclear what actually occurs in step 5:

Pass thread control: At some point in the conversation, a user may choose to do something like interact with a live agent. To handle this, pass thread control from the Primary Receiver to the Secondary Receiver. The Secondary Receiver will receive a messaging_handovers webhook event to notify it that is now controls the conversation.

This doesn't actually disable the bot (as the OP requested), and isn't in the control of the Page owner but rather of the user. It seems FB envisions the user typing something like 'I would like to chat with a human' triggering the bot to pass control...but it would be nice to let the page owner simply put the app in standby and handle the messages herself.