Facebook FB messenger复选框消息“选项向用户发送消息”参考“id不工作”;您不能将消息发送到此id";

Facebook FB messenger复选框消息“选项向用户发送消息”参考“id不工作”;您不能将消息发送到此id";,facebook,facebook-graph-api,facebook-messenger,Facebook,Facebook Graph Api,Facebook Messenger,我试图在客户下订单后向他们发送一条消息,如果他们在结账页面上检查FB Messenger复选框插件 我已经一步一步的跟随这个插件的FB文档 在我想尝试将消息发送到我之前定义的用户\u ref\u id之前,一切都很好,并且都可以正常工作,但它刚刚向我抛出了错误 { "error": { "message": "(#100) Parameter error: You cannot send messages to this id"

我试图在客户下订单后向他们发送一条消息,如果他们在结账页面上检查FB Messenger复选框插件

我已经一步一步的跟随这个插件的FB文档

在我想尝试将消息发送到我之前定义的
用户\u ref\u id
之前,一切都很好,并且都可以正常工作,但它刚刚向我抛出了错误

{
"error": {
    "message": "(#100) Parameter error: You cannot send messages to this id",
    "type": "OAuthException",
    "code": 100,
    "fbtrace_id": "Aev08w-rkwIfurCKj79g2R0"
}
我成功地接收到了webhook
消息选项,如下所示

{
"value": {
    "object": "page",
    "entry": [{
        "id": "xxxxx",
        "time": 1617868589319,
        "messaging": [{
            "recipient": {
                "id": "xxxxx"
            },
            "timestamp": 1617868589319,
            "optin": {
                "ref": "test=haha",
                "user_ref": "2020092411511430212"
            }
        }]
    }]
}
我已经检查了我的
app\u id
page\u id
是否正确,我还使用了从FB developer Messenger部分生成的
access\u令牌

这是我发送信息的代码

$messageData = [
        "recipient" => [
            "id" => '202009241151143024'
        ],
        "message" => [
            "text" => 'hello'
        ]
    ];
    $ch = curl_init('https://graph.facebook.com/v2.6/me/messages?access_token=xxx');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HEADER, false);
    curl_setopt($ch, CURLOPT_HTTPHEADER, ["Content-Type: application/json"]);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($messageData));
    $result = curl_exec($ch);
    curl_exec($ch);
我不知道错误在哪里,或者我在设置时跳过了某个步骤


提前谢谢。

我已经发现了我的错误

当我试图向客户发送消息时,我使用
id
而不是
user\u ref

这是发送信息时的更正代码

$messageData = [
    "recipient" => [
        "user_ref" => '202009241151143024'
    ],
    "message" => [
        "text" => 'hello'
    ]
];
$ch = curl_init('https://graph.facebook.com/v2.6/me/messages?access_token=xxx');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Content-Type: application/json"]);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($messageData));
$result = curl_exec($ch);
curl_exec($ch);

告诉我们您实际上是如何发送邮件的。@CBroe当我试图发送邮件时,我只是用代码更新了帖子。非常感谢。