push_send
Need an alert to reach a user even when the app tab is closed? push_send sends a web push notification to one device, one app-user's devices, your developer devices, or the whole project.
Recipient targeting (exactly one; a missing, null or empty target is refused):
user_id: every device that signed-in app user registered.subscription_idorendpoint: one device. Sending again sends another notification.audience: 'developer': devices registered withpush_subscribe.audience: 'all': every device in the project (refused whole above 500).
payload may be a JSON object (recommended — your service worker parses it) or a string. Subscriptions that the push provider reports as gone (404/410) are auto-deleted. Inside a deployed function the equivalent call is sw.push.send({ payload, user_id }) — one object, payload nested; there is no second options argument.
Example:
{
"project_id": "my-saas",
"user_id": "u_alice",
"payload": { "title": "New message", "body": "From Bob", "url": "/inbox/123" }
}
// Returns: { "sent": 1, "failed": 0, "gone": 0, "captured": 0, "recipients": 1, "history_recorded": true, "devices": [{ "subscription_id": "psub_...", "device_label": "Chrome on Android", "outcome": "sent", "http_status": 201, ... }] }Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"project_id": "<project_id>",
"payload": "<payload>"
},
"name": "push_send"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ttl | No | Optional time-to-live in seconds (default 86400). The push service holds the message at most this long if the device is offline. | |
| contact | No | Optional VAPID contact (mailto:you@example.com). Defaults to the platform contact. | |
| payload | Yes | Notification body. JSON object or string. Your service worker reads this in the push event. | |
| user_id | No | Send to every device this app user registered. | |
| audience | No | Optional: 'developer' sends only to devices registered with push_subscribe; 'all' broadcasts to every device in the project. | |
| endpoint | No | Optional: send to a single subscription by its endpoint URL. | |
| project_id | Yes | Project ID (UUID), subdomain, or slug — resolved server-side, no UUID lookup needed. 'default' also works when the account has exactly one project; multi-project accounts must name one (the error lists them). | |
| subscription_id | No | Optional: send to one device by its id (from push_deliveries). |