0

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.

OFFLlNE
  • 747
  • 1
  • 8
  • 17
  • Replace `+` with `,` in your console.log and show us result – ponury-kostek Feb 23 '17 at 10:48
  • @ponury-kostek I got tons of lines with the comma http://pastebin.com/zEZwnNBg I guess this is the LINE that matters there: { error: 2017-02-23T10:52:53.768364+00:00 app[web.1]: { message: '(#10) Cannot message users who are not admins, developers or testers of the app until pages_messaging permission is reviewed and the app is live.',... – OFFLlNE Feb 23 '17 at 10:55
  • BUT How is this possible, if I have a green light in developers.FB [Imgur link to the proof](http://i.imgur.com/cGnC1AC.png) – OFFLlNE Feb 23 '17 at 11:00
  • 1
    Debug the access token here https://developers.facebook.com/tools/debug/accesstoken/ to make sure it belongs to the correct app id. – CBroe Feb 23 '17 at 12:07
  • @CBroe access token does match with the profile ID of the page I am trying to apply the bot to. (OwlBowl) Under App ID I have the app ID from where I posted the image on my previous comment. And the review team also managed to type to bot with getting valid response. Should I delete that App ID and create a new one maybe? – OFFLlNE Feb 23 '17 at 12:33
  • 1
    No, don’t delete anything prematurely :) Your app is set live, yes? Not still in development mode? – CBroe Feb 23 '17 at 12:47
  • @CBroe Do I have to click somewhere to push it live? I thought it can be live and in development mode simultaneously :O In my opinion when they have given a green light after the review, the bot goes live itself, no? – OFFLlNE Feb 23 '17 at 13:00
  • 1
    No, those two things have nothing to do with each other. You need to set your app live, otherwise it can not interact with normal users at all. You need to toggle the switch on the top of the App Review tab. – CBroe Feb 23 '17 at 13:13

1 Answers1

0

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!

OFFLlNE
  • 747
  • 1
  • 8
  • 17