I will do my best to explain the problem I am having. When I am using the bot from my own FB account, everything works fine.
But when I ask others to use it, the bot does not respond to them, although I have got green tick on pages_messaging in dev.FB.
Basic sendText function which makes the bot write a reply:
function sendText(sender, text){
let messageData = {text : text}
console.log("comes here too" + " message data: " +messageData);
request({
url: "https://graph.facebook.com/v2.6/me/messages",
qs : {access_token : token},
method: "POST",
json: {
recipient : {id: sender},
message : messageData
}
}, function(error, response, body){
if ( error){
console.log("sending error")
} else if(response.body.error){
console.log("messageData: " + messageData + "recipient " + sender)
console.log("response body error" + response + " body "+body)
}
})
}
The errors I am getting then some-one else is trying to connect to bot: I am getting the following with my 3 console.logs that go through:
comes here too message data: [object Object]
messageData: [object Object]recipient (MyOtherAccountIDIsHere)
response body error[object Object] body [object Object]
My Initial thought is that bot-review did not work properly and the page actually is not approved. Since on my developer FB account, I get to chat to the bot normally w/o any problems (last else if with 2 console.logs does not appear)
Please, let me know what do you think, willing to provide any additional information if needed.
SO SILLY mistake from me. Thank you @CBroe for your help.
The answer: I had to go to App Review Tab and click the Make appID public? YES!