Skip to content

iOS Live Activities API

Apple documentation:

startLiveActivity

Anchor link to

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

Allows creating iOS Live Activities.

Request body

Anchor link to
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

Anchor link to

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.
live_activity.content-stateObjectRequiredContent for the Live Activity notification.
live_activity.attributes-typeStringRequiredThe type of attributes used in the Live Activity.
live_activity.attributesObjectRequiredAttributes for the Live Activity.
live_activity_idStringRequiredA unique identifier for the Live Activity. Used to target this activity when calling updateLiveActivity. Must be unique per activity session.
filterStringOptionalThe name of a Pushwoosh filter (segment). See Segment / Filter name. The Live Activity will be started on all devices matching this filter.
devicesArray of StringsOptionalA list of device tokens. The Live Activity will be started only on the specified devices.

Request example

Anchor link to
{
"request": {
"application": "XXXXX-XXXXX",
"auth": "SECRET_API_TOKEN",
"notifications": [
{
"content": "Your order is being prepared",
"title": "Food Delivery",
"live_activity": {
"event": "start",
"title": "Order status",
"content-state": {
"status": "Third",
"estimatedTime": "37 min",
"emoji": "👨‍🍳"
},
"attributes-type": "FoodDeliveryAttributes",
"attributes": {}
},
"live_activity_id": "FIRST_LIVE_ACTIVITY",
"filter": "FILTER_NAME_1"
}
]
}
}

Response example

Anchor link to
{
"status_code": 200,
"status_message": "OK",
"response": {
"Messages": [
"XXXXX-XXXXXXXX-XXXXXXXX"
]
}
}

Note:

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

updateLiveActivity

Anchor link to

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

Allows updating and ending iOS Live Activities

Request body

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

Notifications

Anchor link to

Parameters used in the notifications array:

ParameterTypeRequired/OptionalDescription
live_activityObjectRequiredLive Activity data to update Live Activity in iOS.
live_activity.eventStringRequiredSpecifies the event type. Use "update" to update the Live Activity or "end" to close it.
live_activity.content-stateObjectRequiredObject with key-value pairs used to pass data to Live Activity for updating its content.
live_activity.dismissal-dateIntegerOptionalThe time (in seconds) when the Live Activity should end.
live_activity_idStringRequiredThe unique identifier of the Live Activity to update. Must match the live_activity_id used in startLiveActivity. The update will be delivered to all devices on which this activity was started.
live_activity.relevance-scoreIntegerOptionalTells the iOS system which Live Activity has higher priority than others. Accepts values from 1 to infinity (values up to 100 are recommended).
live_activity.stale-dateIntegerOptionalThe time (in seconds) that represents the date at which a Live Activity becomes stale, or out of date.

Request example

Anchor link to
{
"request": {
"application": "XXXXX-XXXXX",
"auth": "SECRET_API_TOKEN",
"notifications": [
{
"live_activity": {
"event": "update",
"title": "Live Activity Update",
"content-state": {
"status": "second 66",
"estimatedTime": "66 min",
"emoji": "👨‍"
},
"relevance-score": 60
},
"live_activity_id": "FIRST_LIVE_ACTIVITY"
}
]
}
}

Response example

Anchor link to
{
"status_code": 200,
"status_message": "OK",
"response": {
"Messages": [
"XXXXX-XXXXXXXX-XXXXXXXX"
]
}
}

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

Multiple activities per device

Anchor link to

You can start multiple Live Activities on the same device by calling startLiveActivity several times with different live_activity_id values.

For example, if you start two activities: FIRST_LIVE_ACTIVITY with filter: FILTER_NAME_1 and SECOND_LIVE_ACTIVITY with filter: FILTER_NAME_2, a device that matches both filters will have both activities running simultaneously.

To update one of them, pass its live_activity_id to updateLiveActivity. The update is delivered to all devices where that activity was created. The other activity is not affected.

The relevance-score parameter controls display priority when multiple Live Activities are active on the same device. If screen space is limited or activities are grouped, the activity with a higher value is shown with higher priority.