Facebook Graph API 帖子及其附件未显示在动态消息中

发布于 2024-10-20 23:28:41 字数 142 浏览 1 评论 0原文

我尝试了多种使用 Graph API 向 Facebook 发帖的方法,但在创建附件未显示在动态消息中的帖子时遇到问题。

如果我只发布一条短信,它就会显示在动态消息中。任何有附件的东西都只能挂在墙上。

有谁知道这是什么原因以及如何解决它?

I tried a number of methods of posting to Facebook using Graph API and I have a problem with creating a post with attachments not showing up in the News Feed.

If I post just a text message, it shows up in the News Feed. Anything that has an attachment goes only to the wall.

Does anyone have an idea on what is the cause of this and how to fix it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

烟凡古楼 2024-10-27 23:28:41

我不知道问题的原因是什么,但我通过使用新 ID 创建一个新的 Facebook 应用程序解决了这个问题。只发布到墙上的相同脚本开始发布到新 App ID 上的新闻源。

I have no idea what was the cause of the issue, but I resolved it by creating a new Facebook App, with new ID. The same scripts that only posted to the wall started posting to the news feed on the new App ID.

峩卟喜欢 2024-10-27 23:28:41

我认为这是因为您正在向提要添加附件或链接。

根据 http://developers.facebook.com/docs/fbjs/streamPublish/

他们说:

更新用户的状态

您可以使用此方法来简单地更新用户的状态。当您执行此操作时,状态消息将显示在用户个人资料的顶部以及“朋友”>“朋友”页面上。状态更新页面。该消息还会与您的应用程序图标一起显示在流中。

要使用此方法设置用户状态,请执行以下操作:

* Do not include an attachment or action link. If you do, the story will get published and will appear in the stream and on the user's Wall only. It won't appear at the top of the profile or in the Status Updates page.
* Make sure the message is no longer than 420 characters. Otherwise, an error gets returned.

I think it's because you're adding attachement or a link to your feed.

As per http://developers.facebook.com/docs/fbjs/streamPublish/

they say :

Updating a User's Status

You can use this method to simply update a user's status. When you do so, the status message appears at the top of the user's profile and on the Friends > Status Updates page. The message also appears in the stream with your application icon.

To use this method to set a user's status do the following:

* Do not include an attachment or action link. If you do, the story will get published and will appear in the stream and on the user's Wall only. It won't appear at the top of the profile or in the Status Updates page.
* Make sure the message is no longer than 420 characters. Otherwise, an error gets returned.
梦屿孤独相伴 2024-10-27 23:28:41

我知道这是一篇旧帖子,但我遇到了同样的问题并且解决了。由于这篇文章没有有效的答案,而且它出现在我在谷歌中的许多搜索中,我想我会添加答案。

这里发生的主要问题是在 https://developers.facebook.com 中创建的应用程序和访问令牌的权限问题

您可以在墙上GETPOST附件,但您必须首先授予用户访问令牌访问它的权限。你可以这样做。

1.前往 FB 上的申请
输入图片此处描述

2.单击“Graph API 探索”
输入图片此处描述

3.单击“获取用户访问令牌”
输入图片此处描述

4.点击 user_photos 和 user_videos
这里有很多选项,但要获取基本附件(通常是照片和视频),您只需选择这两个附件,但您可以添加任意数量的附件。在此处输入图像描述

点击获取访问权限后底部的令牌要保存它,您必须使用密码登录,然后授予您帐户的访问令牌权限。完成此操作后,您现在可以如何获得访问提要附件(照片和视频)的权限。

这是 Graph API 输出的样子,显示提要中的图片在此处输入图像描述

现在请记住这一点这是一个短期访问令牌,可持续大约一个小时,然后将停止工作。你必须将此令牌转换为永久令牌,让我为你节省时间,因为我编写了一个 php 函数,它将从你的短暂令牌一次性生成 v2 的永久令牌.9

在这里查看我的帖子回复
facebook:永久页面访问令牌?

I know this is an old post but I was having the same issue and I resolved it. Since there wasn't a valid answer to this post and it came up in many of my searches in Google I thought I would add the answer.

The main issue that is happening here is a permissions issue with the App and Access Token created in https://developers.facebook.com.

You can both GET and POST attachements on a wall but you have to give the Users Access Token the permission to access it in the first place. You can do it like this.

1. Go to your application on FB
enter image description here

2. Click on Graph API Explore
enter image description here

3. Click on Get User Access Token
enter image description here

4. Click on user_photos and user_videos
There are many options here but to get the basic attachements which tend to be photos and video you can just select those two, but you can add as many as you want.enter image description here

After clicking Get Access Token at the bottom to save it you have to login with your password then give your access toke permission for your account. Once you have done that you now how permission to access your feed attachements (photos and videos)

Here is what the Graph API output looks like showing the picture from the feedenter image description here

Now keep this in mind this is a Short Lived Access Token which lasts about an hour and it will stop working. You have to convert this token to a permanent token and let me save you the time you will bang your head trying to figure that out because I wrote a php function that will generate your permanent token from your short lived token all in one shot for v2.9

Check out my post reply here
facebook: permanent Page Access Token?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文