activitysmith 1.4.2__tar.gz → 1.6.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {activitysmith-1.4.2 → activitysmith-1.6.0}/PKG-INFO +98 -3
- {activitysmith-1.4.2 → activitysmith-1.6.0}/README.md +97 -2
- activitysmith-1.6.0/activitysmith/__init__.py +19 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith/client.py +98 -2
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith.egg-info/PKG-INFO +98 -3
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith.egg-info/SOURCES.txt +6 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/__init__.py +4 -1
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/api/live_activities_api.py +9 -9
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/api_client.py +1 -1
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/configuration.py +1 -1
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/models/__init__.py +3 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/models/activity_metric.py +2 -2
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/models/content_state_end.py +27 -13
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/models/content_state_start.py +27 -13
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/models/content_state_update.py +27 -13
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/models/live_activity_action.py +11 -17
- activitysmith-1.6.0/activitysmith_openapi/models/live_activity_alert_badge.py +104 -0
- activitysmith-1.6.0/activitysmith_openapi/models/live_activity_alert_icon.py +104 -0
- activitysmith-1.6.0/activitysmith_openapi/models/live_activity_color.py +45 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/models/push_notification_action.py +11 -17
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/models/push_notification_request.py +3 -3
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/models/stream_content_state.py +27 -13
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/test/test_content_state_end.py +5 -2
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/test/test_content_state_start.py +5 -2
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/test/test_content_state_update.py +5 -2
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/test/test_live_activity_action.py +20 -2
- activitysmith-1.6.0/activitysmith_openapi/test/test_live_activity_alert_badge.py +53 -0
- activitysmith-1.6.0/activitysmith_openapi/test/test_live_activity_alert_icon.py +53 -0
- activitysmith-1.6.0/activitysmith_openapi/test/test_live_activity_color.py +33 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/test/test_push_notification_action.py +20 -2
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/test/test_push_notification_request.py +1 -1
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/test/test_stream_content_state.py +5 -2
- {activitysmith-1.4.2 → activitysmith-1.6.0}/pyproject.toml +1 -1
- {activitysmith-1.4.2 → activitysmith-1.6.0}/tests/test_resources.py +140 -6
- activitysmith-1.4.2/activitysmith/__init__.py +0 -3
- {activitysmith-1.4.2 → activitysmith-1.6.0}/LICENSE +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith.egg-info/dependency_links.txt +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith.egg-info/requires.txt +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith.egg-info/top_level.txt +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/api/__init__.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/api/metrics_api.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/api/push_notifications_api.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/api_response.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/exceptions.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/models/activity_metric_value.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/models/alert_payload.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/models/bad_request_error.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/models/channel_target.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/models/forbidden_error.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/models/live_activity_action_type.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/models/live_activity_end_request.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/models/live_activity_end_response.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/models/live_activity_limit_error.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/models/live_activity_start_request.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/models/live_activity_start_response.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/models/live_activity_stream_delete_request.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/models/live_activity_stream_delete_response.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/models/live_activity_stream_put_response.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/models/live_activity_stream_request.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/models/live_activity_update_request.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/models/live_activity_update_response.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/models/live_activity_webhook_method.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/models/metric_error.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/models/metric_value_update_request.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/models/metric_value_update_request_value.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/models/metric_value_update_response.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/models/no_recipients_error.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/models/not_found_error.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/models/push_notification_action_type.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/models/push_notification_response.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/models/push_notification_webhook_method.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/models/rate_limit_error.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/models/send_push_notification429_response.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/rest.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/test/__init__.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/test/test_activity_metric.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/test/test_activity_metric_value.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/test/test_alert_payload.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/test/test_bad_request_error.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/test/test_channel_target.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/test/test_forbidden_error.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/test/test_live_activities_api.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/test/test_live_activity_action_type.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/test/test_live_activity_end_request.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/test/test_live_activity_end_response.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/test/test_live_activity_limit_error.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/test/test_live_activity_start_request.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/test/test_live_activity_start_response.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/test/test_live_activity_stream_delete_request.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/test/test_live_activity_stream_delete_response.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/test/test_live_activity_stream_put_response.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/test/test_live_activity_stream_request.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/test/test_live_activity_update_request.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/test/test_live_activity_update_response.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/test/test_live_activity_webhook_method.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/test/test_metric_error.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/test/test_metric_value_update_request.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/test/test_metric_value_update_request_value.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/test/test_metric_value_update_response.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/test/test_metrics_api.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/test/test_no_recipients_error.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/test/test_not_found_error.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/test/test_push_notification_action_type.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/test/test_push_notification_response.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/test/test_push_notification_webhook_method.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/test/test_push_notifications_api.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/test/test_rate_limit_error.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/activitysmith_openapi/test/test_send_push_notification429_response.py +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/setup.cfg +0 -0
- {activitysmith-1.4.2 → activitysmith-1.6.0}/tests/test_smoke.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: activitysmith
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.6.0
|
|
4
4
|
Summary: Official ActivitySmith Python SDK
|
|
5
5
|
Author-email: ActivitySmith <adam@activitysmith.com>
|
|
6
6
|
License: MIT
|
|
@@ -40,6 +40,8 @@ See the [API reference](https://activitysmith.com/docs/api-reference/introductio
|
|
|
40
40
|
- [Start & Update Live Activity](#start--update-live-activity)
|
|
41
41
|
- [End Live Activity](#end-live-activity)
|
|
42
42
|
- [Live Activity Action](#live-activity-action)
|
|
43
|
+
- [Icons and Badges](#icons-and-badges)
|
|
44
|
+
- [Live Activity Colors](#live-activity-colors)
|
|
43
45
|
- [Channels](#channels)
|
|
44
46
|
- [Widgets](#widgets)
|
|
45
47
|
|
|
@@ -61,7 +63,14 @@ python -m pip install .
|
|
|
61
63
|
|
|
62
64
|
```python
|
|
63
65
|
import os
|
|
64
|
-
from activitysmith import
|
|
66
|
+
from activitysmith import (
|
|
67
|
+
ActivitySmith,
|
|
68
|
+
action,
|
|
69
|
+
alert_badge,
|
|
70
|
+
alert_icon,
|
|
71
|
+
content_state,
|
|
72
|
+
metric,
|
|
73
|
+
)
|
|
65
74
|
|
|
66
75
|
activitysmith = ActivitySmith(
|
|
67
76
|
api_key=os.environ["ACTIVITYSMITH_API_KEY"],
|
|
@@ -147,12 +156,13 @@ activitysmith.notifications.send(
|
|
|
147
156
|
|
|
148
157
|
## Live Activities
|
|
149
158
|
|
|
150
|
-
There are
|
|
159
|
+
There are five types of Live Activities:
|
|
151
160
|
|
|
152
161
|
- `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
|
|
153
162
|
- `metrics`: best for live percentage values that change often, like server CPU, memory usage, disk usage, or error rate
|
|
154
163
|
- `segmented_progress`: best for anything that moves through clear stages, like deployments, onboarding flows, backups, ETL pipelines, migrations, and AI agent runs
|
|
155
164
|
- `progress`: best for tracking real-time progress with percentage, like tasks, backups, migrations, syncs, or uploads
|
|
165
|
+
- `alert`: best for status updates, such as feature adoption, reactivation, onboarding blockers, incidents, escalations, and other operational states
|
|
156
166
|
|
|
157
167
|
### Start & Update Live Activity
|
|
158
168
|
|
|
@@ -257,6 +267,29 @@ activitysmith.live_activities.stream(
|
|
|
257
267
|
)
|
|
258
268
|
```
|
|
259
269
|
|
|
270
|
+
#### Alert
|
|
271
|
+
|
|
272
|
+
<p align="center">
|
|
273
|
+
<img
|
|
274
|
+
src="https://cdn.activitysmith.com/features/alert-live-activity.png"
|
|
275
|
+
alt="Alert Live Activity stream example"
|
|
276
|
+
width="680"
|
|
277
|
+
/>
|
|
278
|
+
</p>
|
|
279
|
+
|
|
280
|
+
```python
|
|
281
|
+
activitysmith.live_activities.stream(
|
|
282
|
+
"customer-ops",
|
|
283
|
+
content_state=content_state(
|
|
284
|
+
title="Reactivation",
|
|
285
|
+
message="Lumen came back after 2 weeks",
|
|
286
|
+
type="alert",
|
|
287
|
+
icon=alert_icon("cloud.sun", color="yellow"),
|
|
288
|
+
badge=alert_badge("Customer", color="magenta"),
|
|
289
|
+
),
|
|
290
|
+
)
|
|
291
|
+
```
|
|
292
|
+
|
|
260
293
|
### End Live Activity
|
|
261
294
|
|
|
262
295
|
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.
|
|
@@ -280,6 +313,7 @@ activitysmith.live_activities.end_stream(
|
|
|
280
313
|
### Live Activity Action
|
|
281
314
|
|
|
282
315
|
Live Activities can include one optional action button. Use it to open a URL from the Live Activity or trigger a backend webhook.
|
|
316
|
+
For Alert Live Activities, set `content_state.color` to tint the action button. `icon.color` and `badge.color` only affect the icon and badge.
|
|
283
317
|
|
|
284
318
|
<p align="center">
|
|
285
319
|
<img
|
|
@@ -336,6 +370,67 @@ activitysmith.live_activities.stream(
|
|
|
336
370
|
)
|
|
337
371
|
```
|
|
338
372
|
|
|
373
|
+
### Icons and Badges
|
|
374
|
+
|
|
375
|
+
Add more context to Live Activities with icons and badges.
|
|
376
|
+
|
|
377
|
+
#### Icon
|
|
378
|
+
|
|
379
|
+
Supported Live Activity types: `stats`, `metrics`, `progress`, `segmented_progress`, and `alert`.
|
|
380
|
+
|
|
381
|
+
<p align="center">
|
|
382
|
+
<img src="https://cdn.activitysmith.com/features/metrics-live-activity-with-icon.png" alt="Metrics Live Activity with an SF Symbol icon on the iPhone Lock Screen" width="680" />
|
|
383
|
+
</p>
|
|
384
|
+
|
|
385
|
+
```python
|
|
386
|
+
activitysmith.live_activities.stream(
|
|
387
|
+
"prod-web-1",
|
|
388
|
+
content_state=content_state(
|
|
389
|
+
title="Server Health",
|
|
390
|
+
subtitle="prod-web-1",
|
|
391
|
+
type=activitysmith.live_activities.TYPE_METRICS,
|
|
392
|
+
icon=alert_icon("server.rack", color="blue"),
|
|
393
|
+
metrics=[
|
|
394
|
+
metric(label="CPU", value=18, unit="%"),
|
|
395
|
+
metric(label="MEM", value=42, unit="%"),
|
|
396
|
+
],
|
|
397
|
+
),
|
|
398
|
+
)
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
The `icon.symbol` value is an Apple SF Symbol name. Browse the catalog with one of these tools:
|
|
402
|
+
|
|
403
|
+
- [ActivitySmith app](https://apps.apple.com/us/app/activitysmith/id6752254835) - Open Settings -> SF Symbols to browse 45 hand-picked icons ready to use
|
|
404
|
+
- [SF Symbols](https://developer.apple.com/sf-symbols/) - Apple's official macOS app
|
|
405
|
+
- [Interactful](https://apps.apple.com/app/interactful/id1528095640) - free third-party iOS app listing all SF Symbols under Foundations -> Iconography
|
|
406
|
+
|
|
407
|
+
#### Badge
|
|
408
|
+
|
|
409
|
+
Badges are supported by `alert`, `progress`, and `segmented_progress` Live Activities.
|
|
410
|
+
|
|
411
|
+
<p align="center">
|
|
412
|
+
<img src="https://cdn.activitysmith.com/features/progress-live-activity-with-badge.png" alt="Progress Live Activity with a badge on the iPhone Lock Screen" width="680" />
|
|
413
|
+
</p>
|
|
414
|
+
|
|
415
|
+
```python
|
|
416
|
+
activitysmith.live_activities.stream(
|
|
417
|
+
"nightly-database-backup",
|
|
418
|
+
content_state=content_state(
|
|
419
|
+
title="Nightly Database Backup",
|
|
420
|
+
subtitle="verify restore",
|
|
421
|
+
type=activitysmith.live_activities.TYPE_PROGRESS,
|
|
422
|
+
badge=alert_badge("S3", color="cyan"),
|
|
423
|
+
percentage=62,
|
|
424
|
+
),
|
|
425
|
+
)
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
### Live Activity Colors
|
|
429
|
+
|
|
430
|
+
Choose from these colors for the Live Activity accent, including progress bars and action buttons, or apply them to an individual icon or badge:
|
|
431
|
+
|
|
432
|
+
`lime`, `green`, `cyan`, `blue`, `purple`, `magenta`, `red`, `orange`, `yellow`, `gray`
|
|
433
|
+
|
|
339
434
|
## Channels
|
|
340
435
|
|
|
341
436
|
Channels are used to target specific team members or devices. Can be used for both push notifications and live activities.
|
|
@@ -18,6 +18,8 @@ See the [API reference](https://activitysmith.com/docs/api-reference/introductio
|
|
|
18
18
|
- [Start & Update Live Activity](#start--update-live-activity)
|
|
19
19
|
- [End Live Activity](#end-live-activity)
|
|
20
20
|
- [Live Activity Action](#live-activity-action)
|
|
21
|
+
- [Icons and Badges](#icons-and-badges)
|
|
22
|
+
- [Live Activity Colors](#live-activity-colors)
|
|
21
23
|
- [Channels](#channels)
|
|
22
24
|
- [Widgets](#widgets)
|
|
23
25
|
|
|
@@ -39,7 +41,14 @@ python -m pip install .
|
|
|
39
41
|
|
|
40
42
|
```python
|
|
41
43
|
import os
|
|
42
|
-
from activitysmith import
|
|
44
|
+
from activitysmith import (
|
|
45
|
+
ActivitySmith,
|
|
46
|
+
action,
|
|
47
|
+
alert_badge,
|
|
48
|
+
alert_icon,
|
|
49
|
+
content_state,
|
|
50
|
+
metric,
|
|
51
|
+
)
|
|
43
52
|
|
|
44
53
|
activitysmith = ActivitySmith(
|
|
45
54
|
api_key=os.environ["ACTIVITYSMITH_API_KEY"],
|
|
@@ -125,12 +134,13 @@ activitysmith.notifications.send(
|
|
|
125
134
|
|
|
126
135
|
## Live Activities
|
|
127
136
|
|
|
128
|
-
There are
|
|
137
|
+
There are five types of Live Activities:
|
|
129
138
|
|
|
130
139
|
- `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
|
|
131
140
|
- `metrics`: best for live percentage values that change often, like server CPU, memory usage, disk usage, or error rate
|
|
132
141
|
- `segmented_progress`: best for anything that moves through clear stages, like deployments, onboarding flows, backups, ETL pipelines, migrations, and AI agent runs
|
|
133
142
|
- `progress`: best for tracking real-time progress with percentage, like tasks, backups, migrations, syncs, or uploads
|
|
143
|
+
- `alert`: best for status updates, such as feature adoption, reactivation, onboarding blockers, incidents, escalations, and other operational states
|
|
134
144
|
|
|
135
145
|
### Start & Update Live Activity
|
|
136
146
|
|
|
@@ -235,6 +245,29 @@ activitysmith.live_activities.stream(
|
|
|
235
245
|
)
|
|
236
246
|
```
|
|
237
247
|
|
|
248
|
+
#### Alert
|
|
249
|
+
|
|
250
|
+
<p align="center">
|
|
251
|
+
<img
|
|
252
|
+
src="https://cdn.activitysmith.com/features/alert-live-activity.png"
|
|
253
|
+
alt="Alert Live Activity stream example"
|
|
254
|
+
width="680"
|
|
255
|
+
/>
|
|
256
|
+
</p>
|
|
257
|
+
|
|
258
|
+
```python
|
|
259
|
+
activitysmith.live_activities.stream(
|
|
260
|
+
"customer-ops",
|
|
261
|
+
content_state=content_state(
|
|
262
|
+
title="Reactivation",
|
|
263
|
+
message="Lumen came back after 2 weeks",
|
|
264
|
+
type="alert",
|
|
265
|
+
icon=alert_icon("cloud.sun", color="yellow"),
|
|
266
|
+
badge=alert_badge("Customer", color="magenta"),
|
|
267
|
+
),
|
|
268
|
+
)
|
|
269
|
+
```
|
|
270
|
+
|
|
238
271
|
### End Live Activity
|
|
239
272
|
|
|
240
273
|
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.
|
|
@@ -258,6 +291,7 @@ activitysmith.live_activities.end_stream(
|
|
|
258
291
|
### Live Activity Action
|
|
259
292
|
|
|
260
293
|
Live Activities can include one optional action button. Use it to open a URL from the Live Activity or trigger a backend webhook.
|
|
294
|
+
For Alert Live Activities, set `content_state.color` to tint the action button. `icon.color` and `badge.color` only affect the icon and badge.
|
|
261
295
|
|
|
262
296
|
<p align="center">
|
|
263
297
|
<img
|
|
@@ -314,6 +348,67 @@ activitysmith.live_activities.stream(
|
|
|
314
348
|
)
|
|
315
349
|
```
|
|
316
350
|
|
|
351
|
+
### Icons and Badges
|
|
352
|
+
|
|
353
|
+
Add more context to Live Activities with icons and badges.
|
|
354
|
+
|
|
355
|
+
#### Icon
|
|
356
|
+
|
|
357
|
+
Supported Live Activity types: `stats`, `metrics`, `progress`, `segmented_progress`, and `alert`.
|
|
358
|
+
|
|
359
|
+
<p align="center">
|
|
360
|
+
<img src="https://cdn.activitysmith.com/features/metrics-live-activity-with-icon.png" alt="Metrics Live Activity with an SF Symbol icon on the iPhone Lock Screen" width="680" />
|
|
361
|
+
</p>
|
|
362
|
+
|
|
363
|
+
```python
|
|
364
|
+
activitysmith.live_activities.stream(
|
|
365
|
+
"prod-web-1",
|
|
366
|
+
content_state=content_state(
|
|
367
|
+
title="Server Health",
|
|
368
|
+
subtitle="prod-web-1",
|
|
369
|
+
type=activitysmith.live_activities.TYPE_METRICS,
|
|
370
|
+
icon=alert_icon("server.rack", color="blue"),
|
|
371
|
+
metrics=[
|
|
372
|
+
metric(label="CPU", value=18, unit="%"),
|
|
373
|
+
metric(label="MEM", value=42, unit="%"),
|
|
374
|
+
],
|
|
375
|
+
),
|
|
376
|
+
)
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
The `icon.symbol` value is an Apple SF Symbol name. Browse the catalog with one of these tools:
|
|
380
|
+
|
|
381
|
+
- [ActivitySmith app](https://apps.apple.com/us/app/activitysmith/id6752254835) - Open Settings -> SF Symbols to browse 45 hand-picked icons ready to use
|
|
382
|
+
- [SF Symbols](https://developer.apple.com/sf-symbols/) - Apple's official macOS app
|
|
383
|
+
- [Interactful](https://apps.apple.com/app/interactful/id1528095640) - free third-party iOS app listing all SF Symbols under Foundations -> Iconography
|
|
384
|
+
|
|
385
|
+
#### Badge
|
|
386
|
+
|
|
387
|
+
Badges are supported by `alert`, `progress`, and `segmented_progress` Live Activities.
|
|
388
|
+
|
|
389
|
+
<p align="center">
|
|
390
|
+
<img src="https://cdn.activitysmith.com/features/progress-live-activity-with-badge.png" alt="Progress Live Activity with a badge on the iPhone Lock Screen" width="680" />
|
|
391
|
+
</p>
|
|
392
|
+
|
|
393
|
+
```python
|
|
394
|
+
activitysmith.live_activities.stream(
|
|
395
|
+
"nightly-database-backup",
|
|
396
|
+
content_state=content_state(
|
|
397
|
+
title="Nightly Database Backup",
|
|
398
|
+
subtitle="verify restore",
|
|
399
|
+
type=activitysmith.live_activities.TYPE_PROGRESS,
|
|
400
|
+
badge=alert_badge("S3", color="cyan"),
|
|
401
|
+
percentage=62,
|
|
402
|
+
),
|
|
403
|
+
)
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
### Live Activity Colors
|
|
407
|
+
|
|
408
|
+
Choose from these colors for the Live Activity accent, including progress bars and action buttons, or apply them to an individual icon or badge:
|
|
409
|
+
|
|
410
|
+
`lime`, `green`, `cyan`, `blue`, `purple`, `magenta`, `red`, `orange`, `yellow`, `gray`
|
|
411
|
+
|
|
317
412
|
## Channels
|
|
318
413
|
|
|
319
414
|
Channels are used to target specific team members or devices. Can be used for both push notifications and live activities.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from .client import (
|
|
2
|
+
ActivitySmith,
|
|
3
|
+
LiveActivityColor,
|
|
4
|
+
action,
|
|
5
|
+
alert_badge,
|
|
6
|
+
alert_icon,
|
|
7
|
+
content_state,
|
|
8
|
+
metric,
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
__all__ = [
|
|
12
|
+
"ActivitySmith",
|
|
13
|
+
"LiveActivityColor",
|
|
14
|
+
"action",
|
|
15
|
+
"alert_badge",
|
|
16
|
+
"alert_icon",
|
|
17
|
+
"content_state",
|
|
18
|
+
"metric",
|
|
19
|
+
]
|
|
@@ -10,7 +10,7 @@ from activitysmith_openapi.api.live_activities_api import LiveActivitiesApi
|
|
|
10
10
|
from activitysmith_openapi.api.metrics_api import MetricsApi
|
|
11
11
|
from activitysmith_openapi.api.push_notifications_api import PushNotificationsApi
|
|
12
12
|
|
|
13
|
-
SDK_VERSION = "1.
|
|
13
|
+
SDK_VERSION = "1.6.0"
|
|
14
14
|
SDK_HEADER_NAME = "X-ActivitySmith-SDK"
|
|
15
15
|
SDK_HEADER_VALUE = f"python-v{SDK_VERSION}"
|
|
16
16
|
|
|
@@ -122,11 +122,44 @@ def action(
|
|
|
122
122
|
)
|
|
123
123
|
|
|
124
124
|
|
|
125
|
+
def alert_icon(
|
|
126
|
+
symbol: str,
|
|
127
|
+
*,
|
|
128
|
+
color: str | None = None,
|
|
129
|
+
) -> dict[str, Any]:
|
|
130
|
+
return _compact_dict(
|
|
131
|
+
{
|
|
132
|
+
"symbol": symbol,
|
|
133
|
+
"color": color,
|
|
134
|
+
}
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
def alert_badge(
|
|
139
|
+
title: str,
|
|
140
|
+
*,
|
|
141
|
+
color: str | None = None,
|
|
142
|
+
) -> dict[str, Any]:
|
|
143
|
+
return _compact_dict(
|
|
144
|
+
{
|
|
145
|
+
"title": title,
|
|
146
|
+
"color": color,
|
|
147
|
+
}
|
|
148
|
+
)
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
def _normalize_live_activity_content_state(content_state: Any) -> Any:
|
|
152
|
+
return content_state
|
|
153
|
+
|
|
154
|
+
|
|
125
155
|
def content_state(
|
|
126
156
|
title: str,
|
|
127
157
|
*,
|
|
128
158
|
type: str | None = None,
|
|
129
159
|
subtitle: str | None = None,
|
|
160
|
+
message: str | None = None,
|
|
161
|
+
icon: Any | None = None,
|
|
162
|
+
badge: Any | None = None,
|
|
130
163
|
metrics: Any | None = None,
|
|
131
164
|
number_of_steps: int | None = None,
|
|
132
165
|
current_step: int | None = None,
|
|
@@ -138,11 +171,14 @@ def content_state(
|
|
|
138
171
|
auto_dismiss_seconds: int | None = None,
|
|
139
172
|
auto_dismiss_minutes: int | None = None,
|
|
140
173
|
) -> dict[str, Any]:
|
|
141
|
-
|
|
174
|
+
state = _compact_dict(
|
|
142
175
|
{
|
|
143
176
|
"title": title,
|
|
144
177
|
"subtitle": subtitle,
|
|
145
178
|
"type": type,
|
|
179
|
+
"message": message,
|
|
180
|
+
"icon": icon,
|
|
181
|
+
"badge": badge,
|
|
146
182
|
"metrics": metrics,
|
|
147
183
|
"number_of_steps": number_of_steps,
|
|
148
184
|
"current_step": current_step,
|
|
@@ -155,6 +191,7 @@ def content_state(
|
|
|
155
191
|
"auto_dismiss_minutes": auto_dismiss_minutes,
|
|
156
192
|
}
|
|
157
193
|
)
|
|
194
|
+
return _normalize_live_activity_content_state(state)
|
|
158
195
|
|
|
159
196
|
|
|
160
197
|
def _build_push_request(
|
|
@@ -208,6 +245,7 @@ class LiveActivityColor:
|
|
|
208
245
|
RED = "red"
|
|
209
246
|
ORANGE = "orange"
|
|
210
247
|
YELLOW = "yellow"
|
|
248
|
+
GRAY = "gray"
|
|
211
249
|
|
|
212
250
|
|
|
213
251
|
def _build_live_activity_request(
|
|
@@ -218,6 +256,9 @@ def _build_live_activity_request(
|
|
|
218
256
|
title: Any | None = None,
|
|
219
257
|
subtitle: Any | None = None,
|
|
220
258
|
type: Any | None = None,
|
|
259
|
+
message: Any | None = None,
|
|
260
|
+
icon: Any | None = None,
|
|
261
|
+
badge: Any | None = None,
|
|
221
262
|
metrics: Any | None = None,
|
|
222
263
|
number_of_steps: Any | None = None,
|
|
223
264
|
current_step: Any | None = None,
|
|
@@ -238,6 +279,9 @@ def _build_live_activity_request(
|
|
|
238
279
|
"title": title,
|
|
239
280
|
"subtitle": subtitle,
|
|
240
281
|
"type": type,
|
|
282
|
+
"message": message,
|
|
283
|
+
"icon": icon,
|
|
284
|
+
"badge": badge,
|
|
241
285
|
"metrics": metrics,
|
|
242
286
|
"number_of_steps": number_of_steps,
|
|
243
287
|
"current_step": current_step,
|
|
@@ -250,6 +294,7 @@ def _build_live_activity_request(
|
|
|
250
294
|
"auto_dismiss_minutes": auto_dismiss_minutes,
|
|
251
295
|
}
|
|
252
296
|
)
|
|
297
|
+
content_state_fields = _normalize_live_activity_content_state(content_state_fields)
|
|
253
298
|
request_fields = _compact_dict(
|
|
254
299
|
{
|
|
255
300
|
"activity_id": activity_id,
|
|
@@ -273,6 +318,7 @@ def _build_live_activity_request(
|
|
|
273
318
|
)
|
|
274
319
|
|
|
275
320
|
if content_state is not None:
|
|
321
|
+
content_state = _normalize_live_activity_content_state(content_state)
|
|
276
322
|
existing_content_state = normalized.get("content_state")
|
|
277
323
|
if existing_content_state is None:
|
|
278
324
|
normalized["content_state"] = content_state
|
|
@@ -289,6 +335,9 @@ def _build_live_activity_request(
|
|
|
289
335
|
normalized["content_state"] = {**existing_content_state, **content_state_fields}
|
|
290
336
|
else:
|
|
291
337
|
raise TypeError("ActivitySmith: content_state must be a dict")
|
|
338
|
+
normalized["content_state"] = _normalize_live_activity_content_state(
|
|
339
|
+
normalized["content_state"]
|
|
340
|
+
)
|
|
292
341
|
|
|
293
342
|
normalized.update(request_fields)
|
|
294
343
|
return normalized
|
|
@@ -337,6 +386,7 @@ class LiveActivitiesResource:
|
|
|
337
386
|
TYPE_PROGRESS = "progress"
|
|
338
387
|
TYPE_METRICS = "metrics"
|
|
339
388
|
TYPE_STATS = "stats"
|
|
389
|
+
TYPE_ALERT = "alert"
|
|
340
390
|
|
|
341
391
|
def __init__(self, api: LiveActivitiesApi) -> None:
|
|
342
392
|
self._api = api
|
|
@@ -351,6 +401,22 @@ class LiveActivitiesResource:
|
|
|
351
401
|
) -> dict[str, Any]:
|
|
352
402
|
return metric(label, value, unit=unit, color=color)
|
|
353
403
|
|
|
404
|
+
@staticmethod
|
|
405
|
+
def alert_icon(
|
|
406
|
+
symbol: str,
|
|
407
|
+
*,
|
|
408
|
+
color: str | None = None,
|
|
409
|
+
) -> dict[str, Any]:
|
|
410
|
+
return alert_icon(symbol, color=color)
|
|
411
|
+
|
|
412
|
+
@staticmethod
|
|
413
|
+
def alert_badge(
|
|
414
|
+
title: str,
|
|
415
|
+
*,
|
|
416
|
+
color: str | None = None,
|
|
417
|
+
) -> dict[str, Any]:
|
|
418
|
+
return alert_badge(title, color=color)
|
|
419
|
+
|
|
354
420
|
def start(
|
|
355
421
|
self,
|
|
356
422
|
request: Any | None = None,
|
|
@@ -359,6 +425,9 @@ class LiveActivitiesResource:
|
|
|
359
425
|
title: Any | None = None,
|
|
360
426
|
subtitle: Any | None = None,
|
|
361
427
|
type: Any | None = None,
|
|
428
|
+
message: Any | None = None,
|
|
429
|
+
icon: Any | None = None,
|
|
430
|
+
badge: Any | None = None,
|
|
362
431
|
metrics: Any | None = None,
|
|
363
432
|
number_of_steps: Any | None = None,
|
|
364
433
|
current_step: Any | None = None,
|
|
@@ -378,6 +447,9 @@ class LiveActivitiesResource:
|
|
|
378
447
|
title=title,
|
|
379
448
|
subtitle=subtitle,
|
|
380
449
|
type=type,
|
|
450
|
+
message=message,
|
|
451
|
+
icon=icon,
|
|
452
|
+
badge=badge,
|
|
381
453
|
metrics=metrics,
|
|
382
454
|
number_of_steps=number_of_steps,
|
|
383
455
|
current_step=current_step,
|
|
@@ -404,6 +476,9 @@ class LiveActivitiesResource:
|
|
|
404
476
|
title: Any | None = None,
|
|
405
477
|
subtitle: Any | None = None,
|
|
406
478
|
type: Any | None = None,
|
|
479
|
+
message: Any | None = None,
|
|
480
|
+
icon: Any | None = None,
|
|
481
|
+
badge: Any | None = None,
|
|
407
482
|
metrics: Any | None = None,
|
|
408
483
|
number_of_steps: Any | None = None,
|
|
409
484
|
current_step: Any | None = None,
|
|
@@ -421,6 +496,9 @@ class LiveActivitiesResource:
|
|
|
421
496
|
title=title,
|
|
422
497
|
subtitle=subtitle,
|
|
423
498
|
type=type,
|
|
499
|
+
message=message,
|
|
500
|
+
icon=icon,
|
|
501
|
+
badge=badge,
|
|
424
502
|
metrics=metrics,
|
|
425
503
|
number_of_steps=number_of_steps,
|
|
426
504
|
current_step=current_step,
|
|
@@ -442,6 +520,9 @@ class LiveActivitiesResource:
|
|
|
442
520
|
title: Any | None = None,
|
|
443
521
|
subtitle: Any | None = None,
|
|
444
522
|
type: Any | None = None,
|
|
523
|
+
message: Any | None = None,
|
|
524
|
+
icon: Any | None = None,
|
|
525
|
+
badge: Any | None = None,
|
|
445
526
|
metrics: Any | None = None,
|
|
446
527
|
number_of_steps: Any | None = None,
|
|
447
528
|
current_step: Any | None = None,
|
|
@@ -460,6 +541,9 @@ class LiveActivitiesResource:
|
|
|
460
541
|
title=title,
|
|
461
542
|
subtitle=subtitle,
|
|
462
543
|
type=type,
|
|
544
|
+
message=message,
|
|
545
|
+
icon=icon,
|
|
546
|
+
badge=badge,
|
|
463
547
|
metrics=metrics,
|
|
464
548
|
number_of_steps=number_of_steps,
|
|
465
549
|
current_step=current_step,
|
|
@@ -482,6 +566,9 @@ class LiveActivitiesResource:
|
|
|
482
566
|
title: Any | None = None,
|
|
483
567
|
subtitle: Any | None = None,
|
|
484
568
|
type: Any | None = None,
|
|
569
|
+
message: Any | None = None,
|
|
570
|
+
icon: Any | None = None,
|
|
571
|
+
badge: Any | None = None,
|
|
485
572
|
metrics: Any | None = None,
|
|
486
573
|
number_of_steps: Any | None = None,
|
|
487
574
|
current_step: Any | None = None,
|
|
@@ -501,6 +588,9 @@ class LiveActivitiesResource:
|
|
|
501
588
|
title=title,
|
|
502
589
|
subtitle=subtitle,
|
|
503
590
|
type=type,
|
|
591
|
+
message=message,
|
|
592
|
+
icon=icon,
|
|
593
|
+
badge=badge,
|
|
504
594
|
metrics=metrics,
|
|
505
595
|
number_of_steps=number_of_steps,
|
|
506
596
|
current_step=current_step,
|
|
@@ -528,6 +618,9 @@ class LiveActivitiesResource:
|
|
|
528
618
|
title: Any | None = None,
|
|
529
619
|
subtitle: Any | None = None,
|
|
530
620
|
type: Any | None = None,
|
|
621
|
+
message: Any | None = None,
|
|
622
|
+
icon: Any | None = None,
|
|
623
|
+
badge: Any | None = None,
|
|
531
624
|
metrics: Any | None = None,
|
|
532
625
|
number_of_steps: Any | None = None,
|
|
533
626
|
current_step: Any | None = None,
|
|
@@ -546,6 +639,9 @@ class LiveActivitiesResource:
|
|
|
546
639
|
title=title,
|
|
547
640
|
subtitle=subtitle,
|
|
548
641
|
type=type,
|
|
642
|
+
message=message,
|
|
643
|
+
icon=icon,
|
|
644
|
+
badge=badge,
|
|
549
645
|
metrics=metrics,
|
|
550
646
|
number_of_steps=number_of_steps,
|
|
551
647
|
current_step=current_step,
|