如何将图像添加到 Facebook post 而无需在提要中获取图像两次?

How to add image to Facebook post without getting the image twice in the feed?

我正在尝试使用包含图像的图表 API 创建一个 post 到 Facebook 页面。我已经通过两步过程成功完成了:

  1. Post 到 'https://graph.facebook.com/PAGE_ID/photos?url=IMAGE_URL&access_token=ACCESS_TOKEN'
  2. 从 post 的 return 数据中获取图像 ID 并制作另一个 post 到 'https://graph.facebook.com/PAGE_ID/feed?published=true&message=MESSAGE_TEXT&object_attachment=IMAGE_ID&fields=permalink_url&access_token=ACCESS_TOKEN'

但是,当我这样做时,FB post 先将图像发送到页面,然后 post 发送包含图像的消息。不理想;我只想要一个带有消息和图像的 post。

然后我尝试保持图像未发布(将 &published=false 添加到我的图像 post)。这有助于防止图像在页面上 posting,我从 FB 收到带有图像 ID 的 OK 消息。但是,当我转到 post 带有图像的消息时,我收到了来自 FB API 的错误代码 (1 - "An unknown error occurred")。

我还尝试不发布图像并将其标记为临时图像(将 &published=false&temporary=true 添加到我的图像 post),结果相同。

有人知道如何在不先 post 将图像发送到 FB 页面的情况下 post 将带有图像的消息发送到页面吗?

您可以向图像 post 添加 caption

或者在创建 post 时将图像添加为表单数据。

您使用哪个框架?

no_story 参数可用于禁止为照片上传自动创建提要故事。

https://developers.facebook.com/docs/graph-api/reference/photo#Creating:

no_story
boolean
If set to true, this will suppress the News Feed story that is automatically generated on a profile when people upload a photo using your app. Useful for adding old photos where you may not want to generate a story