{"_id":"582973b66a1d1f0f00b94484","category":{"_id":"58172386715dce0f00da4aa0","project":"54eb50e5615ffc1900305a16","version":"54eb63b859b1172100334fae","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-10-31T10:57:10.541Z","from_sync":false,"order":14,"slug":"facebook-messages","title":"Facebook messenger"},"version":{"_id":"54eb63b859b1172100334fae","project":"54eb50e5615ffc1900305a16","forked_from":"54eb63a1867e1917009b711d","__v":27,"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"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1"},"__v":0,"project":"54eb50e5615ffc1900305a16","parentDoc":null,"user":"54eb4fdedf7add210007b29b","updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-11-14T08:20:06.268Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":7,"body":"People can discover and enter into a conversation with you from a number of different places or entry points.\n  * If your app is Public, you can be discovered through the Search field in Messenger\n  * By clicking on the \"Send Message\" button on your Facebook page\n  * By scanning your Messenger Code by using their mobile phone camera\n  * By clicking on your Messenger Link with the format https://m.me/PAGE_USERNAME\n  * Through our 'Send To Messenger' or 'Message Us' web plugins\n  * Phone number (Customer Matching)\n\nWhen registering the user is assigned unique `key`. These keys are page-scoped IDs (PSID) which means that the keys are unique for a given page.\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Warning\",\n  \"body\": \"If you have an existing[ Facebook Login](https://developers.facebook.com/docs/facebook-login) integration, user IDs are app-scoped and will not work with the Messenger platform.\"\n}\n[/block]\nIn order retrieve User data, the Application must first be created on the Infobip's platform.\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/a6fba69-fb5.PNG\",\n        \"fb5.PNG\",\n        312,\n        90,\n        \"#f36c2c\"\n      ]\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"User Key\",\n  \"body\": \"User `key` is used as a recipient address when [sending messages over API](/docs/send-single-facebook-messenger-message).\"\n}\n[/block]\nAvailable methods\n* [List all users](#list-all-users) \n* [Get a single user](#get-single-user) \n[block:api-header]\n{\n  \"type\": \"get\",\n  \"title\": \"List all users\"\n}\n[/block]\nThis method allows you to get Facebook users of your application.\n```\nhttps://api.infobip.com/facebook/2/applications/{applicationKey}/users\n```\n\n###Path params\n\n|Parameter|Type|Default value|Description|\n|-|-|-|\n|applicationKey|string|-|Application key|\n\n###Query params\n\n|Parameter|Type|Default value|Description|\n|-|-|-|\n|limit|integer|10000|Number of users in the response. Max is 10000.|\n\n###Request example\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"GET /facebook/2/applications/8F0792F86035A9F4290821F1EE6BC06A/users HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n###Response\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"users\\\":[\\n    {\\n      \\\"key\\\": \\\"37512FEC78DBC1895567B09AE6D9439328C12E83BC83D449BC4A9F32F1AE3C3A\\\",\\n      \\\"msisdn\\\": \\\"125128146\\\",\\n      \\\"userDetails\\\": {\\n        \\\"firstName\\\": \\\"John\\\",\\n        \\\"lastName\\\": \\\"Doe\\\",\\n        \\\"gender\\\": \\\"male\\\"\\n      }\\n    }\\n  ]\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nOn success, the response header HTTP status code will be `200 OK`. \n\n|Parameter|Type|Description|\n|-|-|-|\n|*users*|String|List or users.|\n|*key*|String|User key.|\n|*msisdn*|String|Phone number (optional).|\n|*userDetails.firstName*|String|First name of the user (optional).|\n|*userDetails.lastName*|String|Last name of the user (optional).|\n|*userDetails.gender*|String|Gender of the user (optional).|\n\nOn error, you will receive an [error response status code](/docs/response-codes#section-chat-error-codes). If you try to create an application when you do not have the user’s authorization, you will receive a `401` Unauthorized error.\n[block:api-header]\n{\n  \"type\": \"get\",\n  \"title\": \"Get a single user\"\n}\n[/block]\nThis method allows you to get a single facebook user.\n\n```\nhttps://api.infobip.com/facebook/2/applications/{applicationKey}/users/{userKey}\n```\n\n###Path params\n\n|Parameter|Type|Default value|Description|\n|-|-|-|\n|applicationKey|string|-|Application key|\n|userKey|string|-|User key.|\n\n###Request example\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"GET /facebook/2/applications/8F0792F86035A9F4290821F1EE6BC06A/users/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n###Response\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"key\\\": \\\"37512FEC78DBC1895567B09AE6D9439328C12E83BC83D449BC4A9F32F1AE3C3A\\\",\\n  \\\"msisdn\\\": \\\"125128146\\\",\\n  \\\"userDetails\\\": {\\n    \\\"firstName\\\": \\\"John\\\",\\n    \\\"lastName\\\": \\\"Smith\\\",\\n    \\\"gender\\\": \\\"male\\\"\\n  }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nOn success, the response header HTTP status code will be `200 OK`. \n\n|Parameter|Type|Description|\n|-|-|-|\n|*key*|String|User key.|\n|*msisdn*|String|Phone number (optional).|\n|*userDetails.firstName*|String|First name of the user (optional).|\n|*userDetails.lastName*|String|Last name of the user (optional).|\n|*userDetails.gender*|String|Gender of the user (optional).|\n\n\nOn error, you will receive an [error response status code](/docs/response-codes#section-chat-error-codes). If you try to create an application when you do not have the user’s authorization, you will receive a `401` Unauthorized error.","excerpt":"User represents a Facebook end user who is engaging in a conversation with your organization.","slug":"facebook-messenger-user","type":"basic","title":"User"}

User

User represents a Facebook end user who is engaging in a conversation with your organization.

People can discover and enter into a conversation with you from a number of different places or entry points. * If your app is Public, you can be discovered through the Search field in Messenger * By clicking on the "Send Message" button on your Facebook page * By scanning your Messenger Code by using their mobile phone camera * By clicking on your Messenger Link with the format https://m.me/PAGE_USERNAME * Through our 'Send To Messenger' or 'Message Us' web plugins * Phone number (Customer Matching) When registering the user is assigned unique `key`. These keys are page-scoped IDs (PSID) which means that the keys are unique for a given page. [block:callout] { "type": "warning", "title": "Warning", "body": "If you have an existing[ Facebook Login](https://developers.facebook.com/docs/facebook-login) integration, user IDs are app-scoped and will not work with the Messenger platform." } [/block] In order retrieve User data, the Application must first be created on the Infobip's platform. [block:image] { "images": [ { "image": [ "https://files.readme.io/a6fba69-fb5.PNG", "fb5.PNG", 312, 90, "#f36c2c" ] } ] } [/block] [block:callout] { "type": "info", "title": "User Key", "body": "User `key` is used as a recipient address when [sending messages over API](/docs/send-single-facebook-messenger-message)." } [/block] Available methods * [List all users](#list-all-users) * [Get a single user](#get-single-user) [block:api-header] { "type": "get", "title": "List all users" } [/block] This method allows you to get Facebook users of your application. ``` https://api.infobip.com/facebook/2/applications/{applicationKey}/users ``` ###Path params |Parameter|Type|Default value|Description| |-|-|-| |applicationKey|string|-|Application key| ###Query params |Parameter|Type|Default value|Description| |-|-|-| |limit|integer|10000|Number of users in the response. Max is 10000.| ###Request example [block:code] { "codes": [ { "code": "GET /facebook/2/applications/8F0792F86035A9F4290821F1EE6BC06A/users HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==", "language": "json" } ] } [/block] ###Response [block:code] { "codes": [ { "code": "{\n \"users\":[\n {\n \"key\": \"37512FEC78DBC1895567B09AE6D9439328C12E83BC83D449BC4A9F32F1AE3C3A\",\n \"msisdn\": \"125128146\",\n \"userDetails\": {\n \"firstName\": \"John\",\n \"lastName\": \"Doe\",\n \"gender\": \"male\"\n }\n }\n ]\n}", "language": "json" } ] } [/block] On success, the response header HTTP status code will be `200 OK`. |Parameter|Type|Description| |-|-|-| |*users*|String|List or users.| |*key*|String|User key.| |*msisdn*|String|Phone number (optional).| |*userDetails.firstName*|String|First name of the user (optional).| |*userDetails.lastName*|String|Last name of the user (optional).| |*userDetails.gender*|String|Gender of the user (optional).| On error, you will receive an [error response status code](/docs/response-codes#section-chat-error-codes). If you try to create an application when you do not have the user’s authorization, you will receive a `401` Unauthorized error. [block:api-header] { "type": "get", "title": "Get a single user" } [/block] This method allows you to get a single facebook user. ``` https://api.infobip.com/facebook/2/applications/{applicationKey}/users/{userKey} ``` ###Path params |Parameter|Type|Default value|Description| |-|-|-| |applicationKey|string|-|Application key| |userKey|string|-|User key.| ###Request example [block:code] { "codes": [ { "code": "GET /facebook/2/applications/8F0792F86035A9F4290821F1EE6BC06A/users/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==", "language": "json" } ] } [/block] ###Response [block:code] { "codes": [ { "code": "{\n \"key\": \"37512FEC78DBC1895567B09AE6D9439328C12E83BC83D449BC4A9F32F1AE3C3A\",\n \"msisdn\": \"125128146\",\n \"userDetails\": {\n \"firstName\": \"John\",\n \"lastName\": \"Smith\",\n \"gender\": \"male\"\n }\n}", "language": "json" } ] } [/block] On success, the response header HTTP status code will be `200 OK`. |Parameter|Type|Description| |-|-|-| |*key*|String|User key.| |*msisdn*|String|Phone number (optional).| |*userDetails.firstName*|String|First name of the user (optional).| |*userDetails.lastName*|String|Last name of the user (optional).| |*userDetails.gender*|String|Gender of the user (optional).| On error, you will receive an [error response status code](/docs/response-codes#section-chat-error-codes). If you try to create an application when you do not have the user’s authorization, you will receive a `401` Unauthorized error.