Create or Update a Web Push Message
Creates or updates a web push message. If the id in the request body matches an existing message the message is updated; otherwise a new message is created. Returns the id of the created or updated web push message.
A web push message belongs to a campaign and is sent to contacts who have subscribed to browser notifications for the tenant. See Create or Update Web Push Opt-in for configuring the prompt that lets contacts subscribe.
HTTP Request Examples
{
"id": 0,
"campaignId": 3360,
"title": "Flash Sale Today",
"options": {
"body": "Save 20% on everything. Click to shop.",
"icon": "https://cdn.example.com/icon.png",
"badge": "https://cdn.example.com/badge.png",
"click_url": "https://www.example.com/sale",
"data": ""
},
"status": "Active"
}
HTTP Request Parameters
idnumber
Id of the web push message. Omit or set to 0 to create a new message. Supply the existing id to update.
tenantIdnumber
Id of the tenant that owns the message. Inferred from the API key.
campaignIdnumberrequired
Id of the campaign this message belongs to.
titlestringrequired
Title shown at the top of the push notification. Supports Handlebars merge fields.
optionsobjectrequired
Notification options. See fields below.
options.bodystringrequired
Body text of the push notification. Supports Handlebars merge fields.
options.iconstring
URL of the icon shown in the notification. Defaults to the DailyStory logo.
options.badgestring
URL of the badge image shown on supported platforms. Defaults to the DailyStory brand badge.
options.click_urlstring
URL opened when the recipient clicks the notification.
options.datastring
Optional string payload delivered with the push event.
statusstring
Status of the message. Use Active to enable sending, Deleted to soft-delete. Defaults to Active.
HTTP Response Examples
200
{
"Status": true,
"Message": "",
"Response": {
"id": 1845
}
}
HTTP Response Parameters
idnumberrequired
Id of the created or updated web push message.