如何通过Graph API在Facebook帖子中嵌入链接 [英] How to embed a link in a Facebook post through the Graph API

查看:137
本文介绍了如何通过Graph API在Facebook帖子中嵌入链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想代表用户发布一条消息,其中包含指向另一个Facebook页面的链接.通过选择页面的自动完成名称,可以通过Facebook界面轻松实现以下目的:

I want to post in behalf of the user a message that contains a link to another Facebook page. Something that is easily achievable through Facebook interface by choosing an autocompleted name of the page:

我将红宝石和考拉宝石一起使用.我试图做这样的事情:

I use Ruby with the koala gem. I tried to do something like this:

graph = Koala::Facebook::API.new(access_token)
graph.put_object(page_id, "feed", message: "Embedded @[23497828950:National Geographic] link")

但它不会转换链接.我可以发布完整的URL,但这看起来不太好.

but it doesn't convert the link. I could post a full URL but that doesn't look as nice.

是否可以通过Graph API实现与Facebook(链接的页面标题)相同的事情?

Is there a way to achieve the same thing as on Facebook (a linked page title) through the Graph API?

推荐答案

这只能使用 打开图形操作 .

This can only be accomplished using the Open Graph Actions.

POST /me/cookbook:eat?
     recipe=http://www.example.com/recipes/pizza/&
     message=You should really try this recipe from @[115401158528672]&
     access_token=VALID_ACCESS_TOKEN

如果您不了解Open Graph API,则可以从此处开始: https://developers .facebook.com/docs/opengraph/

If you are not aware of Open Graph API, you can start from here: https://developers.facebook.com/docs/opengraph/

只需按照教程中提到的步骤进行操作,即可轻松集成它们并使您的故事更加优美.

Just follow the steps mentioned in the tutorial, quite easy to integrate and make your stories more beautiful.

这篇关于如何通过Graph API在Facebook帖子中嵌入链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆