Is it not possible to share multiple images through the Facebook share opengraph function?
The code snippet reads like this:-
FB.ui({
method: 'share_open_graph',
action_type: 'og.likes',
action_properties: JSON.stringify({
object: {
'og:url': xxx,
'og:title': xxxxx,
'og:description': xxxx,
'og:image': img_arr
}
})
}, function (response) {
// callback function goes here… });
It is required for img_arr to be an image array. But the dialog box shows up blank saying that “Sorry, something went wrong.
We're working on getting this fixed as soon as we can”. The images being shared on the facebook post is dynamic.
Facebook no longer allows the overrides. You must have the og metadata in the head.
Related
I am facing a problem with retrieving dark post via Facebook graph API.
For example, I call request to particular dark post like this:
/123456789_111112222223333?fields=is_hidden,is_expired,is_published,message,created_time
I receive the requested object like this:
{
"is_hidden": true,
"is_expired": false,
"is_published": false,
"message": "Some message",
"created_time": "2019-03-22T13:35:10+0000",
"id": "123456789_111112222223333"
}
But when I call request for promoted_posts:
123456789/promotable_posts?fields=is_hidden,created_time&include_hidden=true&is_published=false&include_inline=true
I receive an empty array of objects. When I change parameter is_published into true, I receive list of posts, with created time before and after that post.
How can I receive all dark posts for the page? Thanks for any advice.
Easy peasy!
/{page-id}/ads_posts?include_inline_create=true
Gives you all ads posts (Dark Posts also included)
How to create an event that will work on like and unlike?,
when I create a webhook
object = page callback_url = ”example.com" fields = feed verify_token =
hub_verify_token
verification callback_url passes and the answer is tapped
{ “success”: true }
But after like or unlike on callback_url nothing is sent.
The events that I have used before :
edge.create and edge.remove.
http://i.imgur.com/xK5C4IK.png
Help please!
There is a solution to the problem:
Details here: https://developers.facebook.com/docs/graph-api/reference/page/subscribed_apps/
Code example in the JavaScript SDK:
/* make the API call */
FB.api(
"/{page-id}/subscribed_apps",
'POST',
{
"object":"page",
"callback_url":"https://example.com/callback",
"fields":"likes",
"verify_token":"my_token_code",
"access_token" : "you_access_token"
}
function (response) {
if (response && !response.error) {
/* handle the result */
}
}
);
but unlike for the page does not work (((
what do you think about it?
There is a list of all webhook fields in the docs: https://developers.facebook.com/docs/graph-api/webhooks/reference/page/
There is no specific webhook about likes/unlikes. According to this article, it should be possible though: https://developers.facebook.com/blog/post/2017/11/07/changes-developer-offerings/
The feed hook may only deliver likes to posts:
Describes nearly all changes to a page's feed, such as posts, shares,
likes, etc. The values received depend on the types of changes made to
the page's feed.
I am trying to develop one-click-integration support for my bot, which will include FB messenger.
For the FB messenger I did the following:
Followed the "quick-start" guide and created a Facebook App.
Followed the "facebook-login" tutorial and deployed a facebook login process which works with permissions for:
- public_profile
- email
- manage_pages
- pages_show_list
- pages_messaging_subscriptions
- pages_messaging
I then used the graph-api of '/me/accounts' to get list of pages name , page ids, and access_token under a "test user" I created in facebook.
Now, I picked a page under this "test user" (with all the permissions), and tried to run this JS code -
FB.api(
`/${page.id}/subscribed_apps?access_token=${page.access_token}`,
function (response) {
console.log(`response = {$JSON.stringify(response)}`);
if (response && !response.error) {
/* handle the result */
}
}
);
The problem: I get response = {"data":[]} , which might be OK, but when I look at the page->settings->Messenger Platform->Subscribed Apps , I don't see any app subscribed there.
By the way, When I run this without the proper access_token , I do get an error #210 ("needs access_token") which is as expected...
Any idea how to subscribe the app properly to the page?
Must say I also tried it with the graph api explorer tool and got the same result...
Thanks in advance :-).
#CBroe got it correct and there were 2 issues:
1. I should have used the POST() instead of GET() method.
2. When you use the graph-api-explorer tool, you will see it works, then role down and get the JS code... problem is the code is a bit confusing since what you get is this:
FB.api(
`/${my_page_id}/subscribed_apps`,
'POST',
{},
function(response) {
// Insert your code here
}
);
but, it should actually be like this:
FB.api(
`/${my_page_id}/subscribed_apps`,
'POST',
{"access_token": `${page_access_token}`},
function(response) {
// Insert your code here
}
);
remeber to take the access_token from the /me/accounts api as I described in my question.
Thanks again to #CBroe for showing me how to solve this :-)
I'm having trouble storing the user's email address in a variable in javascript. What I want to do is call the API, get the email address, and store it in the "email" variable, for use in other functions on the screen.
My code looks like this:
function emailCheck(){
var email;
FB.api('/me',email = function(response){
return response.email;
})
}
alert(email);
I did check to make sure that I have the proper permissions. I would put alert(response.email) in my response section, and it would alert with the proper email. The problem is that I cant get the email variable accessible outside of the function.
You need to use a continuation as all API methods are asynchronous
function emailCheck(continuation){
FB.api('/me', function(response){
continuation(response && response.email);
});
}
emailCheck(function(email) {
alert(email);
}
A different way is to use Promises, Futures or deferreds (same thing really) to abstract pieces of this.
Trying to create a wall post with photo attached. Photo is a Facebook-hosted photo within some album.
Problem here - Facebook won't allow including facebook-hosted content in posts ((#100) FBCDN image is not allowed in stream )
From the Web UI, it's possible to "Share" a photo on my wall - that's almost what i need but i don't know the Graph API equivalent for that operation (if there's any)
Any help appreciated.
The answer is "me/links"
passing http://www.facebook.com/photo.php?fbid=** as a link
With the Graph API you can share the photo as a link.
this is the documentation:
https://developers.facebook.com/docs/reference/api/user/#links
You need send a POST request to me/feed/. And indeed send the link: http://www.facebook.com/photo.php?fbid=[the id of the photo]
Make sure the publish_stream permission is allowed for the access_token.
with Jquery this is an example:
$.post(
'http://www.facebook.com/me/feed',
{
link: 'http://www.facebook.com/photo.php?fbid=[THE_PHOTO_ID],
access_token: [YOUR_ACCESS_TOKEN]
},
function(result) { console.log('shared'); },
'text'
);