Quick reply on Messenger in NodeJS

Viewed 76

I have a problem with my chatbot on Messenger. I followed this documentation on Facebook Developper to make my chatbot and YouTube videos.

I try to put quick reply when a user sends me starts the conversation but the problem is that I can't receive the question text and the quick reply (either on the admin or client side).

I have already tested to see if the code was not working by replacing the quick reply with a text message and I was getting the text message. But when it comes to the quick reply, it doesn't work anymore. I don't receive the message. Moreover, I do not add any other message after sending this one. In the server logs, I have no error message when the quick reply passes.

Here is the function I use. All versions are updated.

return new Promise( async (resolve, reject) => {
        try {
            let request_body = {
                "recipient": {
                    "id": sender_psid,
                },
                "messaging_type": "RESPONSE",
                "message": {
                    "text": "Pick a color:",
                    "quick_replies":[
                        {
                            "content_type": "text",
                            "title": "Red",
                            "payload": "POSTBACK_PAYLOAD_1",
                        }, {
                            "content_type": "text",
                            "title": "Green",
                            "payload": "POSTBACK_PAYLOAD_2",
                        }
                    ],
                },
            }
            request({
                "uri": `https://graph.facebook.com/v14.0/me/messages?access_token=${PAGE_ACCESS_TOKEN}`,
                "method": "POST",
                "json": request_body
            }, (err, res, body) => {
                if (!err) {
                    resolve("done");
                } else {
                    reject(err);
                }
            });
            resolve();
        } catch (e) {
            reject(e);
        }
    })

On Messenger, I have activated several subscriptions from my webhook. Messenger Webhook Abonnement

I would like to know how I can add quick reply to my chat?

0 Answers
Related