# Webpush campaign model
You can send web pushes and get statistics of your campaigns through API.
# Input fields (Create / Update)
| Attributes | Type | Required | Description |
|---|---|---|---|
| name | string | yes | A Webpush campaign name. |
| segment | integer | yes | A unique identifier for the user segment which is given by User.com automatically. |
| messages | list | yes | A list of objects. Each object is a valid web push message (check out the Webpush Message model). |
| eta | string | no | A DateTime when the campaign should be sent. Delivery will start instantly if not provided. |
| ttl | integer | no | The number of seconds that a message may be stored if the user is not immediately available (Time To Live). Default: 259200 (3 days). |
Note: The
categoryfield is deprecated for webpush campaigns — categories have been replaced by folders in User.com. New campaigns cannot be assigned a category via the API (the value is accepted but not saved). Existing campaigns created before the deprecation may still return a non-null category value in GET responses. Folder assignment will be available in the next version of the API.
# Create / Update response
The response from POST (create) and PATCH (update) endpoints returns a minimal object:
{
"id": 3,
"name": "Campaign Name",
"category": null,
"eta": null,
"ttl": 259200
}
# GET response (full model)
The GET endpoints return the full campaign object with all fields:
| Attributes | Type | Description |
|---|---|---|
| id | integer | A unique identifier for the campaign. |
| name | string | A Webpush campaign name. |
| description | string | Campaign description. |
| type | integer | Campaign type. 1 = manual, 2 = automated. |
| status | integer | Campaign status. 1 = draft, 2 = sent/active. |
| eta | string | A DateTime when the campaign is scheduled to be sent. null if sent immediately. |
| messages | list | A list of message objects (see Webpush Message model for field details). |
| recipients | object | Segment query definition used to target recipients. |
| recipients_count | integer | Number of recipients matching the segment at the time of query. |
| created_at | string | ISO 8601 DateTime when the campaign was created. |
| updated_at | string | ISO 8601 DateTime when the campaign was last updated. |
| category | integer or null | 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. |
| ttl | integer | Time-to-live in seconds. |
| user_activity_schedule | boolean | Whether user activity schedule is enabled. |
| advance_filtering | object | Advanced filtering configuration, or null. |
| multiple_domains_warning | boolean | Whether a multiple domains warning is present. |
| statistics | object | Campaign delivery statistics (see below). |
# Statistics object
| Field | Type | Description |
|---|---|---|
| sent | integer | Number of notifications sent. |
| scheduled | integer | Number of notifications scheduled. |
| delivered | integer | Number of notifications delivered. |
| clicked | integer | Number of notifications clicked. |