facebookfacebook-graph-apifacebook-messengerfacebook-messenger-bot

Messenger Bot for comments


I am trying to make bot using facebook messenger api. My bot is working perfectly for direct messages. Now i want to add a feature called comment bot. Like when someone comments on my page post. I would like my bot to reply to the person. I added a webhook url for feeds. When some one comments in a post i get a respone similar to the following:

{"changes":[{"field":"feed","value":{"item":"comment","sender_name":"6sense","comment_id":"127569201201434_137925500165804","sender_id":126557694635918,"post_id":"126557694635918_127569201201434","verb":"add","parent_id":"12655769463
5918_127569201201434","created_time":1507031347,"message":".."}}],"id":"126557694635918","time":1507031349}

Now from that webhook, i am trying to reply back to user using the sender_id. But i am getting a long error which is in short

{ error: 
{ message: '(#100) No matching user found',
type: 'OAuthException',
code: 100,
error_subcode: 2018001,
fbtrace_id: 'EmEDxfdcnyF' } } }

I saw some sites implementing this feature. So i guess its possible. But i am not sure why its not working. I am using the same app for this.


Solution

  • Try private_replies API with comment_id to send private replies to user.

    To use this API you need read_page_mailboxes permission.