Check the status and delivery metrics of a push notification campaign.
Endpoint
GET /notifications/campaigns/:campaign_id
Authentication
Required: Bearer token in Authorization header
Authorization: Bearer YOUR_API_KEY
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
campaign_id | string | Yes | The campaign ID returned from Send Push |
Response
{
"success": true,
"campaign_id": "camp_123",
"status": "completed",
"created_at": "2024-01-15T10:30:00Z",
"sent_at": "2024-01-15T10:35:00Z",
"completed_at": "2024-01-15T10:45:00Z",
"stats": {
"total_recipients": 1250,
"sent": 1245,
"delivered": 1200,
"opened": 450,
"clicked": 120,
"failed": 5
},
"rates": {
"delivery_rate": 0.964,
"open_rate": 0.375,
"click_rate": 0.10
}
}
Campaign Status Values
| Status | Description |
|---|---|
pending | Campaign is queued for sending |
sending | Campaign is currently being sent |
completed | Campaign has finished sending |
failed | Campaign failed to send |
cancelled | Campaign was cancelled before completion |
Examples
JavaScript
const campaignId = 'camp_123';
const response = await fetch(`https://api.appizer.com/v1/notifications/campaigns/${campaignId}`, {
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
});
const data = await response.json();
console.log(data);
Python
import requests
campaign_id = 'camp_123'
response = requests.get(
f'https://api.appizer.com/v1/notifications/campaigns/{campaign_id}',
headers={'Authorization': 'Bearer YOUR_API_KEY'}
)
print(response.json())
cURL
curl -X GET https://api.appizer.com/v1/notifications/campaigns/camp_123 \
-H "Authorization: Bearer YOUR_API_KEY"
Error Responses
| Status Code | Description |
|---|---|
| 401 | Unauthorized - Invalid or missing API key |
| 404 | Not Found - Campaign ID not found |
| 429 | Too Many Requests - Rate limit exceeded |
| 500 | Internal Server Error - Something went wrong on our end |
Polling for Status
For campaigns that are still sending, you can poll this endpoint to check progress:
async function waitForCampaignCompletion(campaignId) {
let status = 'pending';
while (status === 'pending' || status === 'sending') {
const response = await fetch(
`https://api.appizer.com/v1/notifications/campaigns/${campaignId}`,
{ headers: { 'Authorization': 'Bearer YOUR_API_KEY' } }
);
const data = await response.json();
status = data.status;
if (status === 'completed') {
console.log('Campaign completed:', data.stats);
return data;
}
// Wait 5 seconds before checking again
await new Promise(resolve => setTimeout(resolve, 5000));
}
}
Best Practices
- Poll campaign status every 5-10 seconds for pending/sending campaigns
- Store campaign IDs for later analysis
- Monitor delivery and open rates to optimize future campaigns
- Set up alerts for campaigns with high failure rates
- Use campaign stats to segment audiences for retargeting