{"_id":"56eadcacd25d831700006ab2","__v":8,"version":{"_id":"55208137623ff50d009b2bef","__v":14,"project":"55208137623ff50d009b2bec","createdAt":"2015-04-05T00:26:31.564Z","releaseDate":"2015-04-05T00:26:31.563Z","categories":["55208138623ff50d009b2bf0","55494a226a82a10d00817ae5","55494ba7ee219b0d001743c8","55494bc1ee219b0d001743cc","56ead8c1df765617008bccaf","573a2073dd007d1700cf288f","579695b1f64c9f0e007cd76c","57969e3dfa1ff60e006a1274","579a4592fd9f3c0e008e4f4a","57ab9afe54fa780e006c5430","57b784f5b7ebd60e009cb4a6","58f686818193090f008cec76","59e79fbd4cf31900341d50c6","5b2436973fd93f0003dcf99d"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"category":{"_id":"56ead8c1df765617008bccaf","__v":6,"pages":["56ead8d02aac471700fb1a6d","56eadcacd25d831700006ab2","56eadf90d25d831700006aba","56eae54988fd9d290012c898","56eae7f3c760370e0037ab20","56eaef34df765617008bccc5"],"project":"55208137623ff50d009b2bec","version":"55208137623ff50d009b2bef","sync":{"url":"","isSync":false},"reference":true,"createdAt":"2016-03-17T16:18:09.231Z","from_sync":false,"order":5,"slug":"facebook-messenger","title":"Facebook Messenger"},"parentDoc":null,"project":"55208137623ff50d009b2bec","githubsync":"","user":"55208129504fd6230022ae20","updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-03-17T16:34:52.978Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":true,"order":2,"body":"The first thing you'll need to do is [turn on Webhooks within Sonar](https://www.sendsonar.com/?modal=CustomWebhook) so you receive information when new things happen in Messenger.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/CI8d2S4TAumtXcqgvNfg_Screen%20Shot%202016-03-17%20at%209.33.41%20AM.png\",\n        \"Screen Shot 2016-03-17 at 9.33.41 AM.png\",\n        \"1150\",\n        \"1144\",\n        \"#04b4fc\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Messages\"\n}\n[/block]\nFor all send/received Facebook messages, you'll receive a webhook like usual but with an additional property of type.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n 'action'    => 'new_assigned_message',\\n 'text'      => 'hello',\\n 'type'      => 'FBMessage',\\n 'direction' => 'received',\\n 'from_name' => 'Joe Customer',\\n 'link'      => customer.customer_full_url,\\n 'media_url' => 'https://www.google.com',\\n 'customer' => {\\n   'first_name'   => 'Joe',\\n   'last_name'    => 'Customer',\\n   'phone_number' => '',\\n   'fb_id'    => '1234',\\n   'email'    => '1234:::at:::facebook.sendsonar.com'\\n\\t}\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Receive Facebook Message Webhook\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"webhooks-for-messenger","type":"basic","title":"Webhooks for Messenger"}

Webhooks for Messenger


The first thing you'll need to do is [turn on Webhooks within Sonar](https://www.sendsonar.com/?modal=CustomWebhook) so you receive information when new things happen in Messenger. [block:image] { "images": [ { "image": [ "https://files.readme.io/CI8d2S4TAumtXcqgvNfg_Screen%20Shot%202016-03-17%20at%209.33.41%20AM.png", "Screen Shot 2016-03-17 at 9.33.41 AM.png", "1150", "1144", "#04b4fc", "" ] } ] } [/block] [block:api-header] { "type": "basic", "title": "Messages" } [/block] For all send/received Facebook messages, you'll receive a webhook like usual but with an additional property of type. [block:code] { "codes": [ { "code": "{\n 'action' => 'new_assigned_message',\n 'text' => 'hello',\n 'type' => 'FBMessage',\n 'direction' => 'received',\n 'from_name' => 'Joe Customer',\n 'link' => customer.customer_full_url,\n 'media_url' => 'https://www.google.com',\n 'customer' => {\n 'first_name' => 'Joe',\n 'last_name' => 'Customer',\n 'phone_number' => '',\n 'fb_id' => '1234',\n 'email' => '1234@facebook.sendsonar.com'\n\t}\n}", "language": "json", "name": "Receive Facebook Message Webhook" } ] } [/block]