activitysmith-cli 1.3.0 → 1.3.1
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.
- package/README.md +40 -330
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -12,12 +12,8 @@ CLI wrapper for the ActivitySmith API using the official Node SDK.
|
|
|
12
12
|
- [Rich Push Notifications with Media](#rich-push-notifications-with-media)
|
|
13
13
|
- [Actionable Push Notifications](#actionable-push-notifications)
|
|
14
14
|
- [Live Activities](#live-activities)
|
|
15
|
-
- [
|
|
16
|
-
- [
|
|
17
|
-
- [Stats](#stats)
|
|
18
|
-
- [Metrics](#metrics)
|
|
19
|
-
- [Segmented Progress](#segmented-progress)
|
|
20
|
-
- [Progress](#progress)
|
|
15
|
+
- [Start & Update Live Activity](#start--update-live-activity)
|
|
16
|
+
- [End Live Activity](#end-live-activity)
|
|
21
17
|
- [Live Activity Action](#live-activity-action)
|
|
22
18
|
- [Channels](#channels)
|
|
23
19
|
- [Widgets](#widgets)
|
|
@@ -139,43 +135,25 @@ activitysmith push \
|
|
|
139
135
|
|
|
140
136
|
## Live Activities
|
|
141
137
|
|
|
142
|
-
<p align="center">
|
|
143
|
-
<img src="https://cdn.activitysmith.com/features/metrics-live-activity-action.png" alt="Metrics Live Activity screenshot" width="680" />
|
|
144
|
-
</p>
|
|
145
|
-
|
|
146
138
|
There are four types of Live Activities:
|
|
147
139
|
|
|
148
|
-
- `stats`: best for
|
|
149
|
-
- `metrics`: best for live
|
|
150
|
-
- `segmented_progress`: best for
|
|
151
|
-
- `progress`: best for
|
|
152
|
-
|
|
153
|
-
When working with Live Activities via our API, you have two approaches tailored
|
|
154
|
-
to different needs. First, the stateless mode is the simplest path - one API
|
|
155
|
-
call can initiate or update an activity, and another ends it - no state
|
|
156
|
-
tracking on your side.
|
|
157
|
-
|
|
158
|
-
This is ideal if you want minimal complexity, perfect for automated workflows
|
|
159
|
-
like cron jobs.
|
|
160
|
-
|
|
161
|
-
In contrast, if you need precise lifecycle control, the classic approach offers
|
|
162
|
-
distinct calls for start, updates, and end, giving you full control over the
|
|
163
|
-
activity's state.
|
|
140
|
+
- `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
|
|
141
|
+
- `metrics`: best for live percentage values that change often, like server CPU, memory usage, disk usage, or error rate
|
|
142
|
+
- `segmented_progress`: best for anything that moves through clear stages, like deployments, onboarding flows, backups, ETL pipelines, migrations, and AI agent runs
|
|
143
|
+
- `progress`: best for tracking real-time progress with percentage, like tasks, backups, migrations, syncs, or uploads
|
|
164
144
|
|
|
165
|
-
|
|
166
|
-
can choose what fits your use case best.
|
|
145
|
+
### Start & Update Live Activity
|
|
167
146
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
Use a stable `stream_key` to identify the system or workflow you are tracking,
|
|
171
|
-
such as a server, deployment, build pipeline, cron job, or charging session.
|
|
172
|
-
This is especially useful for cron jobs and other scheduled tasks where you do
|
|
173
|
-
not want to store `activity_id` between runs.
|
|
147
|
+
Use a stable `stream_key` to identify the metric, job, deployment, or system you want to keep visible. The first `activity stream` command starts the Live Activity. Later commands with the same `stream_key` update it.
|
|
174
148
|
|
|
175
149
|
#### Stats
|
|
176
150
|
|
|
177
151
|
<p align="center">
|
|
178
|
-
<img
|
|
152
|
+
<img
|
|
153
|
+
src="https://cdn.activitysmith.com/features/stats-live-activity.png"
|
|
154
|
+
alt="Stats Live Activity stream example"
|
|
155
|
+
width="680"
|
|
156
|
+
/>
|
|
179
157
|
</p>
|
|
180
158
|
|
|
181
159
|
```bash
|
|
@@ -198,7 +176,11 @@ activitysmith activity stream sales-hourly \
|
|
|
198
176
|
#### Metrics
|
|
199
177
|
|
|
200
178
|
<p align="center">
|
|
201
|
-
<img
|
|
179
|
+
<img
|
|
180
|
+
src="https://cdn.activitysmith.com/features/metrics-live-activity-start.png"
|
|
181
|
+
alt="Metrics Live Activity stream example"
|
|
182
|
+
width="680"
|
|
183
|
+
/>
|
|
202
184
|
</p>
|
|
203
185
|
|
|
204
186
|
```bash
|
|
@@ -214,10 +196,14 @@ activitysmith activity stream prod-web-1 \
|
|
|
214
196
|
}'
|
|
215
197
|
```
|
|
216
198
|
|
|
217
|
-
#### Segmented
|
|
199
|
+
#### Segmented Progress
|
|
218
200
|
|
|
219
201
|
<p align="center">
|
|
220
|
-
<img
|
|
202
|
+
<img
|
|
203
|
+
src="https://cdn.activitysmith.com/features/update-live-activity.png"
|
|
204
|
+
alt="Segmented Progress Live Activity stream example"
|
|
205
|
+
width="680"
|
|
206
|
+
/>
|
|
221
207
|
</p>
|
|
222
208
|
|
|
223
209
|
```bash
|
|
@@ -234,7 +220,11 @@ activitysmith activity stream nightly-backup \
|
|
|
234
220
|
#### Progress
|
|
235
221
|
|
|
236
222
|
<p align="center">
|
|
237
|
-
<img
|
|
223
|
+
<img
|
|
224
|
+
src="https://cdn.activitysmith.com/features/progress-live-activity.png"
|
|
225
|
+
alt="Progress Live Activity stream example"
|
|
226
|
+
width="680"
|
|
227
|
+
/>
|
|
238
228
|
</p>
|
|
239
229
|
|
|
240
230
|
```bash
|
|
@@ -247,14 +237,9 @@ activitysmith activity stream search-reindex \
|
|
|
247
237
|
}'
|
|
248
238
|
```
|
|
249
239
|
|
|
250
|
-
|
|
251
|
-
`stream_key` whenever the state changes.
|
|
252
|
-
|
|
253
|
-
#### End a stream
|
|
240
|
+
### End Live Activity
|
|
254
241
|
|
|
255
|
-
|
|
256
|
-
Activity on devices. `content_state` is optional here; include it if you want
|
|
257
|
-
to end the stream with a final state.
|
|
242
|
+
Call `activity 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 `autoDismissMinutes` to choose a different dismissal time, including `0` for immediate dismissal.
|
|
258
243
|
|
|
259
244
|
```bash
|
|
260
245
|
activitysmith activity end-stream prod-web-1 \
|
|
@@ -265,298 +250,27 @@ activitysmith activity end-stream prod-web-1 \
|
|
|
265
250
|
"metrics": [
|
|
266
251
|
{ "label": "CPU", "value": 7, "unit": "%" },
|
|
267
252
|
{ "label": "MEM", "value": 38, "unit": "%" }
|
|
268
|
-
]
|
|
269
|
-
}'
|
|
270
|
-
```
|
|
271
|
-
|
|
272
|
-
If you later send another `activity stream` request with the same `stream_key`,
|
|
273
|
-
ActivitySmith starts a new Live Activity for that stream again.
|
|
274
|
-
|
|
275
|
-
Stream responses include an `operation` field:
|
|
276
|
-
|
|
277
|
-
- `started`: ActivitySmith started a new Live Activity for this `stream_key`
|
|
278
|
-
- `updated`: ActivitySmith updated the current Live Activity
|
|
279
|
-
- `rotated`: ActivitySmith ended the previous Live Activity and started a new one
|
|
280
|
-
- `noop`: the incoming state matched the current state, so no update was sent
|
|
281
|
-
- `paused`: the stream is paused, so no Live Activity was started or updated
|
|
282
|
-
- `ended`: returned by `activity end-stream` after the stream is ended
|
|
283
|
-
|
|
284
|
-
### Advanced: Full lifecycle control
|
|
285
|
-
|
|
286
|
-
Use these commands when you want to manage the Live Activity lifecycle yourself:
|
|
287
|
-
|
|
288
|
-
1. Run `activitysmith activity start ...`.
|
|
289
|
-
2. Save the returned `activity_id`.
|
|
290
|
-
3. Run `activitysmith activity update ...` as progress changes.
|
|
291
|
-
4. Run `activitysmith activity end ...` when the work is finished.
|
|
292
|
-
|
|
293
|
-
You can use `--content-state <json>` for the examples below, or build the same
|
|
294
|
-
payload with flags as documented in `Content State Options`.
|
|
295
|
-
|
|
296
|
-
### Stats
|
|
297
|
-
|
|
298
|
-
Keep your key numbers on your Lock Screen. `stats` fits up to 8 labeled values,
|
|
299
|
-
such as revenue, orders, conversion, uptime, or any other business metric you
|
|
300
|
-
want visible at a glance. Each metric can use a formatted string or number as
|
|
301
|
-
its `value`. Add `color` to a metric to show an accent dot next to its label;
|
|
302
|
-
omit `color` to show the label without a dot.
|
|
303
|
-
|
|
304
|
-
#### Start
|
|
305
|
-
|
|
306
|
-
<p align="center">
|
|
307
|
-
<img src="https://cdn.activitysmith.com/features/stats-live-activity.png" alt="Stats Live Activity with sales revenue, orders, conversion, and average order value" width="680" />
|
|
308
|
-
</p>
|
|
309
|
-
|
|
310
|
-
```bash
|
|
311
|
-
activitysmith activity start \
|
|
312
|
-
--content-state '{
|
|
313
|
-
"title": "Sales",
|
|
314
|
-
"subtitle": "last hour",
|
|
315
|
-
"type": "stats",
|
|
316
|
-
"metrics": [
|
|
317
|
-
{ "label": "Revenue", "value": "$2430", "color": "blue" },
|
|
318
|
-
{ "label": "Orders", "value": "37", "color": "green" },
|
|
319
|
-
{ "label": "Conversion", "value": "4.8%", "color": "magenta" },
|
|
320
|
-
{ "label": "Avg Order", "value": "$65.68", "color": "yellow" },
|
|
321
|
-
{ "label": "Refunds", "value": "$84", "color": "red" },
|
|
322
|
-
{ "label": "New Buyers", "value": "18", "color": "cyan" }
|
|
323
|
-
]
|
|
324
|
-
}'
|
|
325
|
-
```
|
|
326
|
-
|
|
327
|
-
#### Update
|
|
328
|
-
|
|
329
|
-
```bash
|
|
330
|
-
activitysmith activity update \
|
|
331
|
-
--activity-id "<activityId>" \
|
|
332
|
-
--content-state '{
|
|
333
|
-
"title": "Sales",
|
|
334
|
-
"subtitle": "last hour",
|
|
335
|
-
"type": "stats",
|
|
336
|
-
"metrics": [
|
|
337
|
-
{ "label": "Revenue", "value": "$3180", "color": "blue" },
|
|
338
|
-
{ "label": "Orders", "value": "51", "color": "green" },
|
|
339
|
-
{ "label": "Conversion", "value": "5.2%", "color": "magenta" },
|
|
340
|
-
{ "label": "Avg Order", "value": "$62.35", "color": "yellow" },
|
|
341
|
-
{ "label": "Refunds", "value": "$126", "color": "red" },
|
|
342
|
-
{ "label": "New Buyers", "value": "24", "color": "cyan" }
|
|
343
|
-
]
|
|
344
|
-
}'
|
|
345
|
-
```
|
|
346
|
-
|
|
347
|
-
#### End
|
|
348
|
-
|
|
349
|
-
```bash
|
|
350
|
-
activitysmith activity end \
|
|
351
|
-
--activity-id "<activityId>" \
|
|
352
|
-
--content-state '{
|
|
353
|
-
"title": "Sales",
|
|
354
|
-
"subtitle": "last hour",
|
|
355
|
-
"type": "stats",
|
|
356
|
-
"metrics": [
|
|
357
|
-
{ "label": "Revenue", "value": "$3460", "color": "blue" },
|
|
358
|
-
{ "label": "Orders", "value": "58", "color": "green" },
|
|
359
|
-
{ "label": "Conversion", "value": "5.4%", "color": "magenta" },
|
|
360
|
-
{ "label": "Avg Order", "value": "$59.66", "color": "yellow" },
|
|
361
|
-
{ "label": "Refunds", "value": "$92", "color": "red" },
|
|
362
|
-
{ "label": "New Buyers", "value": "31", "color": "cyan" }
|
|
363
253
|
],
|
|
364
254
|
"autoDismissMinutes": 2
|
|
365
255
|
}'
|
|
366
256
|
```
|
|
367
257
|
|
|
368
|
-
### Metrics Type
|
|
369
|
-
|
|
370
|
-
Use `metrics` when you want to keep a small set of live stats visible, such as
|
|
371
|
-
server health, queue pressure, or database load.
|
|
372
|
-
|
|
373
|
-
#### Start
|
|
374
|
-
|
|
375
|
-
<p align="center">
|
|
376
|
-
<img src="https://cdn.activitysmith.com/features/metrics-live-activity-start.png" alt="Metrics start example" width="680" />
|
|
377
|
-
</p>
|
|
378
|
-
|
|
379
|
-
```bash
|
|
380
|
-
activitysmith activity start \
|
|
381
|
-
--content-state '{
|
|
382
|
-
"title": "Server Health",
|
|
383
|
-
"subtitle": "prod-web-1",
|
|
384
|
-
"type": "metrics",
|
|
385
|
-
"metrics": [
|
|
386
|
-
{ "label": "CPU", "value": 9, "unit": "%" },
|
|
387
|
-
{ "label": "MEM", "value": 45, "unit": "%" }
|
|
388
|
-
]
|
|
389
|
-
}'
|
|
390
|
-
```
|
|
391
|
-
|
|
392
|
-
#### Update
|
|
393
|
-
|
|
394
|
-
<p align="center">
|
|
395
|
-
<img src="https://cdn.activitysmith.com/features/metrics-live-activity-update.png" alt="Metrics update example" width="680" />
|
|
396
|
-
</p>
|
|
397
|
-
|
|
398
|
-
```bash
|
|
399
|
-
activitysmith activity update \
|
|
400
|
-
--activity-id "<activityId>" \
|
|
401
|
-
--content-state '{
|
|
402
|
-
"title": "Server Health",
|
|
403
|
-
"subtitle": "prod-web-1",
|
|
404
|
-
"type": "metrics",
|
|
405
|
-
"metrics": [
|
|
406
|
-
{ "label": "CPU", "value": 76, "unit": "%" },
|
|
407
|
-
{ "label": "MEM", "value": 52, "unit": "%" }
|
|
408
|
-
]
|
|
409
|
-
}'
|
|
410
|
-
```
|
|
411
|
-
|
|
412
|
-
#### End
|
|
413
|
-
|
|
414
|
-
<p align="center">
|
|
415
|
-
<img src="https://cdn.activitysmith.com/features/metrics-live-activity-end.png" alt="Metrics end example" width="680" />
|
|
416
|
-
</p>
|
|
417
|
-
|
|
418
|
-
```bash
|
|
419
|
-
activitysmith activity end \
|
|
420
|
-
--activity-id "<activityId>" \
|
|
421
|
-
--content-state '{
|
|
422
|
-
"title": "Server Health",
|
|
423
|
-
"subtitle": "prod-web-1",
|
|
424
|
-
"type": "metrics",
|
|
425
|
-
"metrics": [
|
|
426
|
-
{ "label": "CPU", "value": 7, "unit": "%" },
|
|
427
|
-
{ "label": "MEM", "value": 38, "unit": "%" }
|
|
428
|
-
],
|
|
429
|
-
"autoDismissMinutes": 2
|
|
430
|
-
}'
|
|
431
|
-
```
|
|
432
|
-
|
|
433
|
-
### Segmented Progress Type
|
|
434
|
-
|
|
435
|
-
Use `segmented_progress` for jobs and workflows that move through clear steps or
|
|
436
|
-
phases. It fits jobs like deployments, backups, ETL pipelines, and checklists.
|
|
437
|
-
`numberOfSteps` is dynamic, so you can increase or decrease it later if the
|
|
438
|
-
workflow changes.
|
|
439
|
-
|
|
440
|
-
#### Start
|
|
441
|
-
|
|
442
|
-
<p align="center">
|
|
443
|
-
<img src="https://cdn.activitysmith.com/features/start-live-activity.png" alt="Segmented progress start example" width="680" />
|
|
444
|
-
</p>
|
|
445
|
-
|
|
446
|
-
```bash
|
|
447
|
-
activitysmith activity start \
|
|
448
|
-
--content-state '{
|
|
449
|
-
"title": "Nightly database backup",
|
|
450
|
-
"subtitle": "create snapshot",
|
|
451
|
-
"numberOfSteps": 3,
|
|
452
|
-
"currentStep": 1,
|
|
453
|
-
"type": "segmented_progress",
|
|
454
|
-
"color": "yellow"
|
|
455
|
-
}'
|
|
456
|
-
```
|
|
457
|
-
|
|
458
|
-
#### Update
|
|
459
|
-
|
|
460
|
-
<p align="center">
|
|
461
|
-
<img src="https://cdn.activitysmith.com/features/update-live-activity.png" alt="Segmented progress update example" width="680" />
|
|
462
|
-
</p>
|
|
463
|
-
|
|
464
|
-
```bash
|
|
465
|
-
activitysmith activity update \
|
|
466
|
-
--activity-id "<activityId>" \
|
|
467
|
-
--content-state '{
|
|
468
|
-
"title": "Nightly database backup",
|
|
469
|
-
"subtitle": "upload archive",
|
|
470
|
-
"numberOfSteps": 3,
|
|
471
|
-
"currentStep": 2
|
|
472
|
-
}'
|
|
473
|
-
```
|
|
474
|
-
|
|
475
|
-
#### End
|
|
476
|
-
|
|
477
|
-
<p align="center">
|
|
478
|
-
<img src="https://cdn.activitysmith.com/features/end-live-activity.png" alt="Segmented progress end example" width="680" />
|
|
479
|
-
</p>
|
|
480
|
-
|
|
481
|
-
```bash
|
|
482
|
-
activitysmith activity end \
|
|
483
|
-
--activity-id "<activityId>" \
|
|
484
|
-
--content-state '{
|
|
485
|
-
"title": "Nightly database backup",
|
|
486
|
-
"subtitle": "verify restore",
|
|
487
|
-
"numberOfSteps": 3,
|
|
488
|
-
"currentStep": 3,
|
|
489
|
-
"autoDismissMinutes": 2
|
|
490
|
-
}'
|
|
491
|
-
```
|
|
492
|
-
|
|
493
|
-
### Progress Type
|
|
494
|
-
|
|
495
|
-
Use `progress` when the state is naturally continuous. It fits charging,
|
|
496
|
-
downloads, sync jobs, uploads, timers, and any flow where a percentage or
|
|
497
|
-
numeric range is the clearest signal.
|
|
498
|
-
|
|
499
|
-
#### Start
|
|
500
|
-
|
|
501
|
-
<p align="center">
|
|
502
|
-
<img src="https://cdn.activitysmith.com/features/progress-live-activity-start.png" alt="Progress start example" width="680" />
|
|
503
|
-
</p>
|
|
504
|
-
|
|
505
|
-
```bash
|
|
506
|
-
activitysmith activity start \
|
|
507
|
-
--content-state '{
|
|
508
|
-
"title": "EV Charging",
|
|
509
|
-
"subtitle": "Added 30 mi range",
|
|
510
|
-
"type": "progress",
|
|
511
|
-
"percentage": 15
|
|
512
|
-
}'
|
|
513
|
-
```
|
|
514
|
-
|
|
515
|
-
#### Update
|
|
516
|
-
|
|
517
|
-
<p align="center">
|
|
518
|
-
<img src="https://cdn.activitysmith.com/features/progress-live-activity-update.png" alt="Progress update example" width="680" />
|
|
519
|
-
</p>
|
|
520
|
-
|
|
521
|
-
```bash
|
|
522
|
-
activitysmith activity update \
|
|
523
|
-
--activity-id "<activityId>" \
|
|
524
|
-
--content-state '{
|
|
525
|
-
"title": "EV Charging",
|
|
526
|
-
"subtitle": "Added 120 mi range",
|
|
527
|
-
"percentage": 60
|
|
528
|
-
}'
|
|
529
|
-
```
|
|
530
|
-
|
|
531
|
-
#### End
|
|
532
|
-
|
|
533
|
-
<p align="center">
|
|
534
|
-
<img src="https://cdn.activitysmith.com/features/progress-live-activity-end.png" alt="Progress end example" width="680" />
|
|
535
|
-
</p>
|
|
536
|
-
|
|
537
|
-
```bash
|
|
538
|
-
activitysmith activity end \
|
|
539
|
-
--activity-id "<activityId>" \
|
|
540
|
-
--content-state '{
|
|
541
|
-
"title": "EV Charging",
|
|
542
|
-
"subtitle": "Added 200 mi range",
|
|
543
|
-
"percentage": 100,
|
|
544
|
-
"autoDismissMinutes": 2
|
|
545
|
-
}'
|
|
546
|
-
```
|
|
547
|
-
|
|
548
258
|
### Live Activity Action
|
|
549
259
|
|
|
550
|
-
|
|
260
|
+
Live Activities can include one optional action button. Use it to open a URL from the Live Activity or trigger a backend webhook.
|
|
551
261
|
|
|
552
262
|
<p align="center">
|
|
553
|
-
<img
|
|
263
|
+
<img
|
|
264
|
+
src="https://cdn.activitysmith.com/features/live-activity-with-action.png?v=20260319-1"
|
|
265
|
+
alt="Live Activity with action button"
|
|
266
|
+
width="680"
|
|
267
|
+
/>
|
|
554
268
|
</p>
|
|
555
269
|
|
|
556
270
|
#### Open URL action
|
|
557
271
|
|
|
558
272
|
```bash
|
|
559
|
-
activitysmith activity
|
|
273
|
+
activitysmith activity stream prod-web-1 \
|
|
560
274
|
--content-state '{
|
|
561
275
|
"title": "Server Health",
|
|
562
276
|
"subtitle": "prod-web-1",
|
|
@@ -575,16 +289,12 @@ activitysmith activity start \
|
|
|
575
289
|
|
|
576
290
|
#### Webhook action
|
|
577
291
|
|
|
578
|
-
<p align="center">
|
|
579
|
-
<img src="https://cdn.activitysmith.com/features/live-activity-with-action.png?v=20260319-1" alt="Live Activity with action" width="680" />
|
|
580
|
-
</p>
|
|
581
|
-
|
|
582
292
|
```bash
|
|
583
|
-
activitysmith activity
|
|
584
|
-
--activity-id "<activityId>" \
|
|
293
|
+
activitysmith activity stream search-reindex \
|
|
585
294
|
--content-state '{
|
|
586
295
|
"title": "Reindexing product search",
|
|
587
296
|
"subtitle": "Shard 7 of 12",
|
|
297
|
+
"type": "segmented_progress",
|
|
588
298
|
"numberOfSteps": 12,
|
|
589
299
|
"currentStep": 7
|
|
590
300
|
}' \
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "activitysmith-cli",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "Command-line interface for ActivitySmith. Send push notifications and manage Live Activities from your terminal.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"activitysmith",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"lint": "node --check src/cli.js"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"activitysmith": "^1.3.
|
|
43
|
+
"activitysmith": "^1.3.1",
|
|
44
44
|
"commander": "^12.1.0"
|
|
45
45
|
}
|
|
46
46
|
}
|