Saturday, 15 April 2017

Send private message to page

I'm trying to explore something about Facebook-api and node.js. I know what I want but I can't find proper literature so please help me out.

I have a Facebook page and I have front-end html page with sockets + back-end node.js. On front-end I have text box. The idea is that I want to send whatever is in that text box to my page as a private message.

I know You can send message to a friend but I'm nut sure what to put as ID if You want to send a message to Yourself or page.

Using facebook-chat-api.

socket.on("REQ fmsgsend", function(mailData){
    facebook({email: "FB_EMAIL", password: "FB_PASSWORD"}, (err, api) => {
        if(err) return console.error(err);
        api.sendMessage(message.body, message.threadID);
    });
});

I would put text box string in message.body but I'm not sure how to detect thread ID. Am I going wrong way?



via AVoid

No comments:

Post a Comment