I'm currently using the Facebook Developer Toolkit to publish to my organization's Facebook page. I'd like to be able to attach a link, but can't quite seem to开发者_运维问答 figure out the syntax. Here's what I'm trying.
ConnectSession fbSession = new ConnectSession(API_KEY, API_SECRET);
Api fbApi = new Api(fbSession);
attachment attach = new attachment();
attach.href = "http://www.google.com";
attach.caption = "Google";
attach.name = "Google";
String post = "Here's a cool new search engine I found!";
fbApi.Stream.Publish(post, attach, null, null, Convert.ToInt64(fanPageId));
Here's what I'm going for:
- Don't use that the Facebook Developer Toolkit because it's not being properly supported (personal opinion :P) use the FacebookC#SDK
- What you want to post are referred to as 'action_links' and can only be posted using the OLD REST API, not the new graph api (https://api.facebook.com/method/stream.publish)
In order to post it you need to encode the JSON in the form:
action_links: [ { text: "TITLE", href: "LINK"} ]
精彩评论