We are running a chatbot based on the Facebook Messenger Platform. To introduce the bot to new users we have enabled the get started button: https://developers.facebook.com/docs/messenger-platform/discovery/welcome-screen#set_postback
Everything works fine from within the messenger. After starting a conversation our application receives a messaging_postbacks event. Trying the same from the customer chat plugin triggers nothing at all. According to the documentation this should work though: https://developers.facebook.com/docs/messenger-platform/discovery/customer-chat-plugin#steps
If a new conversation is started via the plugin, and your bot has set
up the get started button, we will send a messaging_postbacks webhook
event to your webhook when the user clicks the get started button.
Do we miss something? Is there something else we have to do? Is this a bug?
If you are not getting any postback, you can check if you white-listed your domain where your customer chat plugin is added.
Also, you can use messaging_referrals for old users.
Related
I created chatbot for Facebook. I tested in on one fanpage, got business and api permissions verfications from Facebook and I wanted to add the bot to more fanpages. I did it as before, I setted all Webhooks like messages, message_echoes but Facebook doesn't call my app. I'm checking it in debuging tool that shows network traffic to my server.
I tried to remove and add callback, fanpages, but nothing gets change.
The first fanpage still works all fine, but others don't call my bot on any message. Why?
assume you link your app to first fanpage with oauth dialog like this before.
oauth dialog : (See: https://developers.facebook.com/docs/marketing-api/overview/authorization)
https://www.facebook.com/v12.0/dialog/oauth
?client_id=<YOUR_APP_ID>
&redirect_uri=<YOUR_URL>
&scope=pages_messaging
when linking another fanpage with oauth dialog,
should click that edit settings button:
choose another fanpage:
now you receive webhooks from other fanpages.
So, problem was in my code. I was checking if request was sent using Symfony profiler. The problem was, it didn't save request if the process was stopped. And it was. I had "die" in some trycatch...
Rookie facebook api/developer user here. I have a couple questions hoping someone can shed some light on.
My use-case:
Facebook page user leaves rating/review
App receives webhook event with information about webhook event
(https://developers.facebook.com/docs/graph-api/webhooks/reference/page)
Using that event info, we initiate a messenger chat conversation with
the user
This seems like a common scenario.
My understanding of what needs to be done:
Create a facebook app
Add page webhooks product to app (specifically subscribe to ratings
event)
Wire up webhooks to my API (exposed via ngrok)
Add messenger product to app
...Somehow initiate convo with user (using reviewer_id??)
Does anyone have a good description of how to do this from end-to-end?
I have done most of this, but I cannot figure out how to do this in the test/sandbox facebook. Do I need to create a test version of my app, create a test page, and then use the graph api to subscribe the test app to the test page?
Thanks guys. The docs are nice and all, but there's no detailed directions on testing this end-to-end on the sandbox facebook. I don't have time to wait for an app review to test the functionality.
Thanks in advance!
I got a sample echo bot hosted on Azure Web App Bot, and link up with facebook messenger.
Every configuration setup correctly, when I type message in FB Messenger, some of my text were actually not receiving in /api/messages endpoint.
I used ngrok on Azure bot web app to replace it api endpoint with my local url and found out that some messages did actually fail to delivered to the endpoint.
I had setup my web app to be always on mode, and server location put in Central US. But it still has this performance issue.
Because our bot starting migrate to V4, and found out that the suggested action card always not responding after user click in Messenger (sometime it's works), it's normally reply with local bot emulator.
Any ways can improve this or minimize user lost their action in conversation due to the dropping message?
OK finally found out that delay/random reply caused was single FB page subscribed to multiple FB app.
Just try to make sure you only have a single page subscribe to a single FB app , else it will randomly send the webhook message to one of your subscribed app and cause the performance issue.
I am trying to implement IBM Watson chatbot into facebook messenger. I am able to verify my webhook. Also, able to receive and send custom messages through facebook to my webhook.
The problem is that i can't receive messages from IBM Watson. IBM Watson is not able to detect my messages and provide appropriate response. Also, can't receive my welcome message from IBM Watson in facebook messenger when chat window is opened. The tutorial which I followed was on youtube and the link is https://www.youtube.com/watch?v=FdsjS7ZnPLw
Any suggestion would be a great help. Thanks.
The most common cause is not subscribing your webhook to a page after creating it.
The UI doesn't appear until you create your webhook in FB (It's been a year since I have had to do it, so it may have changed).
If that is set up, try connecting to your application layer in postman and make sure you are sending and receiving the right information.
Regarding Welcome message:
The Welcome node of your dialog is not processed by the Facebook Messenger integration. The welcome message is not displayed in the Facebook chat like it is in the "Try it out" pane or in the Preview Link integration web page. It is not triggered from here because nodes with the welcome special condition are skipped in dialog flows that are started by users. Facebook Messenger waits for the user to initiate the conversation. If you need to set default values for context variables at the start of your conversation, do not set them in the welcome node.
for more information check: Integrating IBM Watson Assistant with Facebook Messenger
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.