Facebook API - Feed.registerTemplateBundle issues - facebook

I'm trying to build a feature into my framework wrapper that automates registering template bundles. I've gotten to the point where it seems like I can do so successfully using the Feed.registerTemplateBundle API method - I don't get an error, and I do get a template id back. However, the template doesn't show up in the "Registered Templates Console", and if I try to publish a story using the id, it gives me an "invalid template bundle id" error.
Any suggestions?

I had this problem in Facebook's official example application (TheRunAround)
it was registering template but when it tried to get an id it was
using sprintf (like: sprintf('%d', ))
current template ID's are out of the 32bit range so it was returning wrong id.
May it be the cause?

Turns out there were two problems:
I was erroneously double-json-encoding the short story template
Facebook was accepting the erroneously-formatting calls and returning an id, thus resulting in the creation of "phantom" template bundles that weren't showing up in their console.
I've fixed my code, and the bug has been reported (and I believe since fixed).

Related

Facebook login with Azure Service and get user info error

I've implemented facebook login following this blog https://ahoycoders.com/2015/07/09/xamarin-forms-social-authentication-with-azure-mobile-services-part-3/
That blog is based on old Azure portal.
But, I'm using new Azure portal.
1. In the new Azure portal I used Easy APIs option for creating custom API as mentioned in the blog.
2. I copied the scrip mentioned in the blog for my custom API and I'm using only Facebook.
I authenticated via Facebook and then called the following,
return await mobileService.InvokeApiAsync("getextrauserinfo", HttpMethod.Get, null);
Unfortunately, I'm getting the following error,
"Cannot read property 'getIdentities' of undefined"
I don't know what's wrong, please help me in fixing this.
currentUser is no longer obtained from request as .user, it is now request.azureMobile.user
They changed the method calls. It is also no longer getIdentities.
Its getIdentity.
A few other calls slightly changed as well.
I suggest anyone wanting to use that guide use console.log to see what each object actually returns and then switch out the old code for the right call.
Logic in that example should still be fine, just slightly different calls/names.

An unknown error has occurred on Graph Facebook

I tried to get Data from Facebook Page with the graph of Facebook but I have a problem.
When I try to go on link like:
https://graph.facebook.com/ID-PAGE?access_token=MY_ACCESS_TOKEN
I always do this to have the Data from a Page but since today I have the error Message: "An unknown error has occurred".
Thanks for help.
EDIT:
The bug is fixed : https://developers.facebook.com/bugs/486654544831076/?search_id
Have a look at my answer at
How to get user email and birthday from Facebook API Version v2.4
You have to specify each field you want to query now with v2.4. If you want to explicitly use v2.3, you need to prepend your calls by /v2.3 like this:
/v2.3/{page_id}?access_token=MY_ACCESS_TOKEN
Seems like there's currently a bug regarding requests made with app access tokens instead of user access tokens:
https://developers.facebook.com/bugs/486654544831076/
At this moment, I pretty much figured out what is happening, and it looks like a bug in the Facebook API.
For v2.3 and lower:
The /PAGE-ID call will return an Unknown server error when you don't pass ?fields=username (for example). If you do pass the fields option, it will work. You can get it out of the docs.
For v2.4:
This will work, but you will miss a lot of data, so you'll also have to pass the fields options. But if you don't pass that, this version will give you back only the most basic of details. This is as described in the version release: https://developers.facebook.com/blog/post/2015/07/08/graph-api-v2.4/
So the solution for now, would be to add the ?fields= everywhere you need, or to wait for Facebook to maybe ever solve it.
(And while you're at it, you might as well upgrade to v2.4 ;-)

Open Graph & Rails not retrieving object's URL

I'm using Rails to try and add an action for an object both defined for my app on the open graph. I am using an :after_filter in my controller to call the following after session#create:
#graph.put_connections('me', 'workkout:complete', :session => url_for([#plan, #session]))
I am getting the following back from Facebook:
{"error":{"type":"Exception","message":"Could not retrieve data from URL.","code":1660002}}
I have checked that the correct URL is passed to put_connections, and when I visit this URL using Facebook's Lint tool, everything is correct.
I can't understand why this isn't working, my only thought is that Facebook is hitting the URL moments before rails has generated the object? - not sure if that's even possible though.
Can anyone shed any light on this?
Turns out it was because the create action and the put_connection methods take place in independent threads and as such the URL is not ready when put_connections is called. Solution here http://railscasts.com/episodes/363-facebook-open-graph?autoplay=true

Facebook authentication within a Page Tab

According to the specification here: http://developers.facebook.com/docs/authentication/pagetab/ I want to autorize user with the server-side flow on page tab. I use PHP-SDK.
My redirect_uri parameter is build like that:
https://www.facebook.com/pages/null/PAGE_ID/app_YOUR_APP_ID
and I keep getting:
API Error Code: 191
API Error Description: The specified URL is not owned by the application
I was trying many different settings combinations. Now I have filled fields: App Domains,Site URL,Canvas URL,Secure Canvas URL,Page Tab URL,Secure Page Tab URL but still without success. Addresses are ending with / and are all the same.
Link are build proper by the sdk. I test building it "by hand" without encoding of redirect_uri param and redirect link build like that:
https://www.facebook.com/PAGE_USERNAME/app_YOUR_APP_ID
https://www.facebook.com/pages/Page_Title/PAGE_ID?sk=app_YOUR_APP_ID
Can someone tell me what i'm doing wrong?
The answer to that question is that facebook documentation is incorrect. Format of return_uri that worked is:
https://www.facebook.com/pages/null/PAGE_ID?sk=app_YOUR_APP_ID
The format of return_uri changed again, the new format is:
https://www.facebook.com/PAGE_NAME?sk=app_YOUR_APP_ID

/act_{account-id}/adcreatives creative_ids parameter is not working in the Facebook Ads Graph API

I have an application that uses the Facebook Ads OLD REST API and recently I heard that it will be deprecated in a month, so I'm working hard to migrate all my code to the new Graph API...
Unfortunately, nothing goes smoothly.
when calling to GET /act_{account-id}/adcreatives to get the AdCreatives for a specific campaign the parameter creative_ids is not working and always retrieving all the creative for the account!
This was working fine in the rest api... and no documentation changes were made in ads.getCreatives so I'm assuming creative_ids paramter is still there...
Any help will be appreciated!
thanks,
Yaniv Hakim
I found the _ids parameters to be finicky so I use the generic ids=comma-separated list parameter, without the act_{account-id}. Creative IDS are unique across accounts so there's no need to specify the account-id. If you want to use the specific parameters, have you tried creative_id, creativeids, creativeid and other permutations you can think of (with and without account-id)?