App request sent, count increases; Actual request never shown - facebook

Ok .. I am using the Dialog JS API to send requests to people. I know this is working because
The JavaScript callback shows the request ID
On the recipient's account, the "App Requests" item on the left side bar has a count which is increasing with each and every request that gets sent
What I cannot figure out is why, although the requests are being sent and the counts are increasing, there is nothing that indicates that a request has in fact been sent.
I have checked the Notifications section and it is empty. I have also checked the following two URLs, both showing nothing:
http://www.facebook.com/reqs.php
http://www.facebook.com/reqs.php#!/?sk=apps

After hours of debugging and looking at other peoples apps, I started digging into Facebook's bug tracker and found someone else with the same problem today Apparently there are a number of "request" bugs today.
https://developers.facebook.com/bugs/237217296327314

Do you have a valid canvas url and valid secure canvas url in your facebook app settings? May be something to check as I believe it is required.

Related

Facebook Messenger Platform - Webhook Subscription

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.

Facebook Leadgen does not send Webhook Request

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.

Facebook "pre-filling" policy unclear with regards to empty message and the link parameter

I'm trying to get publish_actions permissions approved for an iPhone app and been denied twice. The first time was because, as the policy says not to, we were populating the message parameter automatically when posting to the user's wall using the graph api. So we removed the message field entirely and kept only the link parameter.
The app was rejected again with the same message so I figured I'd try to get a definitive answer here before I get three strikes on app submission.
Both the 2.3 platform policy video and written policy explicitly say do not pre-fill the message parameter but say nothing about the link parameter. Beyond simply not pre-filling any of the message parameter must we also provide a way for the user to enter a message? If so that is not clear in the policy.
Graph Api Publish Documentation:
https://developers.facebook.com/docs/graph-api/reference/v2.1/user/feed#publish
"Pre-fill" Video: https://developers.facebook.com/docs/apps/review/prefill
I was rejected three times with the same response - which was you can not pre-populate the message field. But with the second and third submission, I was not pre-populating the message field. Of course I was expecting the Facebook reviewer to operate the application according to my instructions to see this. They don't, and the refusal was because they could not tell from my submission that this was the case. The response they give is not hand typed, but a stamped response given when they click "REFUSE!".
The solution is not only to get the application to behave according to policy, but to provide clear pictures with the step by step instructions of how your application shows the user the post, allows for the user to input a message, and the finished post on his time line.

How to Avoid Posting a Duplicate when Publishing to Facebook?

With the Graph API, I publish a story by POSTing to the /me/feed connection. I get back a success or an error result from Facebook. So far so good. Once in a while, the API takes a long time and the connection times out. In that case, I don't know for sure if the request succeeded of failed (i.e. maybe the request never reached Facebook, or maybe it succeeded and the result never made it back to me). How do you handle this situation?
More details:
I publish a lot of posts to Facebook and Twitter, so the timeout situation happens often. With Twitter, the solution is easy. If the request times out the first time, I simply try again. Twitter detects duplicates, so if the post was successfully published the first time, then I'll get a "duplicate status" error on the second request and I know that I don't need to retry any more.
But Facebook doesn't detect duplicates, so if I retry the publish request, I risk having two copies of the post published to the user wall, which is not nice. On the other hand, if I don't retry, I risk having the post not published at all. Thoughts?
I get back a success or an error result from Facebook.
Hmmm. When I post to the Graph API, I get back an error or the id of the post. I never see any success message. What SDK are you using around the API?
Once in a while, the API takes a long time and the connection times
out.
Usually when things are running slowly, it's due to the channelUrl not being specified. See https://developers.facebook.com/docs/reference/javascript/
It is important for the channel file to be cached for as long as
possible. When serving this file, you must send valid Expires headers
with a long expiration period. This will ensure the channel file is
cached by the browser which is important for a smooth user experience.
Without proper caching, cross domain communication will become very
slow and users will suffer a severely degraded experience.

Facebook notification system: Is it polling?

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.