activitysmith 1.3.0 → 1.4.0
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.
- checksums.yaml +4 -4
- data/README.md +69 -364
- data/generated/activitysmith_openapi/api/live_activities_api.rb +16 -16
- data/generated/activitysmith_openapi/models/activity_metric.rb +2 -2
- data/generated/activitysmith_openapi/models/content_state_end.rb +58 -11
- data/generated/activitysmith_openapi/models/content_state_start.rb +58 -11
- data/generated/activitysmith_openapi/models/content_state_update.rb +58 -11
- data/generated/activitysmith_openapi/models/live_activity_alert_badge.rb +273 -0
- data/generated/activitysmith_openapi/models/live_activity_alert_icon.rb +274 -0
- data/generated/activitysmith_openapi/models/live_activity_color.rb +48 -0
- data/generated/activitysmith_openapi/models/stream_content_state.rb +58 -11
- data/generated/activitysmith_openapi/version.rb +1 -1
- data/generated/activitysmith_openapi.rb +3 -0
- data/lib/activitysmith/live_activities.rb +57 -10
- data/lib/activitysmith/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 34f1236d70e7c0a571966c66fee6c6c336a4bb21c7dd139640e87c9221eee214
|
|
4
|
+
data.tar.gz: dc381048f626f8bee8d38309f802665f1b500d5867d762cc03d1d33285e5b18e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 81ba38f68b643bd772b070cb1fe41a1508be65fee8a333dc2ab9612d3b1086862aa832523c2386b62c7704debf148df1a572ee8928e3c790c6c856dbf8c5a707
|
|
7
|
+
data.tar.gz: 5e4ff4d86a8ab98de278ebf84e6356b66592b14086cc0bcc324c0d7c08b1f5144264d9f152f7efa9175b45f26991cc4993e7cb6ddd70cf883e1122aaf7263f50
|
data/README.md
CHANGED
|
@@ -15,12 +15,8 @@ See [API reference](https://activitysmith.com/docs/api-reference/introduction).
|
|
|
15
15
|
- [Rich Push Notifications with Media](#rich-push-notifications-with-media)
|
|
16
16
|
- [Actionable Push Notifications](#actionable-push-notifications)
|
|
17
17
|
- [Live Activities](#live-activities)
|
|
18
|
-
- [
|
|
19
|
-
- [
|
|
20
|
-
- [Stats Type](#stats-type)
|
|
21
|
-
- [Metrics Type](#metrics-type)
|
|
22
|
-
- [Segmented Progress Type](#segmented-progress-type)
|
|
23
|
-
- [Progress Type](#progress-type)
|
|
18
|
+
- [Start & Update Live Activity](#start--update-live-activity)
|
|
19
|
+
- [End Live Activity](#end-live-activity)
|
|
24
20
|
- [Live Activity Action](#live-activity-action)
|
|
25
21
|
- [Channels](#channels)
|
|
26
22
|
- [Widgets](#widgets)
|
|
@@ -124,47 +120,30 @@ activitysmith.notifications.send(
|
|
|
124
120
|
|
|
125
121
|
## Live Activities
|
|
126
122
|
|
|
127
|
-
|
|
128
|
-
<img src="https://cdn.activitysmith.com/features/metrics-live-activity-action.png" alt="Metrics Live Activity screenshot" width="680" />
|
|
129
|
-
</p>
|
|
130
|
-
|
|
131
|
-
There are four types of Live Activities:
|
|
132
|
-
|
|
133
|
-
- `stats`: best for compact business or product stats like revenue, orders, conversion, and average order value
|
|
134
|
-
- `metrics`: best for live operational stats like server CPU and memory, queue depth, or replica lag
|
|
135
|
-
- `segmented_progress`: best for step-based workflows like deployments, backups, and ETL pipelines
|
|
136
|
-
- `progress`: best for continuous jobs like uploads, reindexes, and long-running migrations tracked as a percentage
|
|
137
|
-
|
|
138
|
-
When working with Live Activities via our API, you have two approaches tailored
|
|
139
|
-
to different needs. First, the stateless mode is the simplest path - one API
|
|
140
|
-
call can initiate or update an activity, and another ends it - no state
|
|
141
|
-
tracking on your side.
|
|
142
|
-
|
|
143
|
-
This is ideal if you want minimal complexity, perfect for automated workflows
|
|
144
|
-
like cron jobs.
|
|
145
|
-
|
|
146
|
-
In contrast, if you need precise lifecycle control, the classic approach offers
|
|
147
|
-
distinct calls for start, updates, and end, giving you full control over the
|
|
148
|
-
activity's state.
|
|
123
|
+
There are five types of Live Activities:
|
|
149
124
|
|
|
150
|
-
|
|
151
|
-
|
|
125
|
+
- `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
|
|
126
|
+
- `metrics`: best for live percentage values that change often, like server CPU, memory usage, disk usage, or error rate
|
|
127
|
+
- `segmented_progress`: best for anything that moves through clear stages, like deployments, onboarding flows, backups, ETL pipelines, migrations, and AI agent runs
|
|
128
|
+
- `progress`: best for tracking real-time progress with percentage, like tasks, backups, migrations, syncs, or uploads
|
|
129
|
+
- `alert`: best for status updates, such as feature adoption, reactivation, onboarding blockers, incidents, escalations, and other operational states
|
|
152
130
|
|
|
153
|
-
###
|
|
131
|
+
### Start & Update Live Activity
|
|
154
132
|
|
|
155
|
-
Use a stable `stream_key` to identify the
|
|
156
|
-
such as a server, deployment, build pipeline, cron job, or charging session.
|
|
157
|
-
This is especially useful for cron jobs and other scheduled tasks where you do
|
|
158
|
-
not want to store `activity_id` between runs.
|
|
133
|
+
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.
|
|
159
134
|
|
|
160
135
|
#### Stats
|
|
161
136
|
|
|
162
137
|
<p align="center">
|
|
163
|
-
<img
|
|
138
|
+
<img
|
|
139
|
+
src="https://cdn.activitysmith.com/features/stats-live-activity.png"
|
|
140
|
+
alt="Stats Live Activity stream example"
|
|
141
|
+
width="680"
|
|
142
|
+
/>
|
|
164
143
|
</p>
|
|
165
144
|
|
|
166
145
|
```ruby
|
|
167
|
-
|
|
146
|
+
activitysmith.live_activities.stream(
|
|
168
147
|
"sales-hourly",
|
|
169
148
|
{
|
|
170
149
|
content_state: {
|
|
@@ -187,11 +166,15 @@ status = activitysmith.live_activities.stream(
|
|
|
187
166
|
#### Metrics
|
|
188
167
|
|
|
189
168
|
<p align="center">
|
|
190
|
-
<img
|
|
169
|
+
<img
|
|
170
|
+
src="https://cdn.activitysmith.com/features/metrics-live-activity-start.png"
|
|
171
|
+
alt="Metrics Live Activity stream example"
|
|
172
|
+
width="680"
|
|
173
|
+
/>
|
|
191
174
|
</p>
|
|
192
175
|
|
|
193
176
|
```ruby
|
|
194
|
-
|
|
177
|
+
activitysmith.live_activities.stream(
|
|
195
178
|
"prod-web-1",
|
|
196
179
|
{
|
|
197
180
|
content_state: {
|
|
@@ -207,10 +190,14 @@ status = activitysmith.live_activities.stream(
|
|
|
207
190
|
)
|
|
208
191
|
```
|
|
209
192
|
|
|
210
|
-
#### Segmented
|
|
193
|
+
#### Segmented Progress
|
|
211
194
|
|
|
212
195
|
<p align="center">
|
|
213
|
-
<img
|
|
196
|
+
<img
|
|
197
|
+
src="https://cdn.activitysmith.com/features/update-live-activity.png"
|
|
198
|
+
alt="Segmented Progress Live Activity stream example"
|
|
199
|
+
width="680"
|
|
200
|
+
/>
|
|
214
201
|
</p>
|
|
215
202
|
|
|
216
203
|
```ruby
|
|
@@ -231,7 +218,11 @@ activitysmith.live_activities.stream(
|
|
|
231
218
|
#### Progress
|
|
232
219
|
|
|
233
220
|
<p align="center">
|
|
234
|
-
<img
|
|
221
|
+
<img
|
|
222
|
+
src="https://cdn.activitysmith.com/features/progress-live-activity.png"
|
|
223
|
+
alt="Progress Live Activity stream example"
|
|
224
|
+
width="680"
|
|
225
|
+
/>
|
|
235
226
|
</p>
|
|
236
227
|
|
|
237
228
|
```ruby
|
|
@@ -248,197 +239,47 @@ activitysmith.live_activities.stream(
|
|
|
248
239
|
)
|
|
249
240
|
```
|
|
250
241
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
#### End a stream
|
|
254
|
-
|
|
255
|
-
Use this when the tracked process is finished and you no longer want the Live
|
|
256
|
-
Activity on devices. `content_state` is optional here; include it if you want
|
|
257
|
-
to end the stream with a final state.
|
|
258
|
-
|
|
259
|
-
```ruby
|
|
260
|
-
activitysmith.live_activities.end_stream(
|
|
261
|
-
"prod-web-1",
|
|
262
|
-
{
|
|
263
|
-
content_state: {
|
|
264
|
-
title: "Server Health",
|
|
265
|
-
subtitle: "prod-web-1",
|
|
266
|
-
type: "metrics",
|
|
267
|
-
metrics: [
|
|
268
|
-
{ label: "CPU", value: 7, unit: "%" },
|
|
269
|
-
{ label: "MEM", value: 38, unit: "%" }
|
|
270
|
-
]
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
)
|
|
274
|
-
```
|
|
275
|
-
|
|
276
|
-
If you later send another `stream(...)` request with the same `stream_key`,
|
|
277
|
-
ActivitySmith starts a new Live Activity for that stream again.
|
|
278
|
-
|
|
279
|
-
Stream responses include an `operation` field:
|
|
280
|
-
|
|
281
|
-
- `started`: ActivitySmith started a new Live Activity for this `stream_key`
|
|
282
|
-
- `updated`: ActivitySmith updated the current Live Activity
|
|
283
|
-
- `rotated`: ActivitySmith ended the previous Live Activity and started a new one
|
|
284
|
-
- `noop`: the incoming state matched the current state, so no update was sent
|
|
285
|
-
- `paused`: the stream is paused, so no Live Activity was started or updated
|
|
286
|
-
- `ended`: returned by `end_stream(...)` after the stream is ended
|
|
287
|
-
|
|
288
|
-
### Advanced: Full lifecycle control
|
|
289
|
-
|
|
290
|
-
Use these methods when you want to manage the Live Activity lifecycle yourself:
|
|
291
|
-
|
|
292
|
-
1. Call `activitysmith.live_activities.start(...)`.
|
|
293
|
-
2. Save the returned `activity_id`.
|
|
294
|
-
3. Call `activitysmith.live_activities.update(...)` as progress changes.
|
|
295
|
-
4. Call `activitysmith.live_activities.end(...)` when the work is finished.
|
|
296
|
-
|
|
297
|
-
### Stats Type
|
|
298
|
-
|
|
299
|
-
Keep your key numbers on your Lock Screen. `stats` fits 1 to 8 labeled values,
|
|
300
|
-
such as revenue, orders, conversion, uptime, or any other business metric you
|
|
301
|
-
want visible at a glance. Each metric can use a formatted string or number as
|
|
302
|
-
its `value`. Add `color` to a metric to show an accent dot next to its label;
|
|
303
|
-
omit `color` to show the label without a dot.
|
|
304
|
-
|
|
305
|
-
#### Start
|
|
242
|
+
#### Alert
|
|
306
243
|
|
|
307
244
|
<p align="center">
|
|
308
|
-
<img
|
|
245
|
+
<img
|
|
246
|
+
src="https://cdn.activitysmith.com/features/alert-live-activity.png"
|
|
247
|
+
alt="Alert Live Activity stream example"
|
|
248
|
+
width="680"
|
|
249
|
+
/>
|
|
309
250
|
</p>
|
|
310
251
|
|
|
311
252
|
```ruby
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
content_state: {
|
|
315
|
-
title: "Sales",
|
|
316
|
-
subtitle: "last hour",
|
|
317
|
-
type: "stats",
|
|
318
|
-
metrics: [
|
|
319
|
-
{ label: "Revenue", value: "$2430", color: "blue" },
|
|
320
|
-
{ label: "Orders", value: "37", color: "green" },
|
|
321
|
-
{ label: "Conversion", value: "4.8%", color: "magenta" },
|
|
322
|
-
{ label: "Avg Order", value: "$65.68", color: "yellow" },
|
|
323
|
-
{ label: "Refunds", value: "$84", color: "red" },
|
|
324
|
-
{ label: "New Buyers", value: "18", color: "cyan" }
|
|
325
|
-
]
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
)
|
|
329
|
-
|
|
330
|
-
activity_id = start.activity_id
|
|
331
|
-
```
|
|
332
|
-
|
|
333
|
-
#### Update
|
|
334
|
-
|
|
335
|
-
```ruby
|
|
336
|
-
activitysmith.live_activities.update(
|
|
253
|
+
activitysmith.live_activities.stream(
|
|
254
|
+
"customer-ops",
|
|
337
255
|
{
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
{ label: "Orders", value: "51", color: "green" },
|
|
346
|
-
{ label: "Conversion", value: "5.2%", color: "magenta" },
|
|
347
|
-
{ label: "Avg Order", value: "$62.35", color: "yellow" },
|
|
348
|
-
{ label: "Refunds", value: "$126", color: "red" },
|
|
349
|
-
{ label: "New Buyers", value: "24", color: "cyan" }
|
|
350
|
-
]
|
|
351
|
-
}
|
|
256
|
+
content_state: ActivitySmith::LiveActivities.content_state(
|
|
257
|
+
title: "Reactivation",
|
|
258
|
+
message: "Lumen came back after 2 weeks",
|
|
259
|
+
type: ActivitySmith::LiveActivities::TYPE_ALERT,
|
|
260
|
+
icon: ActivitySmith::LiveActivities.alert_icon("cloud.sun", color: "yellow"),
|
|
261
|
+
badge: ActivitySmith::LiveActivities.alert_badge("Customer", color: "magenta")
|
|
262
|
+
)
|
|
352
263
|
}
|
|
353
264
|
)
|
|
354
265
|
```
|
|
355
266
|
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
```ruby
|
|
359
|
-
activitysmith.live_activities.end(
|
|
360
|
-
{
|
|
361
|
-
activity_id: activity_id,
|
|
362
|
-
content_state: {
|
|
363
|
-
title: "Sales",
|
|
364
|
-
subtitle: "last hour",
|
|
365
|
-
type: "stats",
|
|
366
|
-
metrics: [
|
|
367
|
-
{ label: "Revenue", value: "$3460", color: "blue" },
|
|
368
|
-
{ label: "Orders", value: "58", color: "green" },
|
|
369
|
-
{ label: "Conversion", value: "5.4%", color: "magenta" },
|
|
370
|
-
{ label: "Avg Order", value: "$59.66", color: "yellow" },
|
|
371
|
-
{ label: "Refunds", value: "$92", color: "red" },
|
|
372
|
-
{ label: "New Buyers", value: "31", color: "cyan" }
|
|
373
|
-
],
|
|
374
|
-
auto_dismiss_minutes: 2
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
)
|
|
378
|
-
```
|
|
267
|
+
The `icon` symbol value is an Apple SF Symbol name. Browse the catalog with one of these tools:
|
|
379
268
|
|
|
380
|
-
|
|
269
|
+
- [ActivitySmith app](https://apps.apple.com/us/app/activitysmith/id6752254835) - Open Settings -> SF Symbols to browse 45 hand-picked icons ready to use
|
|
270
|
+
- [SF Symbols](https://developer.apple.com/sf-symbols/) - Apple's official macOS app
|
|
271
|
+
- [Interactful](https://apps.apple.com/app/interactful/id1528095640) - free third-party iOS app listing all SF Symbols under Foundations -> Iconography
|
|
381
272
|
|
|
382
|
-
|
|
383
|
-
server health, queue pressure, or database load.
|
|
273
|
+
`icon` and `badge` are optional. If you omit either one, that element is not shown in the Live Activity.
|
|
384
274
|
|
|
385
|
-
|
|
275
|
+
### End Live Activity
|
|
386
276
|
|
|
387
|
-
|
|
388
|
-
<img src="https://cdn.activitysmith.com/features/metrics-live-activity-start.png" alt="Metrics start example" width="680" />
|
|
389
|
-
</p>
|
|
277
|
+
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.
|
|
390
278
|
|
|
391
279
|
```ruby
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
content_state: {
|
|
395
|
-
title: "Server Health",
|
|
396
|
-
subtitle: "prod-web-1",
|
|
397
|
-
type: "metrics",
|
|
398
|
-
metrics: [
|
|
399
|
-
{ label: "CPU", value: 9, unit: "%" },
|
|
400
|
-
{ label: "MEM", value: 45, unit: "%" }
|
|
401
|
-
]
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
)
|
|
405
|
-
|
|
406
|
-
activity_id = start.activity_id
|
|
407
|
-
```
|
|
408
|
-
|
|
409
|
-
#### Update
|
|
410
|
-
|
|
411
|
-
<p align="center">
|
|
412
|
-
<img src="https://cdn.activitysmith.com/features/metrics-live-activity-update.png" alt="Metrics update example" width="680" />
|
|
413
|
-
</p>
|
|
414
|
-
|
|
415
|
-
```ruby
|
|
416
|
-
activitysmith.live_activities.update(
|
|
417
|
-
{
|
|
418
|
-
activity_id: activity_id,
|
|
419
|
-
content_state: {
|
|
420
|
-
title: "Server Health",
|
|
421
|
-
subtitle: "prod-web-1",
|
|
422
|
-
type: "metrics",
|
|
423
|
-
metrics: [
|
|
424
|
-
{ label: "CPU", value: 76, unit: "%" },
|
|
425
|
-
{ label: "MEM", value: 52, unit: "%" }
|
|
426
|
-
]
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
)
|
|
430
|
-
```
|
|
431
|
-
|
|
432
|
-
#### End
|
|
433
|
-
|
|
434
|
-
<p align="center">
|
|
435
|
-
<img src="https://cdn.activitysmith.com/features/metrics-live-activity-end.png" alt="Metrics end example" width="680" />
|
|
436
|
-
</p>
|
|
437
|
-
|
|
438
|
-
```ruby
|
|
439
|
-
activitysmith.live_activities.end(
|
|
280
|
+
activitysmith.live_activities.end_stream(
|
|
281
|
+
"prod-web-1",
|
|
440
282
|
{
|
|
441
|
-
activity_id: activity_id,
|
|
442
283
|
content_state: {
|
|
443
284
|
title: "Server Health",
|
|
444
285
|
subtitle: "prod-web-1",
|
|
@@ -453,155 +294,24 @@ activitysmith.live_activities.end(
|
|
|
453
294
|
)
|
|
454
295
|
```
|
|
455
296
|
|
|
456
|
-
### Segmented Progress Type
|
|
457
|
-
|
|
458
|
-
Use `segmented_progress` for jobs and workflows that move through clear steps or
|
|
459
|
-
phases. It fits jobs like backups, deployments, ETL pipelines, and checklists.
|
|
460
|
-
`number_of_steps` is dynamic, so you can increase or decrease it later if the
|
|
461
|
-
workflow changes.
|
|
462
|
-
|
|
463
|
-
#### Start
|
|
464
|
-
|
|
465
|
-
<p align="center">
|
|
466
|
-
<img src="https://cdn.activitysmith.com/features/start-live-activity.png" alt="Segmented progress start example" width="680" />
|
|
467
|
-
</p>
|
|
468
|
-
|
|
469
|
-
```ruby
|
|
470
|
-
start = activitysmith.live_activities.start(
|
|
471
|
-
{
|
|
472
|
-
content_state: {
|
|
473
|
-
title: "Nightly database backup",
|
|
474
|
-
subtitle: "create snapshot",
|
|
475
|
-
number_of_steps: 3,
|
|
476
|
-
current_step: 1,
|
|
477
|
-
type: "segmented_progress",
|
|
478
|
-
color: "yellow"
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
)
|
|
482
|
-
|
|
483
|
-
activity_id = start.activity_id
|
|
484
|
-
```
|
|
485
|
-
|
|
486
|
-
#### Update
|
|
487
|
-
|
|
488
|
-
<p align="center">
|
|
489
|
-
<img src="https://cdn.activitysmith.com/features/update-live-activity.png" alt="Segmented progress update example" width="680" />
|
|
490
|
-
</p>
|
|
491
|
-
|
|
492
|
-
```ruby
|
|
493
|
-
activitysmith.live_activities.update(
|
|
494
|
-
{
|
|
495
|
-
activity_id: activity_id,
|
|
496
|
-
content_state: {
|
|
497
|
-
title: "Nightly database backup",
|
|
498
|
-
subtitle: "upload archive",
|
|
499
|
-
number_of_steps: 3,
|
|
500
|
-
current_step: 2
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
)
|
|
504
|
-
```
|
|
505
|
-
|
|
506
|
-
#### End
|
|
507
|
-
|
|
508
|
-
<p align="center">
|
|
509
|
-
<img src="https://cdn.activitysmith.com/features/end-live-activity.png" alt="Segmented progress end example" width="680" />
|
|
510
|
-
</p>
|
|
511
|
-
|
|
512
|
-
```ruby
|
|
513
|
-
activitysmith.live_activities.end(
|
|
514
|
-
{
|
|
515
|
-
activity_id: activity_id,
|
|
516
|
-
content_state: {
|
|
517
|
-
title: "Nightly database backup",
|
|
518
|
-
subtitle: "verify restore",
|
|
519
|
-
number_of_steps: 3,
|
|
520
|
-
current_step: 3,
|
|
521
|
-
auto_dismiss_minutes: 2
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
)
|
|
525
|
-
```
|
|
526
|
-
|
|
527
|
-
### Progress Type
|
|
528
|
-
|
|
529
|
-
Use `progress` when the state is naturally continuous. It fits charging,
|
|
530
|
-
downloads, sync jobs, uploads, timers, and any flow where a percentage or
|
|
531
|
-
numeric range is the clearest signal.
|
|
532
|
-
|
|
533
|
-
#### Start
|
|
534
|
-
|
|
535
|
-
<p align="center">
|
|
536
|
-
<img src="https://cdn.activitysmith.com/features/progress-live-activity-start.png" alt="Progress start example" width="680" />
|
|
537
|
-
</p>
|
|
538
|
-
|
|
539
|
-
```ruby
|
|
540
|
-
start = activitysmith.live_activities.start(
|
|
541
|
-
{
|
|
542
|
-
content_state: {
|
|
543
|
-
title: "EV Charging",
|
|
544
|
-
subtitle: "Added 30 mi range",
|
|
545
|
-
type: "progress",
|
|
546
|
-
percentage: 15
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
)
|
|
550
|
-
|
|
551
|
-
activity_id = start.activity_id
|
|
552
|
-
```
|
|
553
|
-
|
|
554
|
-
#### Update
|
|
555
|
-
|
|
556
|
-
<p align="center">
|
|
557
|
-
<img src="https://cdn.activitysmith.com/features/progress-live-activity-update.png" alt="Progress update example" width="680" />
|
|
558
|
-
</p>
|
|
559
|
-
|
|
560
|
-
```ruby
|
|
561
|
-
activitysmith.live_activities.update(
|
|
562
|
-
{
|
|
563
|
-
activity_id: activity_id,
|
|
564
|
-
content_state: {
|
|
565
|
-
title: "EV Charging",
|
|
566
|
-
subtitle: "Added 120 mi range",
|
|
567
|
-
percentage: 60
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
)
|
|
571
|
-
```
|
|
572
|
-
|
|
573
|
-
#### End
|
|
574
|
-
|
|
575
|
-
<p align="center">
|
|
576
|
-
<img src="https://cdn.activitysmith.com/features/progress-live-activity-end.png" alt="Progress end example" width="680" />
|
|
577
|
-
</p>
|
|
578
|
-
|
|
579
|
-
```ruby
|
|
580
|
-
activitysmith.live_activities.end(
|
|
581
|
-
{
|
|
582
|
-
activity_id: activity_id,
|
|
583
|
-
content_state: {
|
|
584
|
-
title: "EV Charging",
|
|
585
|
-
subtitle: "Added 200 mi range",
|
|
586
|
-
percentage: 100,
|
|
587
|
-
auto_dismiss_minutes: 2
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
)
|
|
591
|
-
```
|
|
592
|
-
|
|
593
297
|
### Live Activity Action
|
|
594
298
|
|
|
595
|
-
|
|
299
|
+
Live Activities can include one optional action button. Use it to open a URL from the Live Activity or trigger a backend webhook.
|
|
300
|
+
For Alert Live Activities, set `color` in `content_state` to tint the action button. Icon and badge colors only affect the icon and badge.
|
|
596
301
|
|
|
597
302
|
<p align="center">
|
|
598
|
-
<img
|
|
303
|
+
<img
|
|
304
|
+
src="https://cdn.activitysmith.com/features/live-activity-with-action.png?v=20260319-1"
|
|
305
|
+
alt="Live Activity with action button"
|
|
306
|
+
width="680"
|
|
307
|
+
/>
|
|
599
308
|
</p>
|
|
600
309
|
|
|
601
310
|
#### Open URL action
|
|
602
311
|
|
|
603
312
|
```ruby
|
|
604
|
-
|
|
313
|
+
activitysmith.live_activities.stream(
|
|
314
|
+
"prod-web-1",
|
|
605
315
|
{
|
|
606
316
|
content_state: {
|
|
607
317
|
title: "Server Health",
|
|
@@ -619,23 +329,18 @@ start = activitysmith.live_activities.start(
|
|
|
619
329
|
}
|
|
620
330
|
}
|
|
621
331
|
)
|
|
622
|
-
|
|
623
|
-
activity_id = start.activity_id
|
|
624
332
|
```
|
|
625
333
|
|
|
626
334
|
#### Webhook action
|
|
627
335
|
|
|
628
|
-
<p align="center">
|
|
629
|
-
<img src="https://cdn.activitysmith.com/features/live-activity-with-action.png?v=20260319-1" alt="Live Activity with action" width="680" />
|
|
630
|
-
</p>
|
|
631
|
-
|
|
632
336
|
```ruby
|
|
633
|
-
activitysmith.live_activities.
|
|
337
|
+
activitysmith.live_activities.stream(
|
|
338
|
+
"search-reindex",
|
|
634
339
|
{
|
|
635
|
-
activity_id: activity_id,
|
|
636
340
|
content_state: {
|
|
637
341
|
title: "Reindexing product search",
|
|
638
342
|
subtitle: "Shard 7 of 12",
|
|
343
|
+
type: "segmented_progress",
|
|
639
344
|
number_of_steps: 12,
|
|
640
345
|
current_step: 7
|
|
641
346
|
},
|
|
@@ -19,8 +19,8 @@ module OpenapiClient
|
|
|
19
19
|
def initialize(api_client = ApiClient.default)
|
|
20
20
|
@api_client = api_client
|
|
21
21
|
end
|
|
22
|
-
# End a Live Activity
|
|
23
|
-
# Ends a Live Activity and archives its lifecycle. Supports segmented_progress, progress, metrics, and
|
|
22
|
+
# End a Live Activity (legacy manual lifecycle)
|
|
23
|
+
# 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.
|
|
24
24
|
# @param live_activity_end_request [LiveActivityEndRequest]
|
|
25
25
|
# @param [Hash] opts the optional parameters
|
|
26
26
|
# @return [LiveActivityEndResponse]
|
|
@@ -29,8 +29,8 @@ module OpenapiClient
|
|
|
29
29
|
data
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
-
# End a Live Activity
|
|
33
|
-
# Ends a Live Activity and archives its lifecycle. Supports segmented_progress, progress, metrics, and
|
|
32
|
+
# End a Live Activity (legacy manual lifecycle)
|
|
33
|
+
# 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.
|
|
34
34
|
# @param live_activity_end_request [LiveActivityEndRequest]
|
|
35
35
|
# @param [Hash] opts the optional parameters
|
|
36
36
|
# @return [Array<(LiveActivityEndResponse, Integer, Hash)>] LiveActivityEndResponse data, response status code and response headers
|
|
@@ -166,8 +166,8 @@ module OpenapiClient
|
|
|
166
166
|
return data, status_code, headers
|
|
167
167
|
end
|
|
168
168
|
|
|
169
|
-
#
|
|
170
|
-
# Use
|
|
169
|
+
# Start a new Live Activity or update an existing one
|
|
170
|
+
# Use a stable stream_key for each ongoing thing you want to show as a Live Activity. Send the latest content_state whenever it changes, and ActivitySmith will keep the Live Activity in sync.
|
|
171
171
|
# @param stream_key [String] Stable identifier for one ongoing thing. Allowed characters: letters, numbers, underscores, and hyphens.
|
|
172
172
|
# @param live_activity_stream_request [LiveActivityStreamRequest]
|
|
173
173
|
# @param [Hash] opts the optional parameters
|
|
@@ -177,8 +177,8 @@ module OpenapiClient
|
|
|
177
177
|
data
|
|
178
178
|
end
|
|
179
179
|
|
|
180
|
-
#
|
|
181
|
-
# Use
|
|
180
|
+
# Start a new Live Activity or update an existing one
|
|
181
|
+
# Use a stable stream_key for each ongoing thing you want to show as a Live Activity. Send the latest content_state whenever it changes, and ActivitySmith will keep the Live Activity in sync.
|
|
182
182
|
# @param stream_key [String] Stable identifier for one ongoing thing. Allowed characters: letters, numbers, underscores, and hyphens.
|
|
183
183
|
# @param live_activity_stream_request [LiveActivityStreamRequest]
|
|
184
184
|
# @param [Hash] opts the optional parameters
|
|
@@ -249,8 +249,8 @@ module OpenapiClient
|
|
|
249
249
|
return data, status_code, headers
|
|
250
250
|
end
|
|
251
251
|
|
|
252
|
-
# Start a Live Activity
|
|
253
|
-
# Starts a Live Activity on devices matched by API key scope and optional target channels. Supports segmented_progress, progress, metrics, and
|
|
252
|
+
# Start a Live Activity (legacy manual lifecycle)
|
|
253
|
+
# 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.
|
|
254
254
|
# @param live_activity_start_request [LiveActivityStartRequest]
|
|
255
255
|
# @param [Hash] opts the optional parameters
|
|
256
256
|
# @return [LiveActivityStartResponse]
|
|
@@ -259,8 +259,8 @@ module OpenapiClient
|
|
|
259
259
|
data
|
|
260
260
|
end
|
|
261
261
|
|
|
262
|
-
# Start a Live Activity
|
|
263
|
-
# Starts a Live Activity on devices matched by API key scope and optional target channels. Supports segmented_progress, progress, metrics, and
|
|
262
|
+
# Start a Live Activity (legacy manual lifecycle)
|
|
263
|
+
# 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.
|
|
264
264
|
# @param live_activity_start_request [LiveActivityStartRequest]
|
|
265
265
|
# @param [Hash] opts the optional parameters
|
|
266
266
|
# @return [Array<(LiveActivityStartResponse, Integer, Hash)>] LiveActivityStartResponse data, response status code and response headers
|
|
@@ -317,8 +317,8 @@ module OpenapiClient
|
|
|
317
317
|
return data, status_code, headers
|
|
318
318
|
end
|
|
319
319
|
|
|
320
|
-
# Update a Live Activity
|
|
321
|
-
# Updates an existing Live Activity. If the per-activity token is not registered yet, the update is queued. Supports segmented_progress, progress, metrics, and
|
|
320
|
+
# Update a Live Activity (legacy manual lifecycle)
|
|
321
|
+
# 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.
|
|
322
322
|
# @param live_activity_update_request [LiveActivityUpdateRequest]
|
|
323
323
|
# @param [Hash] opts the optional parameters
|
|
324
324
|
# @return [LiveActivityUpdateResponse]
|
|
@@ -327,8 +327,8 @@ module OpenapiClient
|
|
|
327
327
|
data
|
|
328
328
|
end
|
|
329
329
|
|
|
330
|
-
# Update a Live Activity
|
|
331
|
-
# Updates an existing Live Activity. If the per-activity token is not registered yet, the update is queued. Supports segmented_progress, progress, metrics, and
|
|
330
|
+
# Update a Live Activity (legacy manual lifecycle)
|
|
331
|
+
# 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.
|
|
332
332
|
# @param live_activity_update_request [LiveActivityUpdateRequest]
|
|
333
333
|
# @param [Hash] opts the optional parameters
|
|
334
334
|
# @return [Array<(LiveActivityUpdateResponse, Integer, Hash)>] LiveActivityUpdateResponse data, response status code and response headers
|
|
@@ -140,7 +140,7 @@ module OpenapiClient
|
|
|
140
140
|
return false if @label.nil?
|
|
141
141
|
return false if @label.to_s.length < 1
|
|
142
142
|
return false if @value.nil?
|
|
143
|
-
color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
|
|
143
|
+
color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow", "gray"])
|
|
144
144
|
return false unless color_validator.valid?(@color)
|
|
145
145
|
true
|
|
146
146
|
end
|
|
@@ -162,7 +162,7 @@ module OpenapiClient
|
|
|
162
162
|
# Custom attribute writer method checking allowed values (enum).
|
|
163
163
|
# @param [Object] color Object to be assigned
|
|
164
164
|
def color=(color)
|
|
165
|
-
validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
|
|
165
|
+
validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow", "gray"])
|
|
166
166
|
unless validator.valid?(color)
|
|
167
167
|
fail ArgumentError, "invalid value for \"color\", must be one of #{validator.allowable_values}."
|
|
168
168
|
end
|