Search code examples
webhooksfacebook-messengerchatbotfacebook-chatbot

Facebook Messenger webhook gets triggered by button click but not from text message


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?


Solution

  • 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.