{"_id":"5947dfe1524b9a000fb7d50e","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-06-19T14:29:53.082Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":true,"order":15,"body":"Sending Push messages is usually a simple task but it can get more complicated when working with complex destination addresses or targeting users in multiple segments through a single API call. In order to avoid sending a notification to the wrong segment we have created a method where you can **simulate** a Push notification send request and therefore observe the affected number of recipient devices in the response without sending an actual notification. If the result is satisfactory you can proceed to sending actual notifications, knowing exactly what to expect.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Note\",\n  \"body\": \"You can implement this method in your system to **show a preview** of the target audience number, **raise an alarm**, or **activate a fail-safe mechanism** if the number greatly exceeds the average notification volumes.\"\n}\n[/block]\nMethods:\n\n* [Simple Push notifications.](#simple-push-notifications)\n* [Bulk Push notifications.](#bulk-push-notifications)\n[block:api-header]\n{\n  \"title\": \"Simple Push notifications\"\n}\n[/block]\nUse this method to verify your requests while sending PUSH messages.\n\n###Request format\n\n|Parameter|Type|Description|\n|-|-|-|\n|*from*|String|PUSH Application Code you are using to send messages.|\n|*to*|object|[Recipient destination address.](https://dev.infobip.com/docs/send-push-notifications#section-recipient-destination-address-types)|.\n|*text*|String|Text of the message that will be sent.|\n|*sendAt*|datetime|Used to send PUSH notifications at scheduled time.|\n|*customPayload*|object|Additional JSON data that can be delivered with the PUSH message.|\n|*notificationOptions*|object|[JSON object that contains notification options.](https://dev.infobip.com/docs/send-push-notifications#section-notification-options)|\n\nRequest example:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"POST /push/2/message/single/test HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nContent-Type: application/json\\nAccept: application/json\\n\\n{\\n    \\\"from\\\": \\\"d417d38814740a23f50b5c876e226445-0f700564-abbf-4b5b-beae-86a4ef410904\\\",\\n    \\\"to\\\": {\\n        \\\"externalUserId\\\": \\\"customer_21234\\\"\\n    },\\n    \\\"text\\\": \\\"This Message was sent by targeting exact externalUserId.\\\",\\n    \\\"notificationOptions\\\": {\\n      \\\"soundEnabled\\\": false,\\n      \\\"badge\\\": 1\\n    },\\n    \\\"customPayload\\\":{\\n      \\\"targetUrl\\\": \\\"www.someDomain.com\\\",\\n      \\\"someData\\\": \\\"someData\\\"\\n   }\\n}\\n\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nResponse:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"bulks\\\": [\\n    {\\n      \\\"to\\\": {\\n         \\\"externalUserId\\\": \\\"customer_21234\\\"\\n      },\\n      \\\"status\\\": {\\n        \\\"groupId\\\": 1,\\n        \\\"groupName\\\": \\\"PENDING\\\",\\n        \\\"id\\\": 26,\\n        \\\"name\\\": \\\"PENDING_ACCEPTED\\\",\\n        \\\"description\\\": \\\"Message accepted, pending for delivery\\\"\\n      },\\n      \\\"messageCount\\\": 2\\n    }\\n  ]\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nIf successful, the response header HTTP status code will be 200 OK.\nIf you try to send the message without authorization, you will receive a 401 Unauthorized error.\nIf the request is incorrectly formatted the HTTP status code will be 400 Bad Request.\n\n###Response format\n\n|Parameter|Type|Description|\n|-|-|-|\n|*to*|object|[Recipient destination address.](https://dev.infobip.com/docs/send-push-notifications#section-recipient-destination-address-types)|\n|*status*|object|Message status.|\n|*messageCount*|integer|Number of recipients for targeted segment.|\n\nStatus:\n\n|Parameter|Type|Description|\n|-|-|-|\n|*groupId*|int|Status [group ID](https://dev.infobip.com/v1/docs/response-codes#api-status-codes).|\n|*groupName*|String|Status [group name](https://dev.infobip.com/v1/docs/response-codes#api-status-codes).|\n|*id*|int|Status [ID](https://dev.infobip.com/v1/docs/response-codes#api-status-codes).|\n|*name*|String|Status [name](https://dev.infobip.com/v1/docs/response-codes#api-status-codes).|\n|*description*|String|Human readable [description](https://dev.infobip.com/v1/docs/response-codes#api-status-codes) of the status.|\n[block:api-header]\n{\n  \"title\": \"Bulk Push notifications\"\n}\n[/block]\nUse this method to verify your requests while sending bulk Push messages.\n\n###Request format\n\n|Parameter|Type|Description|\n|-|-|-|\n|*messages*|object|Collection of Push notifications. Each message in the collection is completely independent. Different values may be used for each notification, such as \"sender application\" or \"message text\".|\n\nMessages:\n\n|Parameter|Type|Description|\n|-|-|-|\n|*from*|String|PushApplication Code you are using to send messages.|\n|*to*|object|[Recipient destination address.](https://dev.infobip.com/docs/send-bulk-push-notifications#section-recipient-destination-address-types)|.\n|*text*|String|Text of the message that will be sent.|\n|*sendAt*|datetime|Used to send Push notifications at scheduled time.|\n|*customPayload*|object|Additional JSON data that can be delivered with the Push message.|\n|*notificationOptions*|object|[JSON object that contains notification options.](https://dev.infobip.com/docs/send-bulk-push-notifications#section-notification-options).|\n\nRequest example:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"POST /push/2/message/multi/test HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nContent-Type: application/json\\nAccept: application/json\\n\\n{\\n\\t\\\"messages\\\": [\\n\\t\\t{\\n    \\t\\t\\\"from\\\": \\\"d417d38814740a23f50b5c876e226445-0f700564-abbf-4b5b-beae-86a4ef410904\\\",\\n    \\t\\t\\\"to\\\": {\\n        \\t\\t\\\"externalUserId\\\": \\\"customer_21234\\\"\\n    \\t\\t},\\n    \\t\\t\\\"text\\\": \\\"This message can be one of many in this message collection.\\\",\\n    \\t\\t\\\"notificationOptions\\\": {\\n    \\t\\t\\t\\\"soundEnabled\\\": false,\\n    \\t\\t\\t\\\"badge\\\": 1\\n    \\t\\t},\\n\\t  \\t\\t\\\"customPaylod\\\":{\\n  \\t\\t\\t\\t\\\"targetUrl\\\": \\\"www.someDomain.com\\\",\\n\\t \\t\\t\\t\\t\\\"someData\\\": \\\"someData\\\"\\n\\t \\t\\t}\\n\\t\\t},\\n\\t\\t{\\n\\t\\t    \\\"from\\\": \\\"c297d38814740a23f50b5c876e226445-0f700564-abbf-4b5b-beae-86a4ef410904\\\",\\n\\t\\t    \\\"to\\\": {\\n        \\t\\t\\\"externalUserId\\\": \\\"customer_113456\\\"\\n\\t\\t    },\\n\\t\\t    \\\"text\\\": \\\"This is the second message in this collection.\\\",\\n\\t\\t    \\\"notificationOptions\\\": {\\n\\t\\t    \\t\\\"soundEnabled\\\": false\\n\\t\\t    }\\n\\t\\t}\\n\\t]\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nResponse:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"bulks\\\": [\\n    {\\n      \\\"to\\\": {\\n        \\\"externalUserId\\\": \\\"customer_21234\\\"\\n      },\\n      \\\"status\\\": {\\n        \\\"groupId\\\": 1,\\n        \\\"groupName\\\": \\\"PENDING\\\",\\n        \\\"id\\\": 26,\\n        \\\"name\\\": \\\"PENDING_ACCEPTED\\\",\\n        \\\"description\\\": \\\"Message accepted, pending for delivery\\\"\\n      },\\n      \\\"messageCount\\\": 2\\n    },\\n    {\\n      \\\"to\\\": {\\n        \\\"externalUserId\\\": \\\"customer_113456\\\"\\n      },\\n      \\\"status\\\": {\\n        \\\"groupId\\\": 1,\\n        \\\"groupName\\\": \\\"PENDING\\\",\\n        \\\"id\\\": 26,\\n        \\\"name\\\": \\\"PENDING_ACCEPTED\\\",\\n        \\\"description\\\": \\\"Message accepted, pending for delivery\\\"\\n      },\\n      \\\"messageCount\\\": 2\\n    }\\n  ]\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nIf successful, the response header HTTP status code will be 200 OK.\nIf you try to send the message without authorization, you will receive a 401 Unauthorized error.\nIf the request is incorrectly formatted the HTTP status code will be 400 Bad Request.\n\n###Response format\n\n|Parameter|Type|Description|\n|-|-|-|\n|*bulks*|object|Collection of bulks of sent messages.|\n\nBulk:\n\n|Parameter|Type|Description|\n|-|-|-|\n|*to*|object|[Recipient destination address](https://dev.infobip.com/docs/send-bulk-push-notifications#section-recipient-destination-address-types).|\n|*status*|object|Message status.|\n|*messageCount*|integer|Number of recipients for targeted segment.|\n\nStatus:\n\n|Parameter|Type|Description|\n|-|-|-|\n|*groupId*|int|Status [group ID](https://dev.infobip.com/v1/docs/response-codes#api-status-codes).|\n|*groupName*|String|Status [group name](https://dev.infobip.com/v1/docs/response-codes#api-status-codes).|\n|*id*|int|Status [ID](https://dev.infobip.com/v1/docs/response-codes#api-status-codes).|\n|*name*|String|Status [name](https://dev.infobip.com/v1/docs/response-codes#api-status-codes).|\n|*description*|String|Human readable [description](https://dev.infobip.com/v1/docs/response-codes#api-status-codes) of the status.|","excerpt":"These methods allow you to verify the destination address for Push notification messages. You can also use these methods to identify the number of subscribers that will be targeted according to the provided parameters.","slug":"test-push-notifications-before-sending","type":"basic","title":"Test Push notifications before sending"}

Test Push notifications before sending

These methods allow you to verify the destination address for Push notification messages. You can also use these methods to identify the number of subscribers that will be targeted according to the provided parameters.

Sending Push messages is usually a simple task but it can get more complicated when working with complex destination addresses or targeting users in multiple segments through a single API call. In order to avoid sending a notification to the wrong segment we have created a method where you can **simulate** a Push notification send request and therefore observe the affected number of recipient devices in the response without sending an actual notification. If the result is satisfactory you can proceed to sending actual notifications, knowing exactly what to expect. [block:callout] { "type": "info", "title": "Note", "body": "You can implement this method in your system to **show a preview** of the target audience number, **raise an alarm**, or **activate a fail-safe mechanism** if the number greatly exceeds the average notification volumes." } [/block] Methods: * [Simple Push notifications.](#simple-push-notifications) * [Bulk Push notifications.](#bulk-push-notifications) [block:api-header] { "title": "Simple Push notifications" } [/block] Use this method to verify your requests while sending PUSH messages. ###Request format |Parameter|Type|Description| |-|-|-| |*from*|String|PUSH Application Code you are using to send messages.| |*to*|object|[Recipient destination address.](https://dev.infobip.com/docs/send-push-notifications#section-recipient-destination-address-types)|. |*text*|String|Text of the message that will be sent.| |*sendAt*|datetime|Used to send PUSH notifications at scheduled time.| |*customPayload*|object|Additional JSON data that can be delivered with the PUSH message.| |*notificationOptions*|object|[JSON object that contains notification options.](https://dev.infobip.com/docs/send-push-notifications#section-notification-options)| Request example: [block:code] { "codes": [ { "code": "POST /push/2/message/single/test HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nContent-Type: application/json\nAccept: application/json\n\n{\n \"from\": \"d417d38814740a23f50b5c876e226445-0f700564-abbf-4b5b-beae-86a4ef410904\",\n \"to\": {\n \"externalUserId\": \"customer_21234\"\n },\n \"text\": \"This Message was sent by targeting exact externalUserId.\",\n \"notificationOptions\": {\n \"soundEnabled\": false,\n \"badge\": 1\n },\n \"customPayload\":{\n \"targetUrl\": \"www.someDomain.com\",\n \"someData\": \"someData\"\n }\n}\n", "language": "json" } ] } [/block] Response: [block:code] { "codes": [ { "code": "{\n \"bulks\": [\n {\n \"to\": {\n \"externalUserId\": \"customer_21234\"\n },\n \"status\": {\n \"groupId\": 1,\n \"groupName\": \"PENDING\",\n \"id\": 26,\n \"name\": \"PENDING_ACCEPTED\",\n \"description\": \"Message accepted, pending for delivery\"\n },\n \"messageCount\": 2\n }\n ]\n}", "language": "json" } ] } [/block] If successful, the response header HTTP status code will be 200 OK. If you try to send the message without authorization, you will receive a 401 Unauthorized error. If the request is incorrectly formatted the HTTP status code will be 400 Bad Request. ###Response format |Parameter|Type|Description| |-|-|-| |*to*|object|[Recipient destination address.](https://dev.infobip.com/docs/send-push-notifications#section-recipient-destination-address-types)| |*status*|object|Message status.| |*messageCount*|integer|Number of recipients for targeted segment.| Status: |Parameter|Type|Description| |-|-|-| |*groupId*|int|Status [group ID](https://dev.infobip.com/v1/docs/response-codes#api-status-codes).| |*groupName*|String|Status [group name](https://dev.infobip.com/v1/docs/response-codes#api-status-codes).| |*id*|int|Status [ID](https://dev.infobip.com/v1/docs/response-codes#api-status-codes).| |*name*|String|Status [name](https://dev.infobip.com/v1/docs/response-codes#api-status-codes).| |*description*|String|Human readable [description](https://dev.infobip.com/v1/docs/response-codes#api-status-codes) of the status.| [block:api-header] { "title": "Bulk Push notifications" } [/block] Use this method to verify your requests while sending bulk Push messages. ###Request format |Parameter|Type|Description| |-|-|-| |*messages*|object|Collection of Push notifications. Each message in the collection is completely independent. Different values may be used for each notification, such as "sender application" or "message text".| Messages: |Parameter|Type|Description| |-|-|-| |*from*|String|PushApplication Code you are using to send messages.| |*to*|object|[Recipient destination address.](https://dev.infobip.com/docs/send-bulk-push-notifications#section-recipient-destination-address-types)|. |*text*|String|Text of the message that will be sent.| |*sendAt*|datetime|Used to send Push notifications at scheduled time.| |*customPayload*|object|Additional JSON data that can be delivered with the Push message.| |*notificationOptions*|object|[JSON object that contains notification options.](https://dev.infobip.com/docs/send-bulk-push-notifications#section-notification-options).| Request example: [block:code] { "codes": [ { "code": "POST /push/2/message/multi/test HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nContent-Type: application/json\nAccept: application/json\n\n{\n\t\"messages\": [\n\t\t{\n \t\t\"from\": \"d417d38814740a23f50b5c876e226445-0f700564-abbf-4b5b-beae-86a4ef410904\",\n \t\t\"to\": {\n \t\t\"externalUserId\": \"customer_21234\"\n \t\t},\n \t\t\"text\": \"This message can be one of many in this message collection.\",\n \t\t\"notificationOptions\": {\n \t\t\t\"soundEnabled\": false,\n \t\t\t\"badge\": 1\n \t\t},\n\t \t\t\"customPaylod\":{\n \t\t\t\t\"targetUrl\": \"www.someDomain.com\",\n\t \t\t\t\t\"someData\": \"someData\"\n\t \t\t}\n\t\t},\n\t\t{\n\t\t \"from\": \"c297d38814740a23f50b5c876e226445-0f700564-abbf-4b5b-beae-86a4ef410904\",\n\t\t \"to\": {\n \t\t\"externalUserId\": \"customer_113456\"\n\t\t },\n\t\t \"text\": \"This is the second message in this collection.\",\n\t\t \"notificationOptions\": {\n\t\t \t\"soundEnabled\": false\n\t\t }\n\t\t}\n\t]\n}", "language": "json" } ] } [/block] Response: [block:code] { "codes": [ { "code": "{\n \"bulks\": [\n {\n \"to\": {\n \"externalUserId\": \"customer_21234\"\n },\n \"status\": {\n \"groupId\": 1,\n \"groupName\": \"PENDING\",\n \"id\": 26,\n \"name\": \"PENDING_ACCEPTED\",\n \"description\": \"Message accepted, pending for delivery\"\n },\n \"messageCount\": 2\n },\n {\n \"to\": {\n \"externalUserId\": \"customer_113456\"\n },\n \"status\": {\n \"groupId\": 1,\n \"groupName\": \"PENDING\",\n \"id\": 26,\n \"name\": \"PENDING_ACCEPTED\",\n \"description\": \"Message accepted, pending for delivery\"\n },\n \"messageCount\": 2\n }\n ]\n}", "language": "json" } ] } [/block] If successful, the response header HTTP status code will be 200 OK. If you try to send the message without authorization, you will receive a 401 Unauthorized error. If the request is incorrectly formatted the HTTP status code will be 400 Bad Request. ###Response format |Parameter|Type|Description| |-|-|-| |*bulks*|object|Collection of bulks of sent messages.| Bulk: |Parameter|Type|Description| |-|-|-| |*to*|object|[Recipient destination address](https://dev.infobip.com/docs/send-bulk-push-notifications#section-recipient-destination-address-types).| |*status*|object|Message status.| |*messageCount*|integer|Number of recipients for targeted segment.| Status: |Parameter|Type|Description| |-|-|-| |*groupId*|int|Status [group ID](https://dev.infobip.com/v1/docs/response-codes#api-status-codes).| |*groupName*|String|Status [group name](https://dev.infobip.com/v1/docs/response-codes#api-status-codes).| |*id*|int|Status [ID](https://dev.infobip.com/v1/docs/response-codes#api-status-codes).| |*name*|String|Status [name](https://dev.infobip.com/v1/docs/response-codes#api-status-codes).| |*description*|String|Human readable [description](https://dev.infobip.com/v1/docs/response-codes#api-status-codes) of the status.|