Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 36 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,13 @@ activitysmith.notifications.send(

## Live Activities

There are four types of Live Activities:
There are five types of Live Activities:

- `stats`: best for showing business numbers side by side, such as revenue, sales, new users, conversion, refunds, or any other value you want visible at a glance
- `metrics`: best for live percentage values that change often, like server CPU, memory usage, disk usage, or error rate
- `segmented_progress`: best for anything that moves through clear stages, like deployments, onboarding flows, backups, ETL pipelines, migrations, and AI agent runs
- `progress`: best for tracking real-time progress with percentage, like tasks, backups, migrations, syncs, or uploads
- `alert`: best for status updates, such as feature adoption, reactivation, onboarding blockers, incidents, escalations, and other operational states

### Start & Update Live Activity

Expand Down Expand Up @@ -238,6 +239,39 @@ activitysmith.live_activities.stream(
)
```

#### Alert

<p align="center">
<img
src="https://cdn.activitysmith.com/features/alert-live-activity.png"
alt="Alert Live Activity stream example"
width="680"
/>
</p>

```ruby
activitysmith.live_activities.stream(
"customer-ops",
{
content_state: ActivitySmith::LiveActivities.content_state(
title: "Reactivation",
message: "Lumen came back after 2 weeks",
type: ActivitySmith::LiveActivities::TYPE_ALERT,
icon: ActivitySmith::LiveActivities.alert_icon("cloud.sun", color: "yellow"),
badge: ActivitySmith::LiveActivities.alert_badge("Customer", color: "magenta")
)
}
)
```

The `icon` symbol value is an Apple SF Symbol name. Browse the catalog with one of these tools:

- [ActivitySmith app](https://apps.apple.com/us/app/activitysmith/id6752254835) - Open Settings -> SF Symbols to browse 45 hand-picked icons ready to use
- [SF Symbols](https://developer.apple.com/sf-symbols/) - Apple's official macOS app
- [Interactful](https://apps.apple.com/app/interactful/id1528095640) - free third-party iOS app listing all SF Symbols under Foundations -> Iconography

`icon` and `badge` are optional. If you omit either one, that element is not shown in the Live Activity.

### End Live Activity

Call `end_stream(...)` with the same `stream_key` to dismiss the Live Activity. You can include final values before it is removed. By default, iOS removes the Live Activity after two minutes. Set `auto_dismiss_minutes` to choose a different dismissal time, including `0` for immediate dismissal.
Expand All @@ -263,6 +297,7 @@ activitysmith.live_activities.end_stream(
### Live Activity Action

Live Activities can include one optional action button. Use it to open a URL from the Live Activity or trigger a backend webhook.
For Alert Live Activities, set `color` in `content_state` to tint the action button. Icon and badge colors only affect the icon and badge.

<p align="center">
<img
Expand Down
3 changes: 3 additions & 0 deletions generated/activitysmith_openapi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
require 'activitysmith_openapi/models/forbidden_error'
require 'activitysmith_openapi/models/live_activity_action'
require 'activitysmith_openapi/models/live_activity_action_type'
require 'activitysmith_openapi/models/live_activity_alert_badge'
require 'activitysmith_openapi/models/live_activity_alert_icon'
require 'activitysmith_openapi/models/live_activity_color'
require 'activitysmith_openapi/models/live_activity_end_request'
require 'activitysmith_openapi/models/live_activity_end_response'
require 'activitysmith_openapi/models/live_activity_limit_error'
Expand Down
12 changes: 6 additions & 6 deletions generated/activitysmith_openapi/api/live_activities_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def initialize(api_client = ApiClient.default)
@api_client = api_client
end
# End a Live Activity (legacy manual lifecycle)
# Legacy manual lifecycle endpoint. For new integrations, use DELETE /live-activity/stream/{stream_key} to end a managed Live Activity stream. This endpoint remains supported for existing integrations and advanced lifecycle control. Ends a Live Activity and archives its lifecycle. Supports segmented_progress, progress, metrics, and stats activity types. For segmented_progress activities, you can send the latest number_of_steps here if the workflow changed after start.
# Legacy manual lifecycle endpoint. For new integrations, use DELETE /live-activity/stream/{stream_key} to end a managed Live Activity stream. This endpoint remains supported for existing integrations and advanced lifecycle control. Ends a Live Activity and archives its lifecycle. Supports segmented_progress, progress, metrics, stats, and alert activity types. For segmented_progress activities, you can send the latest number_of_steps here if the workflow changed after start.
# @param live_activity_end_request [LiveActivityEndRequest]
# @param [Hash] opts the optional parameters
# @return [LiveActivityEndResponse]
Expand All @@ -30,7 +30,7 @@ def end_live_activity(live_activity_end_request, opts = {})
end

# End a Live Activity (legacy manual lifecycle)
# Legacy manual lifecycle endpoint. For new integrations, use DELETE /live-activity/stream/{stream_key} to end a managed Live Activity stream. This endpoint remains supported for existing integrations and advanced lifecycle control. Ends a Live Activity and archives its lifecycle. Supports segmented_progress, progress, metrics, and stats activity types. For segmented_progress activities, you can send the latest number_of_steps here if the workflow changed after start.
# Legacy manual lifecycle endpoint. For new integrations, use DELETE /live-activity/stream/{stream_key} to end a managed Live Activity stream. This endpoint remains supported for existing integrations and advanced lifecycle control. Ends a Live Activity and archives its lifecycle. Supports segmented_progress, progress, metrics, stats, and alert activity types. For segmented_progress activities, you can send the latest number_of_steps here if the workflow changed after start.
# @param live_activity_end_request [LiveActivityEndRequest]
# @param [Hash] opts the optional parameters
# @return [Array<(LiveActivityEndResponse, Integer, Hash)>] LiveActivityEndResponse data, response status code and response headers
Expand Down Expand Up @@ -250,7 +250,7 @@ def reconcile_live_activity_stream_with_http_info(stream_key, live_activity_stre
end

# Start a Live Activity (legacy manual lifecycle)
# Legacy manual lifecycle endpoint. For new integrations, use PUT /live-activity/stream/{stream_key} so ActivitySmith can manage start, update, rotation, and end state for you. This endpoint remains supported for existing integrations and advanced lifecycle control. Starts a Live Activity on devices matched by API key scope and optional target channels. Supports segmented_progress, progress, metrics, and stats activity types. For segmented_progress activities, number_of_steps can be changed later during update or end calls if the workflow changes.
# Legacy manual lifecycle endpoint. For new integrations, use PUT /live-activity/stream/{stream_key} so ActivitySmith can manage start, update, rotation, and end state for you. This endpoint remains supported for existing integrations and advanced lifecycle control. Starts a Live Activity on devices matched by API key scope and optional target channels. Supports segmented_progress, progress, metrics, stats, and alert activity types. For segmented_progress activities, number_of_steps can be changed later during update or end calls if the workflow changes.
# @param live_activity_start_request [LiveActivityStartRequest]
# @param [Hash] opts the optional parameters
# @return [LiveActivityStartResponse]
Expand All @@ -260,7 +260,7 @@ def start_live_activity(live_activity_start_request, opts = {})
end

# Start a Live Activity (legacy manual lifecycle)
# Legacy manual lifecycle endpoint. For new integrations, use PUT /live-activity/stream/{stream_key} so ActivitySmith can manage start, update, rotation, and end state for you. This endpoint remains supported for existing integrations and advanced lifecycle control. Starts a Live Activity on devices matched by API key scope and optional target channels. Supports segmented_progress, progress, metrics, and stats activity types. For segmented_progress activities, number_of_steps can be changed later during update or end calls if the workflow changes.
# Legacy manual lifecycle endpoint. For new integrations, use PUT /live-activity/stream/{stream_key} so ActivitySmith can manage start, update, rotation, and end state for you. This endpoint remains supported for existing integrations and advanced lifecycle control. Starts a Live Activity on devices matched by API key scope and optional target channels. Supports segmented_progress, progress, metrics, stats, and alert activity types. For segmented_progress activities, number_of_steps can be changed later during update or end calls if the workflow changes.
# @param live_activity_start_request [LiveActivityStartRequest]
# @param [Hash] opts the optional parameters
# @return [Array<(LiveActivityStartResponse, Integer, Hash)>] LiveActivityStartResponse data, response status code and response headers
Expand Down Expand Up @@ -318,7 +318,7 @@ def start_live_activity_with_http_info(live_activity_start_request, opts = {})
end

# Update a Live Activity (legacy manual lifecycle)
# Legacy manual lifecycle endpoint. For new integrations, use PUT /live-activity/stream/{stream_key} so ActivitySmith can manage start, update, rotation, and end state for you. This endpoint remains supported for existing integrations and advanced lifecycle control. Updates an existing Live Activity. If the per-activity token is not registered yet, the update is queued. Supports segmented_progress, progress, metrics, and stats activity types. For segmented_progress activities, you can increase or decrease number_of_steps here as the workflow changes.
# Legacy manual lifecycle endpoint. For new integrations, use PUT /live-activity/stream/{stream_key} so ActivitySmith can manage start, update, rotation, and end state for you. This endpoint remains supported for existing integrations and advanced lifecycle control. Updates an existing Live Activity. If the per-activity token is not registered yet, the update is queued. Supports segmented_progress, progress, metrics, stats, and alert activity types. For segmented_progress activities, you can increase or decrease number_of_steps here as the workflow changes.
# @param live_activity_update_request [LiveActivityUpdateRequest]
# @param [Hash] opts the optional parameters
# @return [LiveActivityUpdateResponse]
Expand All @@ -328,7 +328,7 @@ def update_live_activity(live_activity_update_request, opts = {})
end

# Update a Live Activity (legacy manual lifecycle)
# Legacy manual lifecycle endpoint. For new integrations, use PUT /live-activity/stream/{stream_key} so ActivitySmith can manage start, update, rotation, and end state for you. This endpoint remains supported for existing integrations and advanced lifecycle control. Updates an existing Live Activity. If the per-activity token is not registered yet, the update is queued. Supports segmented_progress, progress, metrics, and stats activity types. For segmented_progress activities, you can increase or decrease number_of_steps here as the workflow changes.
# Legacy manual lifecycle endpoint. For new integrations, use PUT /live-activity/stream/{stream_key} so ActivitySmith can manage start, update, rotation, and end state for you. This endpoint remains supported for existing integrations and advanced lifecycle control. Updates an existing Live Activity. If the per-activity token is not registered yet, the update is queued. Supports segmented_progress, progress, metrics, stats, and alert activity types. For segmented_progress activities, you can increase or decrease number_of_steps here as the workflow changes.
# @param live_activity_update_request [LiveActivityUpdateRequest]
# @param [Hash] opts the optional parameters
# @return [Array<(LiveActivityUpdateResponse, Integer, Hash)>] LiveActivityUpdateResponse data, response status code and response headers
Expand Down
4 changes: 2 additions & 2 deletions generated/activitysmith_openapi/models/activity_metric.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def valid?
return false if @label.nil?
return false if @label.to_s.length < 1
return false if @value.nil?
color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow", "gray"])
return false unless color_validator.valid?(@color)
true
end
Expand All @@ -162,7 +162,7 @@ def label=(label)
# Custom attribute writer method checking allowed values (enum).
# @param [Object] color Object to be assigned
def color=(color)
validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow", "gray"])
unless validator.valid?(color)
fail ArgumentError, "invalid value for \"color\", must be one of #{validator.allowable_values}."
end
Expand Down
Loading