Skip to content

iOS Live Activities API

Apple documentation:

startLiveActivity

Use this method to create iOS Live Activities.

POST https://api.pushwoosh.com/json/1.3/startLiveActivity

Allows creating iOS Live Activities.

Request Body

ParameterTypeRequired/OptionalDescription
applicationStringRequiredPushwoosh application code.
authStringRequiredAPI access token from the Pushwoosh Control Panel.
notificationsArrayRequiredJSON array of message parameters. See details in the Notifications table below.

Notifications

Parameters used in the notifications array:

ParameterTypeRequired/OptionalDescription
contentStringRequiredFallback content for devices running iOS versions below 16.1 that do not support Live Activity. On iOS 16.1+ (with Live Activity support), content is sourced from the live_activity field.
titleStringOptionalThe title of the notification message.
live_activityObjectRequiredLive Activity data to create Live Activity in iOS.
content-stateObjectRequiredContent for the Live Activity notification.
attributes-typeStringRequiredThe type of attributes used in the Live Activity.
attributesObjectRequiredAttributes for the Live Activity.
live_activity_idStringRequiredA unique ID for the Live Activity, created by the user.
filter_codeStringOptionalFilter (Segment) code to target specific audience segments.
devicesArray of stringsOptionalTokens or HWIDs to send targeted push notifications, with a maximum of 1000. If set, the message will be sent only to the devices in the list. Note: The Application Group for the devices list is not allowed, and iOS push tokens must be in lowercase.
usersArray of stringsOptionalIf set, the message will only be delivered to the specified user IDs (assigned via the /registerUser call). You can include up to 1000 user IDs in the array. Note: If used together with the devices parameter, the users parameter will take precedence. Application Group for the users list is not allowed.

Response

200

{
"status_code": 200,
"status_message": "OK",
"response": {
"Messages": [
"C3F8-C3863ED4-334AD4F1"
]
}
}

Request example

{
"request": {
"application": "XXXXX-XXXXX", // required. Pushwoosh application code
"auth": "yxoPUlwqm…………pIyEX4H", // required. API access token from Pushwoosh Control Panel
"notifications": [{
"live_activity": { // required. Live Activity data to create Live Activity in iOS
"content-state": {
"emoji": ":wink:"
},
"attributes-type": "LiveActivityAttributes",
"attributes": {
"name": "Apple"
}
},
"live_activity_id": "unique UUID", // optional. Unique identifier of the Live Activity.
"filter_code": "FILTER_NAME", // optional. Specify filter.
"devices": [ // optional. Specify tokens or hwids to send targeted push
"hwid_XXXX" // notifications. Not more than 1000 tokens/hwids in
], // an array. If set, the message will only be sent to
// the devices on the list. Application Group for
// devices list is not allowed.
// iOS push tokens can only be lower case.
"users": [ // optional. If set, message will only be delivered to the specified
"user_XXXX" // user ID's (set via /registerUser call). If specified
] // together with devices parameter, the latter will be
// ignored. Not more than 1000 user ID's in an array.
// Application Group for users list is not allowed.
}]
}
}

Note:

Read this article to learn more about working with Live Activities using the Pushwoosh iOS SDK.

updateLiveActivity

Use this method to manage iOS Live Activities.

POST https://api.pushwoosh.com/json/1.3/updateLiveActivity

Allows to create and manage iOS Live Activities.

Request Body

ParameterTypeRequired/OptionalDescription
authStringRequiredAPI access token from the Pushwoosh Control Panel.
applicationStringRequiredThe Pushwoosh application code.
notificationsArrayRequiredJSON array of message parameters. See details in the Notifications table below.

Notifications

Parameters used in the notifications array:

ParameterTypeRequired/OptionalDescription
live_activityObjectRequiredLive Activity data to update Live Activity in iOS.
eventStringRequiredSpecifies the event type. Use "update" to update the Live Activity or "end" to close it.
content-stateObjectRequiredObject with key-value pairs used to pass data to Live Activity for updating its content.
dismissal-dateIntegerOptionalThe time (in seconds) when the Live Activity should end.
live_activity_idStringRequiredA unique identifier for the Live Activity being updated.
{
"status_code": 200,
"status_message": "OK",
"response": {
"Messages": [
"C3F8-C3863ED4-334AD4F1"
]
}
}

Request example

{
"request": {
"application": "XXXXX-XXXXX", // required. Pushwoosh application code
"auth": "yxoPUlwqm…………pIyEX4H", // required. API access token from Pushwoosh Control Panel
"notifications": [{
"live_activity": { // required. Live Activity data to update Live Activity in iOS
"event": "update", // required. Use "update" to update Live Activity or
// "end" to close Live Activity
"content-state": { // required. Object with key-value pairs used to pass data
"courierName": "NUMBER: 15", // to Live Activity for updating its content
"deliveryStatus": "Done"
},
"dismissal-date": 12345678 // optional. Time of ending Live Activity in seconds
},
"live_activity_id": "unique UUID" // optional. Unique identifier of the Live Activity.
}]
}
}

Read this article to learn more about working with Live Activities using the Pushwoosh iOS SDK.