{"_id":"5954bc8af69664001546f00b","project":"54eb50e5615ffc1900305a16","version":{"_id":"54eb63b859b1172100334fae","project":"54eb50e5615ffc1900305a16","forked_from":"54eb63a1867e1917009b711d","__v":28,"createdAt":"2015-02-23T17:30:32.501Z","releaseDate":"2015-02-23T17:30:32.501Z","categories":["54eb63b959b1172100334faf","54eb63b959b1172100334fb0","54eb63b959b1172100334fb1","54eb63b959b1172100334fb2","54ed8dd4ab373e2300f50eae","54ed99b2ab373e2300f50ede","55153a6de68daa2f00cff838","551546edbc466623002afe72","5515472ac28d6125001b8884","55154749c28d6125001b8885","555d9b4106dfec0d00d38ea7","5613e06e433e5735007c7708","5624bbb785a31117001c5403","56669e857cc81e0d00253f8e","568b8d837a42220d00498311","56a632277ef6620d00e2f18a","56d8147c3eb4dd0b00201aac","57a9ce2fac6db30e000d7efd","57a9cf4e944ea60e00dc3f74","58172386715dce0f00da4aa0","582dc59ee1b8692300c0dd03","589b19b4fec2730f0082e040","58b04a023529383900a759b5","58b92d1598157a0f004869bf","592e7685c58275000f20174f","59392839e376d4002f8a0474","59393064e376d4002f8a05a1","5947ae0d4005e2000f3a4fec","594a74df1d1de5001ab3517a","5954bc387a147f001b918915","59b8eeeb707542001076d3b6"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1"},"category":{"_id":"5954bc387a147f001b918915","project":"54eb50e5615ffc1900305a16","version":"54eb63b859b1172100334fae","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2017-06-29T08:37:12.853Z","from_sync":false,"order":7,"slug":"omni-chat","title":"OMNI Chat"},"user":"57a98d832242630e00cc8df7","__v":0,"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-06-29T08:38:34.422Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"settings":"","results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":2,"body":"With almost 2 billion of active users worldwide, Facebook integration will enable your business to have a global reach. \nBy using the same platform where your users are already communicating with their friends and family, you will be present where your customers already are.\n\nIt’s a great way to interact with your customers - if you want to engage them with content or provide additional services in order to provide an excellent customer experience.\n\nIt will create communication that is more personal, building a strong relationship with your brand.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Facebook page\"\n}\n[/block]\n**Facebook pages** are used by brands, businesses, organizations and public figures to create a presence on Facebook, whereas profiles represent individual people. Anyone with an account can create a Page or help in managing one if they have a role of page admin or editor. If you don't have a Facebook page yet, you can create one [here](https://www.facebook.com/pages/create).\n\nFacebook users can use **Facebook messenger** to contact your organization through your Facebook page.\n\nAssuming that you already have your organization page up and running, you are ready to start with the setup steps listed below.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Facebook Application setup\"\n}\n[/block]\n1. Visit https://developers.facebook.com/apps and create a new Application. \n2. Name it and click **Create App ID** and select category **Messenger**. You should end up on application dashboard.\n3. In Token Generation section select your page and new **Page Access Token** will be generated\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/09f7bf1-page_access_token.PNG\",\n        \"page_access_token.PNG\",\n        1410,\n        748,\n        \"#4a5367\"\n      ],\n      \"sizing\": \"full\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Page Access Token\",\n  \"body\": \"Copy and save your **Page Access Token** somewhere convenient as you will need it in next steps.\"\n}\n[/block]\n4. Obtain the **App secret** by clicking on the `Show` button and **App ID**\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/acbe074-app.PNG\",\n        \"app.PNG\",\n        1411,\n        301,\n        \"#52505e\"\n      ],\n      \"sizing\": \"full\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"App secret and App ID\",\n  \"body\": \"Copy and save your **App secret** and **App ID** somewhere convenient as you will need it in next steps.\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Integration setup\"\n}\n[/block]\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/0a75ff2-integration.png\",\n        \"integration.png\",\n        320,\n        98,\n        \"#e4dcd5\"\n      ]\n    }\n  ]\n}\n[/block]\nTo start sending messages over FB, first you need to register your FB application on Infobip's platform. This is done by adding the FB integration to the application you have already created [here](/docs/omni-chat-application). \n\nUse **Page Access Token** from the previous step as a value of `accessToken` parameter, **App secret** as a value of `secret` parameter and **App ID** as a value of `id` parameter.\n\n###Request example\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"POST /omnichat/1/applications/0F3C3F29829FAB88714BA205BEC6D28F/integrations/facebook HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nAccept: application/json\\n\\n{\\n  \\\"page\\\": {\\n    \\\"accessToken\\\": \\\"EAAXggzrE7uYBAM38UXko5vWxi98mZCgH2klIHSwd...\\\"\\n  },\\n  \\\"application\\\": {\\n    \\\"id\\\": 1654219114885622,\\n    \\\"secret\\\": \\\"cf074b2e96390b3600031c751d9bf590\\\"\\n  }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nResponse\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"page\\\": {\\n    \\\"accessToken\\\": \\\"EAAXggzrE7uYBAM38UXko5vWxi98mZCgH2klIHSwd...\\\"\\n  },\\n  \\\"application\\\": {\\n    \\\"id\\\": 1654219114885622,\\n    \\\"secret\\\": \\\"cf074b2e96390b3600031c751d9bf590\\\",\\n    \\\"name\\\": \\\"My application name\\\",\\n    \\\"imageUrl\\\": \\\"https://scontent.xx.fbcdn.net/t39...0696#_n.png\\\"\\n  }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n**That's it!** You are now ready to send test messages by using ['Send chat message API' method](/docs/omni-chat-send-message).\n\nEvery message we receive from your subscriber will be forwarded to the URL you provided and is described in more details in the [Receive message](/docs/omni-chat-receive-message) section.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"How can my organisation contact people over Facebook?\",\n  \"body\": \"People can register to receive information from you on Facebook by entering into a conversation with you from a number of different places or entry points. For more details see [here](https://developers.facebook.com/docs/messenger-platform/product-overview/entry-points).\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"body\": \"At this point the Facebook Messenger application is still in **test mode**, so only administrator and the testers specified under the **Roles** section in the left sidebar can actually use this Messenger integration.\\n\\nAt this point, you should apply for **Facebook approval** since it may take up to two weeks. Please find more details on how to get approved [here](https://developers.facebook.com/docs/messenger-platform/app-review).\",\n  \"title\": \"Test mode\"\n}\n[/block]","excerpt":"","slug":"omni-chat-facebook-integration","type":"basic","title":"Facebook Messenger integration"}

Facebook Messenger integration


With almost 2 billion of active users worldwide, Facebook integration will enable your business to have a global reach. By using the same platform where your users are already communicating with their friends and family, you will be present where your customers already are. It’s a great way to interact with your customers - if you want to engage them with content or provide additional services in order to provide an excellent customer experience. It will create communication that is more personal, building a strong relationship with your brand. [block:api-header] { "type": "basic", "title": "Facebook page" } [/block] **Facebook pages** are used by brands, businesses, organizations and public figures to create a presence on Facebook, whereas profiles represent individual people. Anyone with an account can create a Page or help in managing one if they have a role of page admin or editor. If you don't have a Facebook page yet, you can create one [here](https://www.facebook.com/pages/create). Facebook users can use **Facebook messenger** to contact your organization through your Facebook page. Assuming that you already have your organization page up and running, you are ready to start with the setup steps listed below. [block:api-header] { "type": "basic", "title": "Facebook Application setup" } [/block] 1. Visit https://developers.facebook.com/apps and create a new Application. 2. Name it and click **Create App ID** and select category **Messenger**. You should end up on application dashboard. 3. In Token Generation section select your page and new **Page Access Token** will be generated [block:image] { "images": [ { "image": [ "https://files.readme.io/09f7bf1-page_access_token.PNG", "page_access_token.PNG", 1410, 748, "#4a5367" ], "sizing": "full" } ] } [/block] [block:callout] { "type": "info", "title": "Page Access Token", "body": "Copy and save your **Page Access Token** somewhere convenient as you will need it in next steps." } [/block] 4. Obtain the **App secret** by clicking on the `Show` button and **App ID** [block:image] { "images": [ { "image": [ "https://files.readme.io/acbe074-app.PNG", "app.PNG", 1411, 301, "#52505e" ], "sizing": "full" } ] } [/block] [block:callout] { "type": "info", "title": "App secret and App ID", "body": "Copy and save your **App secret** and **App ID** somewhere convenient as you will need it in next steps." } [/block] [block:api-header] { "title": "Integration setup" } [/block] [block:image] { "images": [ { "image": [ "https://files.readme.io/0a75ff2-integration.png", "integration.png", 320, 98, "#e4dcd5" ] } ] } [/block] To start sending messages over FB, first you need to register your FB application on Infobip's platform. This is done by adding the FB integration to the application you have already created [here](/docs/omni-chat-application). Use **Page Access Token** from the previous step as a value of `accessToken` parameter, **App secret** as a value of `secret` parameter and **App ID** as a value of `id` parameter. ###Request example [block:code] { "codes": [ { "code": "POST /omnichat/1/applications/0F3C3F29829FAB88714BA205BEC6D28F/integrations/facebook HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nAccept: application/json\n\n{\n \"page\": {\n \"accessToken\": \"EAAXggzrE7uYBAM38UXko5vWxi98mZCgH2klIHSwd...\"\n },\n \"application\": {\n \"id\": 1654219114885622,\n \"secret\": \"cf074b2e96390b3600031c751d9bf590\"\n }\n}", "language": "json" } ] } [/block] Response [block:code] { "codes": [ { "code": "{\n \"page\": {\n \"accessToken\": \"EAAXggzrE7uYBAM38UXko5vWxi98mZCgH2klIHSwd...\"\n },\n \"application\": {\n \"id\": 1654219114885622,\n \"secret\": \"cf074b2e96390b3600031c751d9bf590\",\n \"name\": \"My application name\",\n \"imageUrl\": \"https://scontent.xx.fbcdn.net/t39...0696#_n.png\"\n }\n}", "language": "json" } ] } [/block] **That's it!** You are now ready to send test messages by using ['Send chat message API' method](/docs/omni-chat-send-message). Every message we receive from your subscriber will be forwarded to the URL you provided and is described in more details in the [Receive message](/docs/omni-chat-receive-message) section. [block:callout] { "type": "info", "title": "How can my organisation contact people over Facebook?", "body": "People can register to receive information from you on Facebook by entering into a conversation with you from a number of different places or entry points. For more details see [here](https://developers.facebook.com/docs/messenger-platform/product-overview/entry-points)." } [/block] [block:callout] { "type": "warning", "body": "At this point the Facebook Messenger application is still in **test mode**, so only administrator and the testers specified under the **Roles** section in the left sidebar can actually use this Messenger integration.\n\nAt this point, you should apply for **Facebook approval** since it may take up to two weeks. Please find more details on how to get approved [here](https://developers.facebook.com/docs/messenger-platform/app-review).", "title": "Test mode" } [/block]