About protocol transfer on Messenger - messenger

I've a basic question about protocol transfer on Messenger.
How can a community manager takeover a conversation?
I don't want people to click on button to go to the second receiver. I want the community manager blocks the automated answers from the chatbot and go on a live one to one chat via Inbox Messages.

Currently, there is no way for a user to take control from the Page Inbox. The only way for the bot to be turned off in a scenario like this is for the bot to use handover protocol to pass thread control to the Page Inbox.
https://developers.facebook.com/docs/messenger-platform/handover-protocol

Related

How do I implement a "hand back" from Facebook Inbox once I "hand off" from my chatbot

Building a chatbot and trying to implement the handover protocol. SO far I have it handing off to the inbox, so that if someone asks for customer service, the bot hands over to the inbox and presumably someone who is monitoring the page can answer. Once the inbox is the primary receiver, I can't find a good way to hand it back to the bot ... I know that I can set a timer and have the bot request
for the conversation to be handed back, but this does not seem like the best approach
mark the chat as 'Done' in the Page inbox and thread control will be returned to the primary receiver app.
I was interested in this functionality, but I was also wondering is there any way of monitoring whether a question has been answered after handing over to the inbox? So my chatbot can check and then take back control if it hasnt.

How to detect standby event from Messenger?

Using Messenger Handover protocol I can pass the control to inbox when user requests to talk to a human. I want the bot to listen on standby in order to take the control back when user requests it. The problem seems that the bot doesn't listen on standby.
My Facebook page is subscribed to Standby event and Webhooks integration is enabled in my Messenger app. In DialogFlow the Facebook Messenger integration is set. In the fulfillment code I don't receive requests after handing the conversation thread control over to inbox.
Please help!
I have an idea for this, but actually I'm not sure if it wil work, I'll just post it to see if anyone maybe has tried it.
I think you should create an own webhook, this is going to be subscribed in the Facebook App Messenger Webhook in Facebook Developers Portal.
You will have to set your this webhook to receive all the corresponding events from Facebook, like 'messaging', 'standby, 'messaging_handovers', etc (currently 'messaging' event is used to send the messages from users, and 'messaging_handovers' and 'standby' are used to switch control from bot (DialogFlow in your case) to another app (could be inbox page).
Then, you will have to set up your webhook, depending on the callback received, like this:
- If request_thread_control callback is send: the webhook should send a pass_thread_control to the second reciver
- you will have to set up a protocol to activate take_thread_control, to return the ownership of the conversation to the bot
- In any other callbacks (asuming the rest are for the messages send to the bot), the webhook should send them to Dialogflow using a client of it inside your webhook, evaluating if the bot has the ownership of the conversation or another app has (again could be another app or inbox)
As I said, it's just an idea, I'm not sure if it will work. Hope it helps somone!
References:
https://developers.facebook.com/docs/messenger-platform/handover-protocol/pass-thread-control (Passing Thread Control to the Page Inbox (Live Chat))
https://developers.facebook.com/docs/messenger-platform/handover-protocol/request-thread-control#page_inbox (Requesting Thread Control From the Page Inbox)
*This is an idea to make passing the ownership avoiding to create an intent that do that. Specially if you want to switch between bot and inbox page just moving a conversation from Done to Inbox or from Inbox to Done

How to trigger message without messaging bot first

I am learning the facebook api and I am curious how to do this.
On this website(https://botacademy.com/), they use manychat and you can click the opt in button (on web) and it automatically accesses your messenger inbox without prompts or auth.
It then sends you a programatic message. All of the tutorials I follow require the user to send a message first..
Do you know what endpoint of the API they are using to accomplish this?
Obviously I do not know what their code looks like, but:
that is a send to messenger button, which allows you to authenticate with a bot and an app, and sends your information to the webhook.
This counts as interacting with the bot, because you clicked the button and opted into the experience.
FBM Platform Policies have this to say about opting into messages and send to messenger:
How messaging is triggered:
...
Person requests a message from a business via a plugin, such as Send to Messenger

FbChatBot mark message as Read

i am developing fb chat bot, and i want to mark the message as read so that when the moderator of our fb page view the message part, they won't see so many unread messages even though the fb chat bot has already replied that user and they don't need to click that message just to mark it as "read".
How can i achieve this? I am trying to use this API: but it doesn't work.
https://developers.facebook.com/docs/messenger-platform/send-api-reference/sender-actions
You can not mark message as read (as of now), but the best way I deal with this is to use Handover Protocol
When your bot reply the message, it won't appear in INBOX, but it goes to DONE box instead.
When bot cannot answer, you can let your bot pass thread to INBOX. Then the moderator of page manually answer it. (and mark as DONE afterward)
Follow the instruction here to set it up:
https://developers.facebook.com/docs/messenger-platform/handover-protocol/pass-thread-control
(Note: You can pass thread to page inbox and then take thread back immediately. I will notify to INBOX, but your bot can still work with users.)
When you use the API you sent here (Facebook's Send API), you only mark the message as "seen" from the bot on the Messenger Chat that you have with your users. This doesn't affect the messages inside your Page's inbox.
Unfortunately, there is no way to mark messages as read inside your Page's inbox.
Is this new feature of fb bot? Thanks btw! I will try to check this.
Is there any side effects in Marking the message as done ???
To answer your question:
There are some bugs within the Inbox/Pages Manager mobile app. You won't see the messages in DONE folder if your admins are using Pages Manager mobile app for now.
I've reported the issue and working with them to solve it. However, you can still see those messages in DONE folder if you use a computer and go into your page's Inbox.
NOTE: It seems that messages moved to Inbox will be marked as seen (not bolded). This may be a little confusing if your admins don't mark each conversation as DONE after admin finishes conversation with the users.

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

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.
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.
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
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)
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?