开发者

Facebook publish to stream and attach link

开发者 https://www.devze.com 2023-01-15 06:15 出处:网络
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

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:

Facebook publish to stream and attach link


  1. Don't use that the Facebook Developer Toolkit because it's not being properly supported (personal opinion :P) use the FacebookC#SDK
  2. 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)
  3. In order to post it you need to encode the JSON in the form:

    action_links: [ { text: "TITLE", href: "LINK"} ]

0

精彩评论

暂无评论...
验证码 换一张
取 消