{"_id":"59b7dd468c45630028f07852","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":"57a9ce2fac6db30e000d7efd","__v":0,"project":"54eb50e5615ffc1900305a16","version":"54eb63b859b1172100334fae","sync":{"url":"","isSync":false},"reference":true,"createdAt":"2016-08-09T12:35:59.736Z","from_sync":false,"order":8,"slug":"push-messages","title":"Push messages"},"user":"5947ca9b7d5c65000fe8a707","__v":0,"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-09-12T13:12:38.655Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":true,"order":16,"body":"We have covered in detail how to [Send Push notifications](doc:send-push-notifications) over an API. When it comes to the reception of incoming messages from your subscribers you can choose between two basic methods:\n\n  * **HTTP forward method** - allows you to receive incoming messages from your subscribers in real time\n  * **Pull method** - allows you to fetch new messages from Infobip's server over an API whenever you want\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Incoming messages setup\",\n  \"body\": \"Before you can start receiving messages you need to configure for incoming messages.\\nYou can find instructions on how to setup each scenario in the [Configuration documentation](/docs/configuration-push).\\nIt's up to you which method to use, depending on your use case.\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"HTTP forward method\"\n}\n[/block]\nIf you wish to receive incoming messages in real time you should use this method.\n\nIn order to receive forwarded incoming messages, you will have to set up a unique web address on your own web server able to receive a POST request. Every message we receive from your subscriber will be forwarded to the URL you provided in the [Action setup](/docs/action-push).\n\nExample of a forwarded message:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"results\\\": [\\n    {\\n      \\\"messageId\\\": \\\"1561984815238926404\\\",\\n      \\\"pairedMessageId\\\": \\\"1234984815238926403\\\",\\n      \\\"from\\\": \\\"69827EDB-A806-4AF6-A7F6-98298EAA4F14\\\",\\n      \\\"subscriberId\\\":\\\"123\\\",\\n      \\\"to\\\": \\\"233623e3c860b49ec69a464834343481-8bj4el4a-256d-23fd-56ad-b5bc3d568b53\\\",\\n      \\\"applicationCode\\\": \\\"233623e3c860b49ec69a464834343481-8bj4el4a-256d-23fd-56ad-b5bc3d568b53\\\",\\n      \\\"receivedAt\\\": \\\"2017-01-05T12:47:56.221+0000\\\",\\n      \\\"callbackData\\\": \\\"callbackData\\\",\\n      \\\"text\\\": \\\"KEYWORD text\\\",\\n      \\\"cleanText\\\": \\\"text\\\",\\n      \\\"keyword\\\": \\\"KEYWORD\\\",\\n      \\\"customPayload\\\":{\\n        \\\"key1\\\":1,\\n        \\\"key2\\\":2\\n      }\\n    }\\n  ],\\n  \\\"messageCount\\\": 1,\\n  \\\"pendingMessageCount\\\": 0\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"get\",\n  \"title\": \"Pull method\"\n}\n[/block]\nAll messages received from your subscribers will be received on the Infobip platform and will be there until you decide to access them. Accessing them is pretty much straight forward. All you need to do is make a simple API call which will return the received messages.\n\nRequest example: \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"GET /push/1/inbox/reports HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nAccept: application/json\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nResponse\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"results\\\": [\\n    {\\n      \\\"messageId\\\": \\\"1561984815238926404\\\",\\n      \\\"pairedMessageId\\\": \\\"1234984815238926403\\\",\\n      \\\"from\\\": \\\"69827EDB-A806-4AF6-A7F6-98298EAA4F14\\\",\\n      \\\"subscriberId\\\":\\\"123\\\",\\n      \\\"to\\\": \\\"233623e3c860b49ec69a464834343481-8bj4el4a-256d-23fd-56ad-b5bc3d568b53\\\",\\n      \\\"applicationCode\\\": \\\"233623e3c860b49ec69a464834343481-8bj4el4a-256d-23fd-56ad-b5bc3d568b53\\\",\\n      \\\"receivedAt\\\": \\\"2017-01-05T12:47:56.221+0000\\\",\\n      \\\"callbackData\\\": \\\"callbackData\\\",\\n      \\\"text\\\": \\\"KEYWORD text\\\",\\n      \\\"cleanText\\\": \\\"text\\\",\\n      \\\"keyword\\\": \\\"KEYWORD\\\",\\n      \\\"customPayload\\\":{\\n        \\\"key1\\\":1,\\n        \\\"key2\\\":2\\n      }\\n    }\\n  ],\\n  \\\"messageCount\\\": 1,\\n  \\\"pendingMessageCount\\\": 0\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Important\",\n  \"body\": \"All received messages can be pulled **only one time**! Once a certain message has been pulled by this method, it will not be available in the next API call. This means that every time you make an API call, you will only see the messages received since the last API request you made.\"\n}\n[/block]","excerpt":"Receive incoming Push messages from your subscribers","slug":"receive-push-message","type":"basic","title":"Receive Push message"}

Receive Push message

Receive incoming Push messages from your subscribers

We have covered in detail how to [Send Push notifications](doc:send-push-notifications) over an API. When it comes to the reception of incoming messages from your subscribers you can choose between two basic methods: * **HTTP forward method** - allows you to receive incoming messages from your subscribers in real time * **Pull method** - allows you to fetch new messages from Infobip's server over an API whenever you want [block:callout] { "type": "warning", "title": "Incoming messages setup", "body": "Before you can start receiving messages you need to configure for incoming messages.\nYou can find instructions on how to setup each scenario in the [Configuration documentation](/docs/configuration-push).\nIt's up to you which method to use, depending on your use case." } [/block] [block:api-header] { "type": "basic", "title": "HTTP forward method" } [/block] If you wish to receive incoming messages in real time you should use this method. In order to receive forwarded incoming messages, you will have to set up a unique web address on your own web server able to receive a POST request. Every message we receive from your subscriber will be forwarded to the URL you provided in the [Action setup](/docs/action-push). Example of a forwarded message: [block:code] { "codes": [ { "code": "{\n \"results\": [\n {\n \"messageId\": \"1561984815238926404\",\n \"pairedMessageId\": \"1234984815238926403\",\n \"from\": \"69827EDB-A806-4AF6-A7F6-98298EAA4F14\",\n \"subscriberId\":\"123\",\n \"to\": \"233623e3c860b49ec69a464834343481-8bj4el4a-256d-23fd-56ad-b5bc3d568b53\",\n \"applicationCode\": \"233623e3c860b49ec69a464834343481-8bj4el4a-256d-23fd-56ad-b5bc3d568b53\",\n \"receivedAt\": \"2017-01-05T12:47:56.221+0000\",\n \"callbackData\": \"callbackData\",\n \"text\": \"KEYWORD text\",\n \"cleanText\": \"text\",\n \"keyword\": \"KEYWORD\",\n \"customPayload\":{\n \"key1\":1,\n \"key2\":2\n }\n }\n ],\n \"messageCount\": 1,\n \"pendingMessageCount\": 0\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "get", "title": "Pull method" } [/block] All messages received from your subscribers will be received on the Infobip platform and will be there until you decide to access them. Accessing them is pretty much straight forward. All you need to do is make a simple API call which will return the received messages. Request example: [block:code] { "codes": [ { "code": "GET /push/1/inbox/reports HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nAccept: application/json", "language": "json" } ] } [/block] Response [block:code] { "codes": [ { "code": "{\n \"results\": [\n {\n \"messageId\": \"1561984815238926404\",\n \"pairedMessageId\": \"1234984815238926403\",\n \"from\": \"69827EDB-A806-4AF6-A7F6-98298EAA4F14\",\n \"subscriberId\":\"123\",\n \"to\": \"233623e3c860b49ec69a464834343481-8bj4el4a-256d-23fd-56ad-b5bc3d568b53\",\n \"applicationCode\": \"233623e3c860b49ec69a464834343481-8bj4el4a-256d-23fd-56ad-b5bc3d568b53\",\n \"receivedAt\": \"2017-01-05T12:47:56.221+0000\",\n \"callbackData\": \"callbackData\",\n \"text\": \"KEYWORD text\",\n \"cleanText\": \"text\",\n \"keyword\": \"KEYWORD\",\n \"customPayload\":{\n \"key1\":1,\n \"key2\":2\n }\n }\n ],\n \"messageCount\": 1,\n \"pendingMessageCount\": 0\n}", "language": "json" } ] } [/block] [block:callout] { "type": "warning", "title": "Important", "body": "All received messages can be pulled **only one time**! Once a certain message has been pulled by this method, it will not be available in the next API call. This means that every time you make an API call, you will only see the messages received since the last API request you made." } [/block]