小编Ami*_*udi的帖子

Facebook发送api - 无法使用用户ID发送消息

当我从https://developers.facebook.com/docs/messenger-platform/send-api-reference执行以下请求时

curl -X POST -H "Content-Type: application/json" -d '{
  "recipient":{
    "id":"USER_ID"
  },
  "message":{
    "text":"hello, world!"
  }
}' "https://graph.facebook.com/v2.6/me/messages?access_token=PAGE_ACCESS_TOKEN"
Run Code Online (Sandbox Code Playgroud)

我收到此错误:

Graph returned an error: (#100) Parameter recipient[id]: Invalid id: "the id of the recipient"
Run Code Online (Sandbox Code Playgroud)

文件指出:

id必须是通过Messenger入口点或Messenger webhooks检索的ID(例如,某人可能会在Messenger中发现您的业务并从那里开始对话.这些ID是页面范围的ID(PSID).这意味着ID对于给定页面是唯一的.如果您具有现有的Facebook登录集成,则用户ID是应用范围的,不适用于Messenger平台.

我不明白从哪里获取id.有人可以解释如何获取API中使用的ID吗?

php api curl facebook facebook-graph-api

5
推荐指数
1
解决办法
4481
查看次数

标签 统计

api ×1

curl ×1

facebook ×1

facebook-graph-api ×1

php ×1