Skip to main content
POST/webpush-campaign/

Create webpush campaigns

You can create a webpush campaign.

Attributes

Optional unless marked required

namestringrequired
A Webpush campaign name.
segmentintegerrequired
A unique identifier for the user segment which is given by User automatically.
messageslistrequired
A list of objects. Each object is a valid web push message (check out the Webpush Message attributes).
etastring
A DateTime when the campaign should be sent. Delivery will start instantly if not provided.
ttlinteger
The number of seconds that a message may be stored if the user is not immediately available (Time To Live). Default: 259200 (3 days).

Message attributes

Optional unless marked required

titlestringrequired
A title of a web push message.
bodystringrequired
A content of a web push message.
urlstring
A URL of a web push message.
require_interactionboolean
A flag defining if a notification should remain active until the user clicks or dismisses it, rather than closing automatically.
doughnut_titlestring
Action button 1 label.
doughnut_urlstring
Action button 1 URL.
coffee_titlestring
Action button 2 label.
coffee_urlstring
Action button 2 URL.
iconstring
A URL of image inside a web push message.
badgestring
A URL of image inside a web push message (known as a Big photo). Only works on Windows.

Request​

curl -X POST "https://<your_app_subdomain>.user.com/api/public/webpush-campaign/" \
-H "Authorization: Token <your_64_char_api_key>" \
-H "Accept: */*; version=2" \
-H "Content-Type: application/json" \
-d '{
"name": "Spring sale push",
"segment": 12345,
"eta": "2026-11-17T13:25:29Z",
"ttl": 86400,
"messages": [
{
"title": "The spring sale has started",
"body": "Save up to 30% on outdoor gear.",
"url": "https://example.com/sale",
"require_interaction": false
}
]
}'

Response examples​

{
"id": 1,
"name": "string",
"category": null,
"eta": "2026-01-01T12:00:00Z",
"ttl": 1,
"folder": null
}

Response fields​

Fields returned in the 201 Created response body.

idinteger
A unique identifier for the campaign.
namestring
A Webpush campaign name.
categoryinteger or nullnullable
Deprecated (replaced by folders). Read-only. Existing campaigns may return a legacy category value; new campaigns always return null. Folder assignment will be available in the next API version.
etastring (date-time)
A DateTime when the campaign is scheduled to be sent. null if sent immediately.
ttlinteger
Time-to-live in seconds.
folderintegernullable
ID of the folder the campaign is in, or null.
note

Errors that can come from any endpoint (401, 429, 500, 502, 504) are described in HTTP response codes.