Scheduled Messages
Schedule push notifications for delivery at a specific future time — marketing campaigns, event reminders, time-sensitive content, global audiences.
Schedule push notifications for delivery at a specific future time.
Use Cases#
- Marketing campaigns — send at optimal engagement times
- Event reminders — notify before appointments
- Time-sensitive content — flash sales, limited offers
- Global audiences — schedule separate messages for each region's local time
Schedule a Message#
scheduledAt is an ISO 8601 timestamp and must be in the future; it is the exact instant the message is sent. timezone is optional (defaults to UTC) and is stored with the message for display only — it does not shift scheduledAt, so include the offset (or use Z) in scheduledAt itself. Due messages are picked up once a minute. Only title, body and data are delivered with a scheduled message.
Node.js SDK
import { AbrovaPush } from '@abrova/push-node';
const abrovaPush = new AbrovaPush({
apiKey: 'ab_live_your_api_key',
serverSecret: 'ab_srv_your_server_secret',
});
const scheduled = await abrovaPush.scheduled.create({
title: 'Flash Sale!',
body: '50% off for the next 2 hours',
targetType: 'broadcast',
scheduledAt: '2024-01-20T10:00:00Z',
timezone: 'Asia/Tehran',
});REST API
curl -X POST "https://push-api.abrova.ir/scheduled" \
-H "x-api-key: ab_live_your_api_key" \
-H "x-server-secret: ab_srv_your_server_secret" \
-H "Content-Type: application/json" \
-d '{
"title": "Flash Sale!",
"body": "50% off for the next 2 hours",
"targetType": "broadcast",
"scheduledAt": "2024-01-20T10:00:00Z",
"timezone": "Asia/Tehran"
}'Target Types#
| Option | Type | Required | Description |
|---|---|---|---|
| broadcast | - | - | Send to all devices (no targetValue required) |
| device | - | - | Send to specific device (targetValue = device ID) |
| user | - | - | Send to user's devices (targetValue = user ID) |
| topic | - | - | Send to topic subscribers (targetValue = topic name) |
| segment | - | - | Scheduled messages can't target segments; send to a segment immediately. |
Target Specific Devices/Users#
Node.js SDK
await abrovaPush.scheduled.create({
title: 'Your appointment reminder',
body: "Don't forget your meeting in 1 hour",
targetType: 'user',
targetValue: 'user_123',
scheduledAt: '2024-01-20T09:00:00Z',
timezone: 'Asia/Tehran',
});REST API
curl -X POST "https://push-api.abrova.ir/scheduled" \
-H "x-api-key: ab_live_your_api_key" \
-H "x-server-secret: ab_srv_your_server_secret" \
-H "Content-Type: application/json" \
-d '{
"title": "Your appointment reminder",
"body": "Dont forget your meeting in 1 hour",
"targetType": "user",
"targetValue": "user_123",
"scheduledAt": "2024-01-20T09:00:00Z",
"timezone": "Asia/Tehran"
}'List Scheduled Messages#
Node.js SDK
const messages = await abrovaPush.scheduled.list(); // Or only pending const pending = await abrovaPush.scheduled.listPending();
REST API
curl -X GET "https://push-api.abrova.ir/scheduled" \ -H "x-api-key: ab_live_your_api_key" \ -H "x-server-secret: ab_srv_your_server_secret"
Response
[
{
"id": "sch_abc123",
"title": "Flash Sale!",
"body": "50% off for 2 hours",
"targetType": "broadcast",
"scheduledAt": "2024-01-20T10:00:00Z",
"timezone": "Asia/Tehran",
"status": "pending",
"createdAt": "2024-01-15T12:00:00Z"
}
]Message Status#
| Option | Type | Required | Description |
|---|---|---|---|
| pending | - | - | Waiting for scheduled time |
| processing | - | - | Currently being sent |
| sent | - | - | Successfully sent |
| failed | - | - | Failed to send |
| cancelled | - | - | Cancelled before sending |
Cancel a Scheduled Message#
Cancel a pending message before it's sent. Only messages with status pending can be cancelled (or updated with PUT /scheduled/:id / abrovaPush.scheduled.update(id, {...})).
Node.js SDK
await abrovaPush.scheduled.cancel('sch_abc123');REST API
curl -X POST "https://push-api.abrova.ir/scheduled/sch_abc123/cancel" \ -H "x-api-key: ab_live_your_api_key" \ -H "x-server-secret: ab_srv_your_server_secret"
Delete a Scheduled Message#
Node.js SDK
await abrovaPush.scheduled.delete('sch_abc123');REST API
curl -X DELETE "https://push-api.abrova.ir/scheduled/sch_abc123" \ -H "x-api-key: ab_live_your_api_key" \ -H "x-server-secret: ab_srv_your_server_secret"