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

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":{}}

Related

Publishing links using Facebook graph API display feed as attachment on Facebook fan page

I am try to publish link on Facebook fan page using graph API but it displayed as attachment not as normal feed which display thumbnail.
Where as when I try to publish same link on users wall it display properly showing image thumbnail.
Can any one tell me why Facebook graph API work differently.
Feed publish on FB fan page :
Feed on user wall :
Thanks to all, I am finally able to solve this issue, the issue was I am using {page_id}/feed method to publish link for video and image, which displayed as attachment on Facebook fan page.
Solution : {page_id}/links with parameters [link, message, picture]
Pls provide params you include in request to facebook. Maybe providing params as shown in answer to following question helps, i.e. picture?
Posting an embedded video link using the Facebook Graph API

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.

Facebook Share Icon not visible for posts made through Graph API

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.

Facebook link posting through Graph API

I am trying to post link using Graph API. I am posting to https://graph.facebook.com/me/links. It is working as shown below. I want to do it similar to how Snip.it displays. I mean show "via Snip.it" in the bottom as shown in the figure below. If I keep the cursor on top of the link, a hover panel is also displayed.
Is it possible to do like that via Graph API? If not, how is Snip.it doing it?
By the way, If I post a link to feed url (https://graph.facebook.com/me/feed), I get the error "The post's links must direct to the application's connect or canvas URL.".
Through my app:
Through Snip.it:
You can use feed dialog mentioned in following link here. "snip it" is a Facebook app, in feed dialog you specify the app_id, by defining app_id Facebook will add "via" + "your app name" in each feed dialog.

Is it possible to use the Like Button Social plugin to like a feed from a landing page?

I have a Facebook feed that takes me to a landing page when I click on it. I want to be able to add Facebook's like plugin onto that landing page in order to like the feed I came from. This would be the equivalent of clicking like from the feed post itself. I don't know what to use for the data-href property in order to connect the like button to the feed.
I know the feed id and access_token and have tried the following:
https://graph.facebook.com/1608072154_362229823788663&access_token=...
http://www.facebook.com/1608072154/posts/362229823788663
So far I've only been able to like link urls and not the actual feed post.
Is what I'm trying to do even possible? and if so, how do I get the url?
Is what I'm trying to do even possible?
Yes it is possible, but not with the like plugin. I have a production app that pulls in a person's feed from multiple social networks including Facebook. I display a gray star for unliked content and a gold star for liked items. When the user clicks the gray star for a facebook item, I send an HTTP Post to the Graph API with /post_id/likes which likes it. If they click the gold star, then I send an HTTP DELETE to the /post_id/likes which removes it. See: https://developers.facebook.com/docs/reference/api/post/ and the "likes" create/delete section near the bottom.