activitysmith 1.4.0__tar.gz → 1.4.2__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/PKG-INFO +392 -0
- activitysmith-1.4.2/README.md +370 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith/client.py +1 -1
- activitysmith-1.4.2/activitysmith.egg-info/PKG-INFO +392 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/pyproject.toml +1 -1
- activitysmith-1.4.0/PKG-INFO +0 -704
- activitysmith-1.4.0/README.md +0 -682
- activitysmith-1.4.0/activitysmith.egg-info/PKG-INFO +0 -704
- {activitysmith-1.4.0 → activitysmith-1.4.2}/LICENSE +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith/__init__.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith.egg-info/SOURCES.txt +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith.egg-info/dependency_links.txt +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith.egg-info/requires.txt +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith.egg-info/top_level.txt +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/__init__.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/api/__init__.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/api/live_activities_api.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/api/metrics_api.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/api/push_notifications_api.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/api_client.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/api_response.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/configuration.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/exceptions.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/models/__init__.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/models/activity_metric.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/models/activity_metric_value.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/models/alert_payload.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/models/bad_request_error.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/models/channel_target.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/models/content_state_end.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/models/content_state_start.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/models/content_state_update.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/models/forbidden_error.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/models/live_activity_action.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/models/live_activity_action_type.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/models/live_activity_end_request.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/models/live_activity_end_response.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/models/live_activity_limit_error.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/models/live_activity_start_request.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/models/live_activity_start_response.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/models/live_activity_stream_delete_request.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/models/live_activity_stream_delete_response.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/models/live_activity_stream_put_response.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/models/live_activity_stream_request.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/models/live_activity_update_request.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/models/live_activity_update_response.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/models/live_activity_webhook_method.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/models/metric_error.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/models/metric_value_update_request.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/models/metric_value_update_request_value.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/models/metric_value_update_response.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/models/no_recipients_error.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/models/not_found_error.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/models/push_notification_action.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/models/push_notification_action_type.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/models/push_notification_request.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/models/push_notification_response.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/models/push_notification_webhook_method.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/models/rate_limit_error.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/models/send_push_notification429_response.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/models/stream_content_state.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/rest.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/test/__init__.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/test/test_activity_metric.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/test/test_activity_metric_value.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/test/test_alert_payload.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/test/test_bad_request_error.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/test/test_channel_target.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/test/test_content_state_end.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/test/test_content_state_start.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/test/test_content_state_update.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/test/test_forbidden_error.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/test/test_live_activities_api.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/test/test_live_activity_action.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/test/test_live_activity_action_type.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/test/test_live_activity_end_request.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/test/test_live_activity_end_response.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/test/test_live_activity_limit_error.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/test/test_live_activity_start_request.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/test/test_live_activity_start_response.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/test/test_live_activity_stream_delete_request.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/test/test_live_activity_stream_delete_response.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/test/test_live_activity_stream_put_response.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/test/test_live_activity_stream_request.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/test/test_live_activity_update_request.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/test/test_live_activity_update_response.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/test/test_live_activity_webhook_method.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/test/test_metric_error.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/test/test_metric_value_update_request.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/test/test_metric_value_update_request_value.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/test/test_metric_value_update_response.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/test/test_metrics_api.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/test/test_no_recipients_error.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/test/test_not_found_error.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/test/test_push_notification_action.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/test/test_push_notification_action_type.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/test/test_push_notification_request.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/test/test_push_notification_response.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/test/test_push_notification_webhook_method.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/test/test_push_notifications_api.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/test/test_rate_limit_error.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/test/test_send_push_notification429_response.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/activitysmith_openapi/test/test_stream_content_state.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/setup.cfg +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/tests/test_resources.py +0 -0
- {activitysmith-1.4.0 → activitysmith-1.4.2}/tests/test_smoke.py +0 -0
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: activitysmith
|
|
3
|
+
Version: 1.4.2
|
|
4
|
+
Summary: Official ActivitySmith Python SDK
|
|
5
|
+
Author-email: ActivitySmith <adam@activitysmith.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: homepage, https://activitysmith.com
|
|
8
|
+
Project-URL: documentation, https://activitysmith.com/docs
|
|
9
|
+
Project-URL: source, https://github.com/ActivitySmithHQ/activitysmith-python
|
|
10
|
+
Project-URL: issues, https://github.com/ActivitySmithHQ/activitysmith-python/issues
|
|
11
|
+
Keywords: activitysmith,live activities,push notifications,api,sdk
|
|
12
|
+
Requires-Python: >=3.9
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Requires-Dist: urllib3>=1.25.3
|
|
16
|
+
Requires-Dist: python-dateutil>=2.8.2
|
|
17
|
+
Requires-Dist: pydantic>=2
|
|
18
|
+
Provides-Extra: dev
|
|
19
|
+
Requires-Dist: pytest>=7; extra == "dev"
|
|
20
|
+
Requires-Dist: ruff>=0.5; extra == "dev"
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
# ActivitySmith Python Library
|
|
24
|
+
|
|
25
|
+
The ActivitySmith Python library provides convenient access to the ActivitySmith API from Python applications.
|
|
26
|
+
|
|
27
|
+
## Documentation
|
|
28
|
+
|
|
29
|
+
See the [API reference](https://activitysmith.com/docs/api-reference/introduction).
|
|
30
|
+
|
|
31
|
+
## Table of Contents
|
|
32
|
+
|
|
33
|
+
- [Installation](#installation)
|
|
34
|
+
- [Setup](#setup)
|
|
35
|
+
- [Push Notifications](#push-notifications)
|
|
36
|
+
- [Send a Push Notification](#send-a-push-notification)
|
|
37
|
+
- [Rich Push Notifications with Media](#rich-push-notifications-with-media)
|
|
38
|
+
- [Actionable Push Notifications](#actionable-push-notifications)
|
|
39
|
+
- [Live Activities](#live-activities)
|
|
40
|
+
- [Start & Update Live Activity](#start--update-live-activity)
|
|
41
|
+
- [End Live Activity](#end-live-activity)
|
|
42
|
+
- [Live Activity Action](#live-activity-action)
|
|
43
|
+
- [Channels](#channels)
|
|
44
|
+
- [Widgets](#widgets)
|
|
45
|
+
|
|
46
|
+
## Installation
|
|
47
|
+
|
|
48
|
+
This package is available on PyPI:
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
pip install activitysmith
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Alternatively, install from source with:
|
|
55
|
+
|
|
56
|
+
```sh
|
|
57
|
+
python -m pip install .
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Setup
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
import os
|
|
64
|
+
from activitysmith import ActivitySmith, action, content_state, metric
|
|
65
|
+
|
|
66
|
+
activitysmith = ActivitySmith(
|
|
67
|
+
api_key=os.environ["ACTIVITYSMITH_API_KEY"],
|
|
68
|
+
)
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Push Notifications
|
|
72
|
+
|
|
73
|
+
### Send a Push Notification
|
|
74
|
+
|
|
75
|
+
<p align="center">
|
|
76
|
+
<img src="https://cdn.activitysmith.com/features/new-subscription-push-notification.png" alt="Push notification example" width="680" />
|
|
77
|
+
</p>
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
activitysmith.notifications.send(
|
|
81
|
+
title="New subscription 💸",
|
|
82
|
+
message="Customer upgraded to Pro plan",
|
|
83
|
+
)
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Rich Push Notifications with Media
|
|
87
|
+
|
|
88
|
+
<p align="center">
|
|
89
|
+
<img src="https://cdn.activitysmith.com/features/rich-push-notification-with-image.png" alt="Rich push notification with image" width="680" />
|
|
90
|
+
</p>
|
|
91
|
+
|
|
92
|
+
```python
|
|
93
|
+
activitysmith.notifications.send(
|
|
94
|
+
title="Homepage ready",
|
|
95
|
+
message="Your agent finished the redesign.",
|
|
96
|
+
media="https://cdn.example.com/output/homepage-v2.png",
|
|
97
|
+
redirection="https://github.com/acme/web/pull/482",
|
|
98
|
+
)
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Send images, videos, or audio with your push notifications, press and hold to preview media directly from the notification, then tap through to open the linked content.
|
|
102
|
+
|
|
103
|
+
<p align="center">
|
|
104
|
+
<img src="https://cdn.activitysmith.com/features/rich-push-notification-with-audio.png" alt="Rich push notification with audio" width="680" />
|
|
105
|
+
</p>
|
|
106
|
+
|
|
107
|
+
What will work:
|
|
108
|
+
|
|
109
|
+
- direct image URL: `.jpg`, `.png`, `.gif`, etc.
|
|
110
|
+
- direct audio file URL: `.mp3`, `.m4a`, etc.
|
|
111
|
+
- direct video file URL: `.mp4`, `.mov`, etc.
|
|
112
|
+
- URL that responds with a proper media `Content-Type`, even if the path has no extension
|
|
113
|
+
|
|
114
|
+
### Actionable Push Notifications
|
|
115
|
+
|
|
116
|
+
<p align="center">
|
|
117
|
+
<img src="https://cdn.activitysmith.com/features/actionable-push-notifications-2.png" alt="Actionable push notification example" width="680" />
|
|
118
|
+
</p>
|
|
119
|
+
|
|
120
|
+
Actionable push notifications can open a URL on tap or trigger actions when someone long-presses the notification.
|
|
121
|
+
Webhooks are executed by the ActivitySmith backend.
|
|
122
|
+
|
|
123
|
+
```python
|
|
124
|
+
activitysmith.notifications.send(
|
|
125
|
+
title="New subscription 💸",
|
|
126
|
+
message="Customer upgraded to Pro plan",
|
|
127
|
+
redirection="https://crm.example.com/customers/cus_9f3a1d", # Optional
|
|
128
|
+
actions=[ # Optional (max 4)
|
|
129
|
+
action(
|
|
130
|
+
title="Open CRM Profile",
|
|
131
|
+
type="open_url",
|
|
132
|
+
url="https://crm.example.com/customers/cus_9f3a1d",
|
|
133
|
+
),
|
|
134
|
+
action(
|
|
135
|
+
title="Start Onboarding Workflow",
|
|
136
|
+
type="webhook",
|
|
137
|
+
url="https://hooks.example.com/activitysmith/onboarding/start",
|
|
138
|
+
method="POST",
|
|
139
|
+
body={
|
|
140
|
+
"customer_id": "cus_9f3a1d",
|
|
141
|
+
"plan": "pro",
|
|
142
|
+
},
|
|
143
|
+
),
|
|
144
|
+
],
|
|
145
|
+
)
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Live Activities
|
|
149
|
+
|
|
150
|
+
There are four types of Live Activities:
|
|
151
|
+
|
|
152
|
+
- `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
|
+
- `metrics`: best for live percentage values that change often, like server CPU, memory usage, disk usage, or error rate
|
|
154
|
+
- `segmented_progress`: best for anything that moves through clear stages, like deployments, onboarding flows, backups, ETL pipelines, migrations, and AI agent runs
|
|
155
|
+
- `progress`: best for tracking real-time progress with percentage, like tasks, backups, migrations, syncs, or uploads
|
|
156
|
+
|
|
157
|
+
### Start & Update Live Activity
|
|
158
|
+
|
|
159
|
+
Use a stable `stream_key` to identify the metric, job, deployment, or system you want to keep visible. The first `stream(...)` call starts the Live Activity. Later calls with the same `stream_key` update it.
|
|
160
|
+
|
|
161
|
+
#### Stats
|
|
162
|
+
|
|
163
|
+
<p align="center">
|
|
164
|
+
<img
|
|
165
|
+
src="https://cdn.activitysmith.com/features/stats-live-activity.png"
|
|
166
|
+
alt="Stats Live Activity stream example"
|
|
167
|
+
width="680"
|
|
168
|
+
/>
|
|
169
|
+
</p>
|
|
170
|
+
|
|
171
|
+
```python
|
|
172
|
+
activitysmith.live_activities.stream(
|
|
173
|
+
"sales-hourly",
|
|
174
|
+
content_state=content_state(
|
|
175
|
+
title="Sales",
|
|
176
|
+
subtitle="last hour",
|
|
177
|
+
type="stats",
|
|
178
|
+
metrics=[
|
|
179
|
+
metric(label="Revenue", value="$2430", color="blue"),
|
|
180
|
+
metric(label="Orders", value="37", color="green"),
|
|
181
|
+
metric(label="Conversion", value="4.8%", color="magenta"),
|
|
182
|
+
metric(label="Avg Order", value="$65.68", color="yellow"),
|
|
183
|
+
metric(label="Refunds", value="$84", color="red"),
|
|
184
|
+
metric(label="New Buyers", value="18", color="cyan"),
|
|
185
|
+
],
|
|
186
|
+
),
|
|
187
|
+
)
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
#### Metrics
|
|
191
|
+
|
|
192
|
+
<p align="center">
|
|
193
|
+
<img
|
|
194
|
+
src="https://cdn.activitysmith.com/features/metrics-live-activity-start.png"
|
|
195
|
+
alt="Metrics Live Activity stream example"
|
|
196
|
+
width="680"
|
|
197
|
+
/>
|
|
198
|
+
</p>
|
|
199
|
+
|
|
200
|
+
```python
|
|
201
|
+
activitysmith.live_activities.stream(
|
|
202
|
+
"prod-web-1",
|
|
203
|
+
content_state=content_state(
|
|
204
|
+
title="Server Health",
|
|
205
|
+
subtitle="prod-web-1",
|
|
206
|
+
type="metrics",
|
|
207
|
+
metrics=[
|
|
208
|
+
metric(label="CPU", value=9, unit="%"),
|
|
209
|
+
metric(label="MEM", value=45, unit="%"),
|
|
210
|
+
],
|
|
211
|
+
),
|
|
212
|
+
)
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
#### Segmented Progress
|
|
216
|
+
|
|
217
|
+
<p align="center">
|
|
218
|
+
<img
|
|
219
|
+
src="https://cdn.activitysmith.com/features/update-live-activity.png"
|
|
220
|
+
alt="Segmented Progress Live Activity stream example"
|
|
221
|
+
width="680"
|
|
222
|
+
/>
|
|
223
|
+
</p>
|
|
224
|
+
|
|
225
|
+
```python
|
|
226
|
+
activitysmith.live_activities.stream(
|
|
227
|
+
"nightly-backup",
|
|
228
|
+
content_state=content_state(
|
|
229
|
+
title="Nightly Backup",
|
|
230
|
+
subtitle="upload archive",
|
|
231
|
+
type="segmented_progress",
|
|
232
|
+
number_of_steps=3,
|
|
233
|
+
current_step=2,
|
|
234
|
+
),
|
|
235
|
+
)
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
#### Progress
|
|
239
|
+
|
|
240
|
+
<p align="center">
|
|
241
|
+
<img
|
|
242
|
+
src="https://cdn.activitysmith.com/features/progress-live-activity.png"
|
|
243
|
+
alt="Progress Live Activity stream example"
|
|
244
|
+
width="680"
|
|
245
|
+
/>
|
|
246
|
+
</p>
|
|
247
|
+
|
|
248
|
+
```python
|
|
249
|
+
activitysmith.live_activities.stream(
|
|
250
|
+
"search-reindex",
|
|
251
|
+
content_state=content_state(
|
|
252
|
+
title="Search Reindex",
|
|
253
|
+
subtitle="catalog-v2",
|
|
254
|
+
type="progress",
|
|
255
|
+
percentage=42,
|
|
256
|
+
),
|
|
257
|
+
)
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### End Live Activity
|
|
261
|
+
|
|
262
|
+
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.
|
|
263
|
+
|
|
264
|
+
```python
|
|
265
|
+
activitysmith.live_activities.end_stream(
|
|
266
|
+
"prod-web-1",
|
|
267
|
+
content_state=content_state(
|
|
268
|
+
title="Server Health",
|
|
269
|
+
subtitle="prod-web-1",
|
|
270
|
+
type="metrics",
|
|
271
|
+
metrics=[
|
|
272
|
+
metric(label="CPU", value=7, unit="%"),
|
|
273
|
+
metric(label="MEM", value=38, unit="%"),
|
|
274
|
+
],
|
|
275
|
+
auto_dismiss_minutes=2,
|
|
276
|
+
),
|
|
277
|
+
)
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
### Live Activity Action
|
|
281
|
+
|
|
282
|
+
Live Activities can include one optional action button. Use it to open a URL from the Live Activity or trigger a backend webhook.
|
|
283
|
+
|
|
284
|
+
<p align="center">
|
|
285
|
+
<img
|
|
286
|
+
src="https://cdn.activitysmith.com/features/live-activity-with-action.png?v=20260319-1"
|
|
287
|
+
alt="Live Activity with action button"
|
|
288
|
+
width="680"
|
|
289
|
+
/>
|
|
290
|
+
</p>
|
|
291
|
+
|
|
292
|
+
#### Open URL action
|
|
293
|
+
|
|
294
|
+
```python
|
|
295
|
+
activitysmith.live_activities.stream(
|
|
296
|
+
"prod-web-1",
|
|
297
|
+
content_state=content_state(
|
|
298
|
+
title="Server Health",
|
|
299
|
+
subtitle="prod-web-1",
|
|
300
|
+
type="metrics",
|
|
301
|
+
metrics=[
|
|
302
|
+
metric(label="CPU", value=76, unit="%"),
|
|
303
|
+
metric(label="MEM", value=52, unit="%"),
|
|
304
|
+
],
|
|
305
|
+
),
|
|
306
|
+
action=action(
|
|
307
|
+
title="Open Dashboard",
|
|
308
|
+
type="open_url",
|
|
309
|
+
url="https://ops.example.com/servers/prod-web-1",
|
|
310
|
+
),
|
|
311
|
+
)
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
#### Webhook action
|
|
315
|
+
|
|
316
|
+
```python
|
|
317
|
+
activitysmith.live_activities.stream(
|
|
318
|
+
"search-reindex",
|
|
319
|
+
content_state=content_state(
|
|
320
|
+
title="Reindexing product search",
|
|
321
|
+
subtitle="Shard 7 of 12",
|
|
322
|
+
type="segmented_progress",
|
|
323
|
+
number_of_steps=12,
|
|
324
|
+
current_step=7,
|
|
325
|
+
),
|
|
326
|
+
action=action(
|
|
327
|
+
title="Pause Reindex",
|
|
328
|
+
type="webhook",
|
|
329
|
+
url="https://ops.example.com/hooks/search/reindex/pause",
|
|
330
|
+
method="POST",
|
|
331
|
+
body={
|
|
332
|
+
"job_id": "reindex-2026-03-19",
|
|
333
|
+
"requested_by": "activitysmith-python",
|
|
334
|
+
},
|
|
335
|
+
),
|
|
336
|
+
)
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
## Channels
|
|
340
|
+
|
|
341
|
+
Channels are used to target specific team members or devices. Can be used for both push notifications and live activities.
|
|
342
|
+
|
|
343
|
+
```python
|
|
344
|
+
activitysmith.notifications.send(
|
|
345
|
+
title="New subscription 💸",
|
|
346
|
+
message="Customer upgraded to Pro plan",
|
|
347
|
+
channels=["sales", "customer-success"], # Optional
|
|
348
|
+
)
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
## Widgets
|
|
352
|
+
|
|
353
|
+
<p align="center">
|
|
354
|
+
<img src="https://cdn.activitysmith.com/features/lock-screen-widgets.png" alt="Lock screen widgets" width="680" />
|
|
355
|
+
</p>
|
|
356
|
+
|
|
357
|
+
ActivitySmith lets you display any value on your Lock Screen with widgets - SaaS metrics, revenue, signups, uptime, habits, or anything else you want to track. Create a metric in the <a href="https://activitysmith.com/app/widgets" target="_blank" rel="noopener noreferrer">web app</a>, then update the metric value using our API, add a widget to your lock screen and it will fetch the latest update automatically.
|
|
358
|
+
|
|
359
|
+
<p align="center">
|
|
360
|
+
<img src="https://cdn.activitysmith.com/features/create-widget-metric.png" alt="Create widget metric" width="680" />
|
|
361
|
+
</p>
|
|
362
|
+
|
|
363
|
+
```python
|
|
364
|
+
activitysmith.metrics.update("deploy.success_rate", 99.9)
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
String metric values work too.
|
|
368
|
+
|
|
369
|
+
```python
|
|
370
|
+
activitysmith.metrics.update("prod.status", "healthy")
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
## Error Handling
|
|
374
|
+
|
|
375
|
+
```python
|
|
376
|
+
try:
|
|
377
|
+
activitysmith.notifications.send(
|
|
378
|
+
title="New subscription 💸",
|
|
379
|
+
)
|
|
380
|
+
except Exception as err:
|
|
381
|
+
print("Request failed:", err)
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
Request/response models are included and can be imported from `activitysmith_openapi.models`.
|
|
385
|
+
|
|
386
|
+
## Requirements
|
|
387
|
+
|
|
388
|
+
- Python 3.9 or newer
|
|
389
|
+
|
|
390
|
+
## License
|
|
391
|
+
|
|
392
|
+
MIT
|