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

4

14

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.

Mitzvah answered 24/6, 2016 at 6:52 Comment(3)
Whey not just answering by bot ONLY when you received certain terms, and the other questions can still answered by a human through Messenger?Measures
Yeah, I thought about that too - meaning that when the message didn't exist the db for response, than do nothing. Just didn't know if someone had been able to create a plug :)Mitzvah
What if you send a special command to disable it? What is your Solution?Harker
M
7

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.

Monomorphic answered 15/11, 2017 at 20:6 Comment(0)
P
3

Once you recognize someone wants to speak to a human, set a flag that disables all actions of your bot to on.

Then, have your bot message you, or whoever will respond, that a user ID needs responding to. Have your bot continue to send all messages received from them back to you until you enable the bot again.

Create some sort of way for your bot to interact with you that allows you to send a message to a specific user, and a way to once again enable the bot interaction with the user.

Probably something like "sendMessage104012301230'Hi, sorry you couldn't find [etc]', and enableUser104012301230

There may be a better way, but those are some thoughts on how I'd do it

Pinole answered 28/6, 2016 at 14:35 Comment(0)
R
3

If you enable messages echo, whenever a human respond using the page, a echo post is sent, and inside entry->messaging->message there's no app_id.

You can use that information to disable bot replies for a certain period, or disable indefinitely until you enabled is with some admin command (that's how I'm doing)

Robinette answered 21/4, 2017 at 15:49 Comment(1)
This worked for me, only thing is that there is an app_id it is just not the same as the bot's app_idWenger
A
1

I thought a solution could be to label the message as "unsolved". Another solution could be to have the bot mark the conversation as unread. Does anyone know if it is possibile to add a label to a conversation or mark as unread through API?

Algebra answered 30/6, 2016 at 9:52 Comment(1)
I am trying to do something similar - would be better if we could pass variables post and tag within the system.Mitzvah

© 2022 - 2024 — McMap. All rights reserved.