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
54 changes: 51 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -323,15 +323,15 @@ activitysmith.live_activities.end_stream(

### Live Activity Action

Live Activities can include one optional action button.
Live Activities can include an action button.

- `open_url`: open an HTTPS URL.
- `open_url` with a `shortcuts://run-shortcut?name=...` URL: run a specific iPhone Shortcut, for example to open an app.
- `open_url` with a `shortcuts://` URL: run an Apple Shortcut, for example to open an app.
- `webhook`: trigger a backend GET/POST workflow.

<p align="center">
<img
src="https://cdn.activitysmith.com/features/live-activity-with-action.png?v=20260319-1"
src="https://cdn.activitysmith.com/features/metrics-live-activity-action.png"
alt="Live Activity with action button"
width="680"
/>
Expand Down Expand Up @@ -404,6 +404,54 @@ activitysmith.live_activities.stream(
)
```

#### Secondary action

<p align="center">
<img
src="https://cdn.activitysmith.com/features/live-activity-secondary-action.png"
alt="Alert Live Activity with primary and secondary action buttons"
width="680"
/>
</p>

Use `secondary_action` when you want a second button beside the primary `action`.

The secondary action button is supported for `alert`, `progress`, and `segmented_progress` Live Activities. Both buttons use the same `open_url`, `webhook`, and Apple Shortcut payload shapes.

```python
activitysmith.live_activities.stream(
"agent-approval",
content_state=content_state(
title="Approval Needed",
message="Should I send the follow-up email to Brightlane?",
type="alert",
color="green",
icon=alert_icon("sparkles", color="green"),
badge=alert_badge("Agent", color="green"),
),
action=action(
title="Send",
type="webhook",
url="https://agent.example.com/live-activity/approve",
method="POST",
body={
"approval_id": "approval_01JY3J7Q9S0P8M1V5PZK7DR4M2",
"decision": "send",
},
),
secondary_action=action(
title="Deny",
type="webhook",
url="https://agent.example.com/live-activity/deny",
method="POST",
body={
"approval_id": "approval_01JY3J7Q9S0P8M1V5PZK7DR4M2",
"decision": "deny",
},
),
)
```

### Icons and Badges

Add more context to Live Activities with icons and badges.
Expand Down
14 changes: 13 additions & 1 deletion activitysmith/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from activitysmith_openapi.api.metrics_api import MetricsApi
from activitysmith_openapi.api.push_notifications_api import PushNotificationsApi

SDK_VERSION = "1.7.0"
SDK_VERSION = "1.8.0"
SDK_HEADER_NAME = "X-ActivitySmith-SDK"
SDK_HEADER_VALUE = f"python-v{SDK_VERSION}"

Expand Down Expand Up @@ -276,6 +276,7 @@ def _build_live_activity_request(
auto_dismiss_seconds: Any | None = None,
auto_dismiss_minutes: Any | None = None,
action: Any | None = None,
secondary_action: Any | None = None,
alert: Any | None = None,
target: Any | None = None,
channels: Any | None = None,
Expand Down Expand Up @@ -307,6 +308,7 @@ def _build_live_activity_request(
{
"activity_id": activity_id,
"action": action,
"secondary_action": secondary_action,
"alert": alert,
"target": target,
"channels": channels,
Expand Down Expand Up @@ -448,6 +450,7 @@ def start(
color: Any | None = None,
step_color: Any | None = None,
action: Any | None = None,
secondary_action: Any | None = None,
alert: Any | None = None,
target: Any | None = None,
channels: Any | None = None,
Expand All @@ -472,6 +475,7 @@ def start(
color=color,
step_color=step_color,
action=action,
secondary_action=secondary_action,
alert=alert,
target=target,
channels=channels,
Expand Down Expand Up @@ -503,6 +507,7 @@ def update(
color: Any | None = None,
step_color: Any | None = None,
action: Any | None = None,
secondary_action: Any | None = None,
):
request = _build_live_activity_request(
request,
Expand All @@ -525,6 +530,7 @@ def update(
color=color,
step_color=step_color,
action=action,
secondary_action=secondary_action,
)
return self._api.update_live_activity(live_activity_update_request=request)

Expand Down Expand Up @@ -552,6 +558,7 @@ def end(
step_color: Any | None = None,
auto_dismiss_minutes: Any | None = None,
action: Any | None = None,
secondary_action: Any | None = None,
):
request = _build_live_activity_request(
request,
Expand All @@ -575,6 +582,7 @@ def end(
step_color=step_color,
auto_dismiss_minutes=auto_dismiss_minutes,
action=action,
secondary_action=secondary_action,
)
return self._api.end_live_activity(live_activity_end_request=request)

Expand All @@ -601,6 +609,7 @@ def stream(
color: Any | None = None,
step_color: Any | None = None,
action: Any | None = None,
secondary_action: Any | None = None,
alert: Any | None = None,
target: Any | None = None,
channels: Any | None = None,
Expand All @@ -625,6 +634,7 @@ def stream(
color=color,
step_color=step_color,
action=action,
secondary_action=secondary_action,
alert=alert,
target=target,
channels=channels,
Expand Down Expand Up @@ -658,6 +668,7 @@ def end_stream(
step_color: Any | None = None,
auto_dismiss_minutes: Any | None = None,
action: Any | None = None,
secondary_action: Any | None = None,
alert: Any | None = None,
):
request = _build_live_activity_request(
Expand All @@ -681,6 +692,7 @@ def end_stream(
step_color=step_color,
auto_dismiss_minutes=auto_dismiss_minutes,
action=action,
secondary_action=secondary_action,
alert=alert,
)
return self._api.end_live_activity_stream(
Expand Down
2 changes: 1 addition & 1 deletion activitysmith_openapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
""" # noqa: E501


__version__ = "1.6.0"
__version__ = "1.8.0"

# import apis into sdk package
from activitysmith_openapi.api.live_activities_api import LiveActivitiesApi
Expand Down
Loading