{"_id":"59f3165eeba8cd00265b8409","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":"57b2fa958d94953200fd3182","__v":0,"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-10-27T11:19:58.826Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":true,"order":13,"body":"Unlike the [Getting delivery reports](doc:push-sent-messages-reports) API method, where the reports are pulled and received in the response, you are able to set a **Notify URL** on your callback server to which we will push the delivery reports.\n\nNotify URL is set as one of the parameters of the [Send push notifications](doc:send-push-notifications) or [Send bulk PUSH notifications](doc:send-bulk-push-notifications) API method.\n\nAs soon as the delivery reports for sent messages are received in the Infobip system, they will be forwarded to the specified Notify URL on your callback server. Besides the Notify URL, you can also specify **Notify Content Type** for delivery reports.\n\nSupported content types:\n\n- **`application/json`**\n- **`application/xml`**\n[block:api-header]\n{\n  \"title\": \"Example\"\n}\n[/block]\nThe example bellow shows how to set `notifyURL` and `notifyContentType` for the delivery report and the user's `callbackData`.\n\n###Send Push notification request\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"POST /push/2/message/single 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\\\": \\\"Message text\\\",\\n    \\\"notifyUrl\\\": \\\"http://example.com\\\",\\n    \\\"notifyContentType\\\" : \\\"application/json\\\",\\n    \\\"callbackData\\\" : \\\"Delivery report callback data\\\"\\n}\",\n      \"language\": \"json\",\n      \"name\": \"\"\n    }\n  ]\n}\n[/block]\n###Send Push notification response\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\\\": 1,\\n            \\\"bulkId\\\": \\\"czztgteet4fath2pclbq\\\"\\n        }\\n    ]\\n} \",\n      \"language\": \"json\",\n      \"name\": \"\"\n    }\n  ]\n}\n[/block]\nThe results you will receive on your Notify URL will be the same as [Getting delivery reports](doc:push-sent-messages-reports) over the API method, except the XML root element name which is the same for all reports - `<reportResponse>`.\n\n###Report\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n    \\\"results\\\": [{\\n        \\\"bulkId\\\": \\\"czztgteet4fath2pclbq\\\",\\n        \\\"price\\\": {\\n            \\\"pricePerMessage\\\": 0.000000,\\n            \\\"currency\\\": \\\"UNKNOWN\\\"\\n        },\\n        \\\"status\\\": {\\n            \\\"id\\\": 5,\\n            \\\"groupId\\\": 3,\\n            \\\"groupName\\\": \\\"DELIVERED\\\",\\n            \\\"name\\\": \\\"DELIVERED_TO_HANDSET\\\",\\n            \\\"description\\\": \\\"Message delivered to handset\\\"\\n        },\\n        \\\"error\\\": {\\n            \\\"id\\\": 0,\\n            \\\"name\\\": \\\"NO_ERROR\\\",\\n            \\\"description\\\": \\\"No Error\\\",\\n            \\\"groupId\\\": 0,\\n            \\\"groupName\\\": \\\"OK\\\",\\n            \\\"permanent\\\": false\\n        },\\n        \\\"messageId\\\": \\\"45653761-3a88-4060-869e-ae372adc7a51\\\",\\n        \\\"doneAt\\\": \\\"2017-10-27T10:20:08.562+0300\\\",\\n        \\\"messageCount\\\": 1,\\n        \\\"sentAt\\\": \\\"2017-10-27T10:20:07.197+0300\\\",\\n        \\\"callbackData\\\": \\\"{\\\\\\\"callbackData\\\\\\\":\\\\\\\"Delivery report callback data\\\\\\\",\\\\\\\"subscriberId\\\\\\\":\\\\\\\"customer_21234\\\\\\\"}\\\",\\n        \\\"to\\\": \\\"3fd5c8a4-ae57-46c1-be7a-31bb8a0a7fba\\\",\\n        \\\"channel\\\": \\\"PUSH\\\"\\n    }]\\n}\",\n      \"language\": \"json\",\n      \"name\": null\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"[Delivery report push retry cycle](doc:notify-url#section-delivery-report-push-retry-cycle)\\n[Delivery report sender IP addresses](doc:notify-url#section-delivery-report-sender-ip-addresses)\",\n  \"title\": \"USEFUL LINKS\"\n}\n[/block]","excerpt":"Receive Delivery reports and custom data on your callback server's Notify URL.","slug":"delivery-reports-on-notify-url","type":"basic","title":"Delivery reports on Notify URL"}

Delivery reports on Notify URL

Receive Delivery reports and custom data on your callback server's Notify URL.

Unlike the [Getting delivery reports](doc:push-sent-messages-reports) API method, where the reports are pulled and received in the response, you are able to set a **Notify URL** on your callback server to which we will push the delivery reports. Notify URL is set as one of the parameters of the [Send push notifications](doc:send-push-notifications) or [Send bulk PUSH notifications](doc:send-bulk-push-notifications) API method. As soon as the delivery reports for sent messages are received in the Infobip system, they will be forwarded to the specified Notify URL on your callback server. Besides the Notify URL, you can also specify **Notify Content Type** for delivery reports. Supported content types: - **`application/json`** - **`application/xml`** [block:api-header] { "title": "Example" } [/block] The example bellow shows how to set `notifyURL` and `notifyContentType` for the delivery report and the user's `callbackData`. ###Send Push notification request [block:code] { "codes": [ { "code": "POST /push/2/message/single 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\": \"Message text\",\n \"notifyUrl\": \"http://example.com\",\n \"notifyContentType\" : \"application/json\",\n \"callbackData\" : \"Delivery report callback data\"\n}", "language": "json", "name": "" } ] } [/block] ###Send Push notification 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\": 1,\n \"bulkId\": \"czztgteet4fath2pclbq\"\n }\n ]\n} ", "language": "json", "name": "" } ] } [/block] The results you will receive on your Notify URL will be the same as [Getting delivery reports](doc:push-sent-messages-reports) over the API method, except the XML root element name which is the same for all reports - `<reportResponse>`. ###Report [block:code] { "codes": [ { "code": "{\n \"results\": [{\n \"bulkId\": \"czztgteet4fath2pclbq\",\n \"price\": {\n \"pricePerMessage\": 0.000000,\n \"currency\": \"UNKNOWN\"\n },\n \"status\": {\n \"id\": 5,\n \"groupId\": 3,\n \"groupName\": \"DELIVERED\",\n \"name\": \"DELIVERED_TO_HANDSET\",\n \"description\": \"Message delivered to handset\"\n },\n \"error\": {\n \"id\": 0,\n \"name\": \"NO_ERROR\",\n \"description\": \"No Error\",\n \"groupId\": 0,\n \"groupName\": \"OK\",\n \"permanent\": false\n },\n \"messageId\": \"45653761-3a88-4060-869e-ae372adc7a51\",\n \"doneAt\": \"2017-10-27T10:20:08.562+0300\",\n \"messageCount\": 1,\n \"sentAt\": \"2017-10-27T10:20:07.197+0300\",\n \"callbackData\": \"{\\\"callbackData\\\":\\\"Delivery report callback data\\\",\\\"subscriberId\\\":\\\"customer_21234\\\"}\",\n \"to\": \"3fd5c8a4-ae57-46c1-be7a-31bb8a0a7fba\",\n \"channel\": \"PUSH\"\n }]\n}", "language": "json", "name": null } ] } [/block] [block:callout] { "type": "info", "body": "[Delivery report push retry cycle](doc:notify-url#section-delivery-report-push-retry-cycle)\n[Delivery report sender IP addresses](doc:notify-url#section-delivery-report-sender-ip-addresses)", "title": "USEFUL LINKS" } [/block]