Facebook Share Icon not visible for posts made through Graph API - facebook

I have a problem with posting updates to facebook through graph API,when i post something to facebook through graph API, only like and comment are shown for that update in facebook and no share icon, after a little googling i found out that we should use me/links as end point while posting and that's working great i can see share icon for all the link updates i am making now but the problem is how should i handle the case for normal text updates without any links in them how should i post such updates in order to get share icon in facebook,
below is the code i am using for link updates,it posts the update and i can see the share icon in facebook
facebookClient.publish("me/links", String.class , inputStream,
Parameter.with(ACCESS_TOKEN_PARAM, accessToken), Parameter.with(MESSAGE, message),
Parameter.with(PICTURE, imageURL), Parameter.with(LINK, link==null?"":link));
and below is the code i am using to post text updates this code posts the update but with no share icon in facebook.
facebookClient.publish("me/feed", String.class ,
Parameter.with(ACCESS_TOKEN_PARAM, accessToken), Parameter.with(MESSAGE, message));

This is currently not a feature of the Graph API unfortunately. There is a feature request report here that I would recommend you support by voting for it.
As a workaround, you should consider using an Open Graph Action with a user message as opposed to a stream publish call as it will show the Share link and other custom action links can be included too.

Related

How to get "Send Message" button in Facebook Page Post or Image Share via Graph API?

I am trying to automate Post and Shares in Facebook Page's feed using the Graph API.
For simple posts in feed like text and link I was able to do it with no struggle.
(Based in this: https://developers.facebook.com/docs/graph-api/reference/v2.10/user/feed#publish)
Then I got into making a Share of photo or video. Again not a problem. But I have noticed in Facebook Page itself it is possible to add a Send Message button. Where it even has a label with "Add this button to your post so people can reply directly in Messenger."
Facebook create post in Page
I was looking in the actions sections and other places and I found no way to add it via Graph request.
Currently, I am generating the Post via Graph like this:
POST graph.facebook.com/v2.10/MY_PAGE_ID/photos?access_token=PAGE_TOKEN&caption=MY_TEXT&url=IMAGE_URL
It it possible to add the Send Message button via Graph? Or this is only restricted to Facebook UI?
Thanks for the help!
Use this endpoint /page-id/feed https://developers.facebook.com/docs/graph-api/reference/v3.0/post
call_to_action parameter should be
{"type":"MESSAGE_PAGE","value":{}}

Custom Facebook comment box

I want to build custom Facebook comments box for that I have done lots of R&D but I am stuck on how will I post comments against the url of different pages of my website.
I want the similar functionality which Facebook's comment box plugin provides like I will drop my custom Facebook comments box on my page template and it will work for all the pages which are inheriting from that template. Which means each dynamic page will have its own commenting box depending on its url.
It would be better if anyone provide me steps to achieve this functionality. I have gone through the Facebook developers forum and have learn commenting against the ID of Objects but I want to start comment box from page Url as Facebook's comments box takes href of the page.
My test work:
When I have posted comments through Facebook comment box plugin against url and get all of them using Graph api so all comments are listing successfully.
but when I try to post the comments against the mentioned url using graph api so I get the exception here.
https://lh3.googleusercontent.com/-KckTuX8DifY/UOFP_e-5ayI/AAAAAAAAAJc/e1wYHZGN9Nc/s629/Get+and+Post+Comments.png
I need answers of following questions.
How will I start commenting against page's url.
My custom commenting box template are shown below
https://lh4.googleusercontent.com/-7iP0_Xi22zk/UOFOn_g_Q7I/AAAAAAAAAJI/FlnDhDTSyZs/s622/Custom+FB+comments+box.jpg
Thanks

Load comments from open graph object into Facebook comments social plugin

I have created a website connected my facebook app. Users can login and post a custom action connected to a custom object with open graph, javascript sdk. This will also post with 'fb:explicitly_shared' set to true so it will generate a post on the users timeline. So these custom objects have their own url and on those pages i want to have the comment plugin. And i want that object page (with the comments plugin) and the post on the users timeline to share comments.
I have tried setting a lot of different things in the "href"-property on the comments plugin but nothing seems to work. However i have managed to get the comments of the timeline post with a call to '/objectid/comments' with FB.api(). I can use that to build my own comments ui, but i rather use the comments social plugin. Is there any way to make it happen?
The Post ID and the Open Graph Object ID are different, so I do not believe that they can share comments. Comments are based off a single Facebook ID. Also, it is not currently possible to write comments to an Open Graph Object from the API (comments plugin only) so you can't really create your own comments plugin for an OG object.

Comments social plugin for Action post

I have an app app1 which defines a custom Facebook action act1.
When a user performs this action to an entity (ntt1) in my app, I post to API /me/app1:act1 with URL to ntt1 as its param, so that a post is generated on user's wall saying User act1'ed ntt1 where ntt1 is a link to ntt1's view page (with open graph meta data on its header).
Users can comment or like on this wall post regularly.
Now I want to show users' comments on ntt1's web page as well to share the comments and likes between the Facebook wall and ntt1's view page.
I tried using the Comments social plug-in, but don't know what to put in the data-href to point to the action_instance_id of the wall post.
I know I can simulate a comments box on my page using the graph API (and I've already done so), but this is not making a good ux, because the users need to authorize to my application to view this page (so that the java script API can fetch the comments from the Facebook).
Have you tried just pointing the data-href attribute to
https://www.facebook.com/{user_name_or_id}/activity/{action-instance-id}
…? The docs for using actions say this is the URL you can use to “preview” the news feed story that this published action will generate (or rather has already generated, because without publishing the action first, you would not have an action-instance-id).
If you click on the “x minutes/hours/… ago” link for the feed story for one of your published actions, it should take you to a link that’s build using the same scheme.

Unable to post links to an FB Event page using the Graph API

We are trying to publish to the feed resource of an event using the Graph API. What happens is it seems to ignore any link that we post. It also does not seem the Graph API supports any option for posting a photo to the wall of an event.
We make the call to the event feed using the following parameters:
link='http://rfid-social-media.odinrfid.com/photo?photoId=000000000000000000102107'
name='John at Facebook Party'
message='Test Message 2'
caption='What a great time'
And we publish against the url:
https://graph.facebook.com/EVENT_ID/feed
The request response does go through successfully, but the link does not show up in the UI.
We can post a link to a regular page using the Graph API without issue. It does show in the UI with the link, thumbnail, caption, etc, all as it should.
Thanks..
This is a Bug and its reported and marked as confidential
With the below text and its also contain security hole
bug report link
Below is my bug report text.
Other details on this report are shown to Facebook employees only
I recently attempted to post on an event's wall using the Graph API, but only the message is posted; Everything else is not showing. e.g.
Link
Picture
etc
There is one more big thing that the post doesn't show; That this post is post "via a Facebook app"
Note: posting on a page or user wall worked and also normal messages posted on an event 's wall.
The most important thing is when the post is shown on the event's wall "it does not show that its posted by a Facebook Application".
This is very dangerous; For example I can make an application and post nonsense on a user's wall. People will think that this is posted by the user.
Thank you so much for creating this question
For posting a photo to an event it seems to be a FB bug, subscribe and up the repo count so it gets attention
https://developers.facebook.com/bugs/225316074217855?browse=search_4f2f7576c5bc32d87041759