Messenger BOT - falback to opertator - facebook

I'm new to Messenger platform and I'm developing a help desk BOT integrated with Facebook Messenger (on a Facebook Page).
I'm wondering on the best practice to fallback/redirect a conversation to a "real agent/operator" (when the BOT is unable to undestand or help the user).
Is it possible to redirect to another page? alert an operator? ...
I was only considering the various possibilities and best practices .... any advice is welcome!
Thank you!

What I did in my chatbot, is that when a user wants to talk to a real agent, he presses on a button called "Talk to Support". (I'll not talk about when this button is sent, you can make your own criteria)
Now in my database, there's a column "Chatting with Support", it becomes "true" when the user presses on the "Talk to Support" button, and as long as it's true, the chatbot script will ignore every message from this user.
Now the important part: when the user wants to go back to the chatbot?
I gave my agents a string like "Cancel Chat Session". And whenever a user wants to go back to the chatbot, my agents type "Cancel Chat Session".
What happens is that I subscribed my webhook to messaging_echoes event, which simply sends every message my agents send to any user to my chatbot aswell.
You know the rest, I'll check every request in my chatbot if it's an Echo, the check the text, if it's "Cancel Chat Session", I'll set the column "Chatting with Support" to false for the user, and he's back to the chatbot.
Check Facebook documentation for messaging_echoes events:
messaging_echoes
I hope you could make use of this :)

Related

Facebook chatbot doesn't reply reviewer in app-review

We have made a chatbot for Facebook Messenger and submitted it for app review 2 times requesting pages_messaging. Both times the same error occurs:
The app reviewer presses "Get Started" and the bot greets the user, and asks a yes/no question - as it should. However, when the app reviewer responds to this question the bot never replies. As shown in picture 1.
In picture 2 it is shown how the bot responds to everybody else (we have tested with 9 users).
Does anybode know why the bot only replies once? There is no error code from the server logs.
We have applied for pages_messaging, and added the reviewers as testers of the app, and editor of the connected page. Have anybode else had a similar experience?
Picture 1:
Picture 2:
Which framework you have used to develop your chatbot ? Can you cross check configuration while building your intent or entities, if you click on checkbox "Set this intent as end of discussion". If yes, please turn it off.

Facebook Messenger, send webview directly

So i found that the 3 ways to send webviews on facebook messenger are:
All of those solutions implies to send either a Menu, a Card or a Chat extension where the user have to click.
What im looking for is that when the user interacts with my bot (at the moment he says "please send me the webview"), the chat without clicking some button redirects the user to a webview. In this way the conversational flow its not affected by pop-up screens.
Is there a way?
Thanks in advance

Sending Invitations to Participate in Facebook Messenger Bot

I am very new to Messenger platform and I'm trying to wrap my head around the types of things that are possible. In particular, I'm interested in using a bot as a "mediator" of communication among friends. For example, one could build build a bot to help make a group decision, like where four or five people will have lunch. Each person interacts only with the bot, the bot gathers lunch preferences, and communicates some type of optimal choice to all participants. This could require a back-and-forth discussion of preferences with each participant. Is that clear?
At this point, I'm wondering two things:
How would a user initially invite another user into the conversation? Suppose user A starts talking to the bot and the bot tells user A, "Invite some friends to join us in this conversation". Can the bot actually send these invitations on behalf of user A? Or does invitation have to take place via some other out-of-band mechanism?
Is messenger platform the most appropriate FB platform technology for creating this sort of interactive mediation app?
Thanks in advance, InterWebs...
If I'm understanding your idea correctly, it would be very difficult to build a bot that could chat with each person separately but offer a shared experience. When a user shares the bot with another user and the new user starts a chat, the bot has no way of knowing where the referral comes from, so there's really no way to know that the two users are linked.
What you could do is build a chat extension, which basically makes functionality from your bot available in a group chat:
https://developers.facebook.com/docs/messenger-platform/guides/chat-extensions

Facebook Messenger Postback without user sending values: how to detect user has entered chat?

It's not very clear to me and perhaps other devs as well. I've read the Facebook Messenger docs maybe 5 times and I can't understand how bots detect when a user enters their chat window.
I started by looking for a postback, when users entered the bot experience. No Postbacks. I looked to see if it was Messenger Greeting, and that seems to only apply the first time a user arrives in your bot experience. This also seems a little different.
It's possible this functionality is not available to everyone. But Poncho has done this several times when I enter their experience and don't type anything.
Anyone seen this or have any ideas?
The postbacks are something completely different. The postbacks are received only when a user clicks on a button which contains a payload mentioned in the payload element of your button template or structured message. Facebook chat bot API sends this payload back to let you know that the user has clicked on a particular button.
What you're looking for is called Welcome Screen and you're right, the default behavior was not clearly listed in the documentation. But one of the Facebook engineers cleared the doubts for me and now they have edited the documentation. The welcome screen appears once and only once for a user on the messenger app i.e the first time when the user interacts with your chat bot even if the user deletes the conversation. From the docs:
The Welcome Screen only appears for new conversations. On mobile,
deleting conversations will not cause the Welcome Screen to appear
again. On desktop web, if you delete the conversation, you can make
the Welcome Screen appear again.
Where as, the behavior is different for the regular Facebook chat in a web browser. A user can see the Welcome Screen in the regular chat if he/she deletes the conversation.
There's no way to detect that the user has just entered the bot experience. I've tested Poncho bot before and I don't get any message when I enter the bot experience after the first conversation.
There's a possibility that you're experiencing this because of Watermarks. Watermarks are received on our webhook when a message is delivered and read by the user. May be they are handling watermarks in such a way that if the timestamp that comes with the watermark is few hours late than the current time, they send the message. You can read further about watermarks in the official documentation here and here.

Can I post my own message in Facebook "Real Time App Activity" (apps ticker)?

Is it possible to post my own message and publish it on the app ticker whenever i want?
(Not talking about the general ticker on users feed, but the one you have when you enter an app)
For example: Every time a user logged in, facebook publish a message in app ticker (on the right) that the user started to play the app.
I believe what you're looking for is publishing an action.
For a high-level explanation: https://developers.facebook.com/docs/beta/opengraph/#news-feed
For the tutorial: https://developers.facebook.com/docs/beta/opengraph/tutorial/
You can set specific Open Graph actions for your application that will be viable to appear in the app ticker. I do not think there is anyway to FORCE facebook to display your action.
You can read more here about the Open Gaph Protocol.