3

Weird behavior.

I've setup a bot for the new Facebook Messenger and it is working. But now, it just triggers the webhook post method when I click at the buttons that the bot sent. If I send a simple text message through fb messenger it doesn't trigger (If I send it manually using postman for example it works).

So, when the post receives this, it works:

{  
   "object":"page",
   "entry":[  
      {  
         "id":"526506374188753",
         "time":1476539505993,
         "messaging":[  
            {  
               "recipient":{  
                  "id":"123123123123"
               },
               "timestamp":1476539505993,
               "sender":{  
                  "id":"123123123123"
               },
               "postback":{  
                  "payload":"someparameterId"
               }
            }
         ]
      }
   ]
}

If fb messenger sends this, it doesn't reach my post webhook method.

{  
   "object":"page",
   "entry":[  
      {  
         "id":"526506374188753",
         "time":1475591255490,
         "messaging":[  
            {  
               "sender":{  
                  "id":"123123123123"
               },
               "recipient":{  
                  "id":"123123123123"
               },
               "timestamp":1475591255378,
               "message":{  
                  "mid":"mid.1475591255319:16b11b18bd2174bf78",
                  "seq":141,
                  "text":"hi bot!"
               }
            }
         ]
      }
   ]
}

Any idea?

tanmay
  • 7,761
  • 2
  • 19
  • 38
Mr. Ott
  • 311
  • 1
  • 4
  • 12
  • Are you trying to send messages from owner's account or some other? If it's not approved for audience by messenger reviewers (yet), it won't be available to accounts other than owner. – tanmay Oct 20 '16 at 17:28
  • @tanmay I'm sending to my account. I'm admin of the bot and the fanpage. I reenter the webhook verification but so far, didn't figure out. My next move will be to create a new app from scratch on facebook developer. Let you know – Mr. Ott Oct 21 '16 at 19:51
  • try to follow [this](https://github.com/jw84/messenger-bot-tutorial) if you weren't already – tanmay Oct 22 '16 at 03:03
  • check your logic for `req.body.entry[0].messaging[i].message.text` – Arbaz Siddiqui Dec 17 '16 at 08:25

1 Answers1

3

This can be fixed by subscribing to the page. ScreenShot

When you subscribe to the page, you will receive all the event from that page which you have checked - message_deliveries, messages, messaging_optins, messaging_postbacks,etc. to your webhook url.