0
votes

I am trying to make a Facebook messenger bot. In this bot I wanted to send quick-replies to the user send a quick reply to the user. And I am getting this error.

 my code is.

function sendQuickReplys(userId){

request({
    url : 'https://graph.facebook.com/v2.6/me/messages',
    qs : {access_token:PAGE_ACESS_TOKEN},
    method: 'POST',
    "recipient": {
        "id": userId
    },
    "message": {
        
        "quick_replies": [
            {
                "content_type":"text",
                "title": "OK",
                "payload": "OKPAYLOAD"
            }
        ]
    }
    

}, function(err,res,body){
    if(err){
        console.log("Error sending q-Message", err);
    }else if(res.body.error) {
        console.log('"Error: ', res.body.error);
    }else {
        console.log(body);
    }
});
};

For this I am getting this error.

{"error":{"message":"(#100) The parameter recipient is required","type":"OAuthException","code":100,"fbtrace_id":"HGGNvUpESk1"}}
1

1 Answers

0
votes

Your options object has a syntax error, so you aren't actually sending the body of the request. You need the 'body' property before your Json.