Delivery Report Webhook
When delivery reports are enabled on your account, Gupshup sends an HTTP POST to the webhook URL you provide each time delivery events are available.
Request format
| HTTP method | POST |
| Content-Type | application/x-www-form-urlencoded;charset=utf-8 |
| Parameter | response |
| Value | JSON array of event objects |
Event object
| Field | Type | Description |
|---|---|---|
timestamp | string | Event time as a Unix timestamp in seconds. |
email | string | Recipient email address. |
event | string | Event type, e.g. DELIVERED, SOFT_BOUNCE, CLICK. |
campaignid | string | ID of the campaign the event belongs to. |
link | string | The clicked URL. Present only for click events. |
Payload examples
[
{
"timestamp": "1493577000",
"email": "[email protected]",
"event": "DELIVERED",
"campaignid": "3319237025400370211"
}
][
{
"timestamp": "1493577000",
"email": "[email protected]",
"event": "DELIVERED",
"campaignid": "3319237025400370211"
},
{
"timestamp": "1493577001",
"email": "[email protected]",
"event": "SOFT_BOUNCE",
"campaignid": "3319237025400370211"
},
{
"timestamp": "1493577001",
"email": "[email protected]",
"event": "CLICK",
"link": "http://www.example.com",
"campaignid": "4019237025400370222"
},
{
"timestamp": "1493577004",
"email": "[email protected]",
"event": "DELIVERED",
"campaignid": "4319237025400370233"
}
]
Always handle arraysA single call can contain several events. Parse
responseas an array from the start so you won't need to change your code later.
Handling events in Java
String response = req.getParameter("response");
JSONArray jsonArray = new JSONArray(response);
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
String campaignid = jsonObject.getString("campaignid");
callBusinessMethod(jsonObject);
}Updated about 12 hours ago
Did this page help you?
