I am creating a Facebook Webhook. The callback link has been verified and so the connection should be okay.
When I further test the Webhook by pressing the test button under feed,
it seems it works.
However, nothing's received in my server, not even an access log in Apache. (I have checked both ssl_access_log and access_log) Any suggestion on what I have possibly missed?
Did you forget to write POST request method ?
Facebook Webhook confirm callback URL in GET request, but they send event in POST request. So you need both GET and POST method in your server.
It turns out to be the problem of using vhosts. The vhosts is set up by my colleague and he decided to save the access log and error log putting in other position than the default location.
Related
I would like to have a log chat on my own server by collecting them from the chat history between user and my Facebook page.
I found the document mention about message
Next after I can verify my token using ngrok get my server connected with Facebook. Then I am looking for message.
In my understanding I have to listen to my page event. But I could not found and row mentions about it.
I found message_sends in the User. But it is not what I want.
I think document might not get uptodate. In the picture it is 2 and now it is 3.
Obviously subscription to User and select message_sends is not a correct solution on my use case. My case is user send message to my page. And my page send webhook to my chatlog server. That's all.
Question:
How to connect message on my page to my webhook url?
I have to use messenger and then Subscribe To Events
I'm having a little (big) problem using webhook on Dialogflow (API.AI) and Actions on Google.
I have enabled webhooks on Dialogflow, and I'm getting the requests when trying my intents on their console (on the right of the page). I have also completed actions on google integration (setting the welcome intent + auto propagating changes).
However whenever I try my app on a Google Assistant app (phone/google home/their simulator) I'm not getting any request to my server (not even a 404 one), but their debugger shows this error:
status": {
"code": 206,
"errorType": "partial_content",
"errorDetails": "Webhook call failed. Error: 404 Not Found"
},
Has anyone had the same problem, or knows a fix for this ? I know it's not on my end since dialogflow requests are arriving and being correctly responded to.
Jo's answer gave me some hint that solved my problem.
In my case, webhook doesn't work after I turned it on for my agent, so I switched to another agent in the DialogFlow console(top left corner), then switch back to my working agent, click Fulfillment and found it mysteriously got disabled!
So what I did was re-enabled and re-entered the webhook link then click save. After that it worked.
Hope this helps.
Okay, I'm not marking this as resolved because I believe there are many "bugs" on the implementation between Dialogflow and Actions on Google.
Take note that this works IF you are getting webhook requests from Dialogflow console (on the right of the page) but NOT from actions on google simulator.
1) Try changing the name of the app on the "Info" section of Actions on Google and sending messages from Google assistant asking Talk to <new_app_name>
2) Try opening another project from Actions on Google dropdown (up right) and opening the first one after (It causes some reloading on the back I guess)
3) Try both
These have been working for me
I was facing the same issue where the Fulfillment didn't get saved even though a successful message is shown. In my case, I only kept only one Dialogflow tabs (closed the rest) and after clicking on Save a few times, I refreshed the page and made sure the webhook was still enabled. Then tested the app on Simulator and got a post request to my server!
Please make sure the following points :
(1) you have to fill all parameters under Directory Information (you can find this information at Left pane of actionOnGoogle).
(2) your Webhook URL must be a valid HTTPS URL.
(3) please make sure your server is listening for post request as dialogFlow or actionOnGoogle will send POST request on given fulfillment URL.
Directory Information on actionOnGoogle
You might have given link in fulfillment tab for the webhook url starting with http. Dialogflow's internal architecture rejects links which starts with http. Please make it https and it will work. It worked for me.
I have followed the steps to setup the Facebook Messenger platform. The verification GET web hook request work perfectly, as does the subscribe but when I submit the chat I keep getting the follow Developer Alert:
Hi Norah,
We've noticed that your Webhooks subscription for callback URL https://{domain}/v1/webhook has not been accepting updates for at least 16 minutes. Please verify that your callback server is functioning so you may continue to receive updates. If you need to update your callback URL, see https://developers.facebook.com/docs/messenger-platform/webhook-reference#webhook_setup
If your callback URL continues to fail to accept updates for 8 hours straight, we will disable your subscription. To reactivate the subscription, make a POST request with the same parameters, and it will be reactivated.
My post request works through POSTMAN.
Please can someone help me! This is driving me nuts!
Do you have logs on your server for that post requests?
Facebook requires you to return status code 200 for the post request, so they know that you successfully received it. When they havent, they try it again and if that still fails after several times, they will give you this alert.
Maybe facebook uses another content-type or message content than you used with postman.
Your server logs should give you more insights about that.
Depending on what Webhook events that you have subscribed for a page, there will be callbacks for those events, and more, on the url you have specified in the Web Hook set up.
If you had subscribed to the message_deliveries event, every time a message is sent, whether from a user to your page or from your page to a user, there is a, maybe more, calllback with a Message Delivered json object. The Webhook Reference has an example of the Message Delivered json object, but no specification or explanation on what the fields mean.
Occasionally I find that an undocumented Read callback is received, sometimes. The undocumented json data for this is like:
{"object":"page",
"entry":[
{
"id":"1722858134648129",
"time":1465407550812,
"messaging":[
{
"sender":{"id":"1131485883560113"},
"recipient":{"id":"1722858134642218"},
"timestamp":1465407550868,
"read":
{
"watermark":1465407548057,
"seq":428
}}]}]}
Essentially, you must code your callback to handle ALL types of json data gracefully, including unknowns, even though you may not be ready to process them further. For those that you are not ready to handle or uninterested in, return nothing with Http status code 204 (in fact every callback should return 204 as the type is void).
If you handle only those types of json data you are interested in, any unexpected json data will most likely raise an exception in whatever language your web callback code is written in and result in a 500 server error returned to Facebook. It is this 500 error that is causing Facebook to make that complaint in your question.
I've an app which collects leads generated using Facebook Leadgen Ad.
I've a Webhook subscribed for that but for some reason it never sends any requests when leadgen form is filled.
Earlier it was working without any issues.
I noticed yesterday that I received request an hour after forms were filled whereas today I've not received any requests but I do see new leads in the CSV file I downloaded.
Will appreciate if somebody can point me to what can be going wrong here.
Thanks in advance!
Not sure if you have come across this but, there is a testing tool which you can use to submit test leads for a page and see if the lead is getting pushed to your app successfully or not -
https://developers.facebook.com/tools/lead-ads-testing?__mref=message_bubble
If you click on the Track Status button after creating test lead it tell you the status of the webhook ping for the submitted lead.
Notification when the user first login, not so hard, just require a database scan, I can deal with that. However, when a friend send a request or comment on profile X, a notification is sent, and almost immediately receive on the other end even when the user X not making any request. Is it polling? Does not feel like it, since the page never refresh itself. It must be something else? Anyone have any idea? maybe Web Push?
Facebook uses long-polling.
While you're on their page, they have a script continually issue requests to a particular URL. Instead of immediately responding, the server handling that URL first waits for a message to come in to its queue, and then sends that message out to the user. If a certain timeout is reached, the server responds without sending a message, and the client-side script makes another request to that URL.
To see this in action, open up Firebug's Net tab while on a Facebook page and wait for a couple minutes. You should see requests that last for a minute and then are followed up with a new request.
I believe they use AJAX/Javascript for that. It would allow the page to get information from the server and display it without reloading the page. You should be able to do this with an AJAX library like JQuery or something similar. As for whether or not Facebook itself does push or poll, I have no idea, but you can get a similar behavior by polling with AJAX.