---
name: push-campaigns
description: Use when drafting, editing, sending or scheduling a notification.dev push campaign. Covers the campaign input shape, audience options, the status lifecycle, idempotency keys for send and schedule, and polling the resulting operation.
---

# Push campaigns

A campaign is one push notification sent to an audience. Campaigns are always
drafted first; sending and scheduling are separate, permission-gated steps.
Read `notification-platform` first.

## Tools

| Tool                    | Permission                                                                                           | Arguments                                                  |
| ----------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- |
| `list_campaigns`        | `campaigns:read`                                                                                     | `projectId`, optional `cursor`                             |
| `get_campaign`          | `campaigns:read`                                                                                     | `projectId`, `campaignId`                                  |
| `create_campaign_draft` | `campaigns:write`                                                                                    | `projectId`, `input`                                       |
| `update_campaign_draft` | `campaigns:write`                                                                                    | `projectId`, `campaignId`, partial `input` (draft only)    |
| `send_campaign`         | `messages:send`                                                                                      | `projectId`, `campaignId`, `idempotencyKey`                |
| `schedule_campaign`     | `messages:send`                                                                                      | `projectId`, `campaignId`, `scheduledAt`, `idempotencyKey` |
| `get_operation`         | `project:read` plus the operation's originating permission (`messages:send` for sends and schedules) | `projectId`, `operationId`                                 |

## Campaign input

```json
{
  "name": "Autumn sale reminder",
  "message": {
    "title": "Sale ends tonight",
    "body": "Your 20% discount expires at midnight. Open the app to use it.",
    "data": { "screen": "offers", "campaign": "autumn" },
    "deepLink": "myapp://offers/autumn"
  },
  "audience": { "type": "segment", "segmentId": "<segment id>" }
}
```

- `title`: 1 to 1024 characters. `body`: 1 to 4096 characters. Keep both short;
  devices truncate long text.
- `data`: optional JSON object the app receives with the notification.
- `deepLink` and `placement` are optional and mutually exclusive. A placement
  is a named in-app destination. Find it with `list_placements` and supply
  `placement: { versionId, parameters }`; see notification-platform for details.
- `audience` is one of:
  - `{ "type": "all" }`: every reachable subscriber;
  - `{ "type": "segment", "segmentId": "..." }`: a saved segment;
  - `{ "type": "subscribers", "subscriberIds": ["..."] }`: 1 to 1000 ids.

## Status lifecycle

`draft` → `scheduled` → `preparing` → `sending` → `completed`, or `failed` /
`canceled`. Only `draft` campaigns can be edited. Check `status` with
`get_campaign` before updating or sending.

## Workflow

1. Confirm the audience. For a segment, run `preview_segment` and report the
   count. For `all`, say clearly that it reaches every subscriber.
2. `create_campaign_draft`. Share the draft name and content with the user and
   stop here unless they asked you to send.
3. To send now: generate a unique `idempotencyKey` (for example a UUID), call
   `send_campaign`, then poll `get_operation` until it completes. Report the
   result. On a network error or timeout, retry with the **same** key.
4. To schedule: `scheduledAt` must be a future ISO 8601 UTC time ending in `Z`,
   for example `2026-10-14T08:00:00Z`. Convert the user's local time to UTC and
   say which UTC time you used. Use a fresh key per schedule action.

## Guardrails

- Never send or schedule without an explicit instruction for that specific
  campaign. "Create a campaign" means a draft.
- Never reuse an idempotency key across different campaigns or different times.
- If the project has only a `mock` provider configured, delivery is simulated.
  Mention it when reporting results.
- Provider acceptance is not device receipt. Delivery logs live in the dashboard.

## Images and sender avatars

For a campaign visual, photo attachment or chat avatar, read `push-images`
(`skill://push-images/SKILL.md`). It covers `message.imageUrl` versus
`message.communication`, reusable examples, uploads, limits, native setup and
pending SDK releases. Use the same fields in campaign draft input.
