Facebook link posting through Graph API - facebook

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.

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

Posting using App Access Token

I am trying to publish a feed using graph API using application access token. I am trying to achieve a result similar to the one in the URL below:
Sample Image
I am able to create a feed but following two things I am still unable to figure out:
1) Linking the text in the feed to my application. Currently by clicking on the picture tag or name tag the user is redirected to the external link of the image (used in picture tag)
2) As you will notice in the image there is custom link button next to Comment. One says "Bonus Cash" and other says "Get Simoleons". How to do that?
I am currently using following graph api code. And in order to test it I am currently using Graph Api Explorer.
http://graph.facebook.com/myfbid/feed?&picture=http://www.link.com/linktoimage.jpg&name=Name Tag&caption=Caption Tag&description=Description Tag
If I add link tag to the above code than the type of feed changes from "via Application Name" to "shared a link via Application Name" and that is not what I want to achieve. I want it to say "via Application Name" like it is for other applications like i shared in the image above.
1) Linking the text in the feed to my application. Currently by clicking on the picture tag or name tag the user is redirected to the external link of the image (used in picture tag)
If you want a post to link somewhere – then actually post a link (parameter), and not only a picture.
Edit:
The “posts” in your screenshot might be Open Graph actions published for the user, though. That’s a completely different concept altogether; start reading about it here: https://developers.facebook.com/docs/opengraph/
2) As you will notice in the image there is custom link button next to Comment. One says "Bonus Cash" and other says "Get Simoleons". How to do that?
Use the actions parameter.
Both are explained in the docs: https://developers.facebook.com/docs/reference/api/user/#posts

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.

Using Facebook Feed dialog URL to share is not updating the share count

When I'm using the URL:
https://www.facebook.com/dialog/feed?app_id=&caption=Blah&link=http%3A%2F%2Fwww.mypages.com%2Ffoobar%2Ffoo%3Fsource%3Dblah&name=foo+bar+foo&picture=http%3A%2F%2Fm411e3u2y.cloudfront.net%2Fscal00d000220%2F75db140db50acf1ee2d70ce7b2f06036.jpg&redirect_uri=http%3A%2F%2Fwww.facebook.com
It shares the Link with the correct link, image caption etc. but getting the count using
http://graph.facebook.com/?id=http%3A%2F%2Fwww.mypages.com%2Ffoobar%2Ffoo%3Fsource%3Dblah does not update the share count. Whereas the share count is updated if I copy/paste the same URL in facebook, or send a FB message or use the Like Button widget.
I'm trying to get the equivalent URL to turn the feed dialog url to Like URL.
Any clues?
This is an old post, but "share count" is from the share button that shows up with the like button. Unfortunately making a custom one with the Fb.ui feed dialog isn't related or counted in this number, it's not "smart" like that.

Feed Dialog with Page Feed

on my webpage I have integrated the Feed Dialog using the JavaScript SDK. It works all like a charm, except when I'm using Facebook as a page.
I get this error message:
You are using Facebook as myPage
To access this page, you'll need to switch from using Facebook as your page to using Facebook as yourself.
I already tried to change the from and to parameters, but with no luck.
Is there any way to post a story on a page with the Feed Dialog?
Unfortunately this dialog is not supported when you are using Facebook as a Page. Please use Graph API -> Post (https://developers.facebook.com/docs/reference/api/post/)
You can in fact do this. Just follow the instructions as it says and switch to using Facebook as yourself.
Then when you share as yourself, you can choose to share it to a "Page you manage" using the dropdown in the top-left.