function processComments()

in inter-page/marketing-bot/app.js [66:89]


function processComments(comment) {
    let comment_id;
    if (comment.item == 'post') {
        comment_id = comment.post_id;
    } else if (comment.item == 'comment') {
        comment_id = comment.comment_id;
    }
    console.log("id: " + comment_id);
    let encode_message = encodeURIComponent(comment.message);
    let message_body = `Thank you for your question, to better assist you I am passing you to our support department. Click the link below to be transferred. https://m.me/acmeincsupport?ref=${encode_message}`;
    let request_body = {
        "message": message_body
    };
    request({
        "uri": `https://graph.facebook.com/v2.12/${comment_id}/private_replies`,
        "qs": {"access_token": access_token},
        "method": "POST",
        "json": request_body
    }, (err, res) => {
        if (!err) {
            console.log("Private reply sent");
        }
    });
}