Skip to content

Commit 82f2ae2

Browse files
committed
docs: update secondary action README examples
1 parent 8fd4bca commit 82f2ae2

1 file changed

Lines changed: 49 additions & 6 deletions

File tree

README.md

Lines changed: 49 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -323,15 +323,15 @@ activitysmith.live_activities.end_stream(
323323

324324
### Live Activity Action
325325

326-
Live Activities can include a primary action button. `secondary_action` adds a secondary button for `alert`, `progress`, and `segmented_progress` Live Activities, using the same `open_url`, `shortcuts://`, and `webhook` payload shapes as `action`.
326+
Live Activities can include an action button.
327327

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

332332
<p align="center">
333333
<img
334-
src="https://cdn.activitysmith.com/features/live-activity-with-action.png?v=20260319-1"
334+
src="https://cdn.activitysmith.com/features/metrics-live-activity-action.png"
335335
alt="Live Activity with action button"
336336
width="680"
337337
/>
@@ -401,10 +401,53 @@ activitysmith.live_activities.stream(
401401
"requested_by": "activitysmith-python",
402402
},
403403
),
404+
)
405+
```
406+
407+
#### Secondary action
408+
409+
<p align="center">
410+
<img
411+
src="https://cdn.activitysmith.com/features/live-activity-secondary-action.png"
412+
alt="Alert Live Activity with primary and secondary action buttons"
413+
width="680"
414+
/>
415+
</p>
416+
417+
Use `secondary_action` when you want a second button beside the primary `action`.
418+
419+
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.
420+
421+
```python
422+
activitysmith.live_activities.stream(
423+
"agent-approval",
424+
content_state=content_state(
425+
title="Approval Needed",
426+
message="Should I send the follow-up email to Brightlane?",
427+
type="alert",
428+
color="green",
429+
icon=alert_icon("sparkles", color="green"),
430+
badge=alert_badge("Agent", color="green"),
431+
),
432+
action=action(
433+
title="Send",
434+
type="webhook",
435+
url="https://agent.example.com/live-activity/approve",
436+
method="POST",
437+
body={
438+
"approval_id": "approval_01JY3J7Q9S0P8M1V5PZK7DR4M2",
439+
"decision": "send",
440+
},
441+
),
404442
secondary_action=action(
405-
title="Open Runbook",
406-
type="open_url",
407-
url="https://ops.example.com/runbooks/search-reindex",
443+
title="Deny",
444+
type="webhook",
445+
url="https://agent.example.com/live-activity/deny",
446+
method="POST",
447+
body={
448+
"approval_id": "approval_01JY3J7Q9S0P8M1V5PZK7DR4M2",
449+
"decision": "deny",
450+
},
408451
),
409452
)
410453
```

0 commit comments

Comments
 (0)