activitysmith 1.10.0 → 1.11.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.
package/README.md CHANGED
@@ -1,50 +1,22 @@
1
- # ActivitySmith Node SDK
1
+ # ActivitySmith Node.js SDK
2
2
 
3
- The ActivitySmith Node SDK provides convenient access to the ActivitySmith API from server-side JavaScript and TypeScript applications.
4
-
5
- ## Documentation
6
-
7
- See [API reference](https://activitysmith.com/docs/api-reference/introduction)
8
-
9
- ## Table of Contents
10
-
11
- - [Installation](#installation)
12
- - [Setup](#setup)
13
- - [Push Notifications](#push-notifications)
14
- - [Send a Push Notification](#send-a-push-notification)
15
- - [Rich Push Notifications with Media](#rich-push-notifications-with-media)
16
- - [Actionable Push Notifications](#actionable-push-notifications)
17
- - [Live Activities](#live-activities)
18
- - [Start & Update Live Activity](#start--update-live-activity)
19
- - [End Live Activity](#end-live-activity)
20
- - [Live Activity Action](#live-activity-action)
21
- - [Icons and Badges](#icons-and-badges)
22
- - [Live Activity Colors](#live-activity-colors)
23
- - [Widgets](#widgets)
24
- - [App Icon Badge Count](#app-icon-badge-count)
25
- - [Channels](#channels)
26
- - [Tags](#tags)
3
+ [Documentation](https://activitysmith.com/docs/sdks/node)
27
4
 
28
5
  ## Installation
29
6
 
30
- ```sh
7
+ Install the ActivitySmith Node.js SDK with npm:
8
+
9
+ ```bash
31
10
  npm install activitysmith
32
11
  ```
33
12
 
34
- ## Setup
13
+ ## Quickstart
35
14
 
36
- ```ts
37
- import ActivitySmith from "activitysmith";
38
-
39
- const activitysmith = new ActivitySmith({
40
- apiKey: process.env.ACTIVITYSMITH_API_KEY,
41
- });
42
- ```
43
-
44
- CommonJS:
15
+ 1. [Create an API key](https://activitysmith.com/app/keys)
16
+ 2. Set `ACTIVITYSMITH_API_KEY` or pass `apiKey` when creating the client.
45
17
 
46
18
  ```js
47
- const ActivitySmith = require("activitysmith");
19
+ import ActivitySmith from "activitysmith";
48
20
 
49
21
  const activitysmith = new ActivitySmith({
50
22
  apiKey: process.env.ACTIVITYSMITH_API_KEY,
@@ -55,11 +27,11 @@ const activitysmith = new ActivitySmith({
55
27
 
56
28
  ### Send a Push Notification
57
29
 
58
- <p align="center">
59
- <img src="https://cdn.activitysmith.com/features/new-subscription-push-notification.png" alt="Push notification example" width="680" />
60
- </p>
30
+ Send an immediate notification for a completed task or event.
61
31
 
62
- ```ts
32
+ ![Push Notification example for a new subscription event](https://cdn.activitysmith.com/features/new-subscription-push-notification.png)
33
+
34
+ ```js
63
35
  await activitysmith.notifications.send({
64
36
  title: "New subscription 💸",
65
37
  message: "Customer upgraded to Pro plan",
@@ -68,24 +40,19 @@ await activitysmith.notifications.send({
68
40
 
69
41
  ### Rich Push Notifications with Media
70
42
 
71
- <p align="center">
72
- <img src="https://cdn.activitysmith.com/features/rich-push-notification-with-image.png" alt="Rich push notification with image" width="680" />
73
- </p>
43
+ ![Rich Push Notification with image](https://cdn.activitysmith.com/features/rich-push-notification-with-image.png)
74
44
 
75
- ```ts
45
+ ```js
76
46
  await activitysmith.notifications.send({
77
47
  title: "Homepage ready",
78
48
  message: "Your agent finished the redesign.",
79
49
  media: "https://cdn.example.com/output/homepage-v2.png",
80
- redirection: "https://github.com/acme/web/pull/482",
81
50
  });
82
51
  ```
83
52
 
84
- 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.
53
+ Attach images, videos, or audio to your Push Notifications. Press and hold the notification to preview the media.
85
54
 
86
- <p align="center">
87
- <img src="https://cdn.activitysmith.com/features/rich-push-notification-with-audio.png" alt="Rich push notification with audio" width="680" />
88
- </p>
55
+ ![Rich Push Notification with audio](https://cdn.activitysmith.com/features/rich-push-notification-with-audio.png)
89
56
 
90
57
  What will work:
91
58
 
@@ -94,23 +61,51 @@ What will work:
94
61
  - direct video file URL: `.mp4`, `.mov`, etc.
95
62
  - URL that responds with a proper media `Content-Type`, even if the path has no extension
96
63
 
64
+ `media` cannot be combined with `actions`.
65
+
66
+ ### Push Notifications with Redirection
67
+
68
+ Open a web page, run an iOS Shortcut, or open an app when someone taps the notification. `redirection` supports:
69
+
70
+ - **HTTP/HTTPS:** Web pages, e.g. `https://example.com`
71
+ - **Shortcuts:** Run Jarvis with `shortcuts://run-shortcut?name=Jarvis` <!-- full-width -->
72
+ - **App deep links:** Installed apps or specific content within them
73
+ - **Spotify:** A track, e.g. `spotify:track:6rqhFgbbKwnb9MLmUQDhG6`
74
+ - **Termius:** `termius://` to open the app
75
+ - **Claude:** `claude://code` to open the Code tab
76
+ - **ChatGPT:** `chatgpt://` to open the app <!-- Verify ChatGPT URL scheme on iOS before publishing -->
77
+
78
+ ```js
79
+ await activitysmith.notifications.send({
80
+ title: "Homepage ready",
81
+ message: "Your agent finished the redesign.",
82
+ redirection: "https://github.com/acme/web/pull/482",
83
+ });
84
+ ```
85
+
97
86
  ### Actionable Push Notifications
98
87
 
99
- <p align="center">
100
- <img src="https://cdn.activitysmith.com/features/actionable-push-notifications-2.png" alt="Actionable push notification example" width="680" />
101
- </p>
88
+ ![Actionable Push Notification with redirection and actions](https://cdn.activitysmith.com/features/actionable-push-notifications-2.png)
102
89
 
103
- Push notification `redirection` and `actions` are optional. Use them to open HTTPS URLs, run a specific iPhone Shortcut with `shortcuts://run-shortcut?name=...`, or trigger backend webhook workflows.
104
- Webhooks are executed by the ActivitySmith backend.
90
+ `open_url` actions open a web page, run an iOS Shortcut, or open an app when someone taps the button. Supported links:
105
91
 
106
- ```ts
92
+ - **HTTP/HTTPS:** Web pages, e.g. `https://example.com`
93
+ - **Shortcuts:** Run Jarvis with `shortcuts://run-shortcut?name=Jarvis` <!-- full-width -->
94
+ - **App deep links:** Installed apps or specific content within them
95
+ - **Spotify:** A track, e.g. `spotify:track:6rqhFgbbKwnb9MLmUQDhG6`
96
+ - **Termius:** `termius://` to open the app
97
+ - **Claude:** `claude://code` to open the Code tab
98
+ - **ChatGPT:** `chatgpt://` to open the app <!-- Verify ChatGPT URL scheme on iOS before publishing -->
99
+
100
+ Webhooks are executed by the ActivitySmith backend and must use HTTPS.
101
+
102
+ ```js
107
103
  await activitysmith.notifications.send({
108
104
  title: "New subscription 💸",
109
105
  message: "Customer upgraded to Pro plan",
110
- redirection: "https://crm.example.com/customers/cus_9f3a1d", // Optional
111
106
  actions: [
112
107
  {
113
- title: "Open CRM Profile",
108
+ title: "Open CRM",
114
109
  type: "open_url",
115
110
  url: "https://crm.example.com/customers/cus_9f3a1d",
116
111
  },
@@ -129,20 +124,37 @@ await activitysmith.notifications.send({
129
124
  plan: "pro",
130
125
  },
131
126
  },
132
- ], // Optional (max 4)
127
+ ],
133
128
  });
134
129
  ```
135
130
 
136
131
  ## Live Activities
137
132
 
138
- There are six types of Live Activities:
133
+ Choose the Live Activity type that matches what you want to show:
134
+
135
+ ![Stats Live Activity with six labeled sales metrics](https://cdn.activitysmith.com/features/stats-live-activity.png)
136
+
137
+ **Stats**: Show up to 8 labeled values on your Lock Screen, from revenue and orders to uptime and conversion.
138
+
139
+ ![Metrics Live Activity with CPU and memory values](https://cdn.activitysmith.com/features/metrics-live-activity-start.png)
140
+
141
+ **Metrics**: Track two related values with segmented bars, such as CPU and memory.
142
+
143
+ ![Segmented Progress Live Activity showing a workflow step](https://cdn.activitysmith.com/features/update-live-activity.png)
144
+
145
+ **Segmented Progress**: Show progress through a known set of steps, like build, test, deploy, and verify.
146
+
147
+ ![Progress Live Activity showing percentage completion](https://cdn.activitysmith.com/features/progress-live-activity.png)
139
148
 
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
144
- - `alert`: best for status updates, such as feature adoption, reactivation, onboarding blockers, incidents, escalations, and other operational states
145
- - `timer`: best for countdowns and elapsed runtime, like benchmark runs, uploads, backups, transcodes, and long-running jobs
149
+ **Progress**: Show percentage progress for jobs that move continuously toward completion.
150
+
151
+ ![Alert Live Activity showing a customer reactivation update](https://cdn.activitysmith.com/features/alert-live-activity.png)
152
+
153
+ **Alert**: Show status updates with a clear message, badge, and icon. When you add an action button, `color` controls the button tint.
154
+
155
+ ![Timer Live Activity showing a benchmark run countdown](https://cdn.activitysmith.com/features/timer-live-activity.png)
156
+
157
+ **Timer**: Count down from a duration, or count up from 00:00 while a job runs.
146
158
 
147
159
  ### Start & Update Live Activity
148
160
 
@@ -150,9 +162,7 @@ Use a stable `streamKey` to identify the metric, job, deployment, or system you
150
162
 
151
163
  #### Stats
152
164
 
153
- <p align="center">
154
- <img src="https://cdn.activitysmith.com/features/stats-live-activity.png" alt="Stats Live Activity stream example" width="680" />
155
- </p>
165
+ ![Stats Live Activity stream example](https://cdn.activitysmith.com/features/stats-live-activity.png)
156
166
 
157
167
  ```ts
158
168
  await activitysmith.liveActivities.stream("sales-hourly", {
@@ -174,9 +184,7 @@ await activitysmith.liveActivities.stream("sales-hourly", {
174
184
 
175
185
  #### Metrics
176
186
 
177
- <p align="center">
178
- <img src="https://cdn.activitysmith.com/features/metrics-live-activity-start.png" alt="Metrics Live Activity stream example" width="680" />
179
- </p>
187
+ ![Metrics Live Activity stream example](https://cdn.activitysmith.com/features/metrics-live-activity-start.png)
180
188
 
181
189
  ```ts
182
190
  await activitysmith.liveActivities.stream("prod-web-1", {
@@ -194,9 +202,7 @@ await activitysmith.liveActivities.stream("prod-web-1", {
194
202
 
195
203
  #### Segmented Progress
196
204
 
197
- <p align="center">
198
- <img src="https://cdn.activitysmith.com/features/update-live-activity.png" alt="Segmented Progress Live Activity stream example" width="680" />
199
- </p>
205
+ ![Segmented Progress Live Activity stream example](https://cdn.activitysmith.com/features/update-live-activity.png)
200
206
 
201
207
  ```ts
202
208
  await activitysmith.liveActivities.stream("nightly-backup", {
@@ -212,9 +218,7 @@ await activitysmith.liveActivities.stream("nightly-backup", {
212
218
 
213
219
  #### Progress
214
220
 
215
- <p align="center">
216
- <img src="https://cdn.activitysmith.com/features/progress-live-activity.png" alt="Progress Live Activity stream example" width="680" />
217
- </p>
221
+ ![Progress Live Activity stream example](https://cdn.activitysmith.com/features/progress-live-activity.png)
218
222
 
219
223
  ```ts
220
224
  await activitysmith.liveActivities.stream("search-reindex", {
@@ -229,9 +233,7 @@ await activitysmith.liveActivities.stream("search-reindex", {
229
233
 
230
234
  #### Alert
231
235
 
232
- <p align="center">
233
- <img src="https://cdn.activitysmith.com/features/alert-live-activity.png" alt="Alert Live Activity stream example" width="680" />
234
- </p>
236
+ ![Alert Live Activity stream example](https://cdn.activitysmith.com/features/alert-live-activity.png)
235
237
 
236
238
  ```ts
237
239
  await activitysmith.liveActivities.stream("customer-ops", {
@@ -247,9 +249,7 @@ await activitysmith.liveActivities.stream("customer-ops", {
247
249
 
248
250
  #### Timer
249
251
 
250
- <p align="center">
251
- <img src="https://cdn.activitysmith.com/features/timer-live-activity.png" alt="Timer Live Activity showing a benchmark run countdown" width="680" />
252
- </p>
252
+ ![Timer Live Activity stream example](https://cdn.activitysmith.com/features/timer-live-activity.png)
253
253
 
254
254
  ```ts
255
255
  await activitysmith.liveActivities.stream("benchmark-run", {
@@ -269,7 +269,7 @@ To start at 00:00 and count up, set `counts_down: false` and leave out `duration
269
269
 
270
270
  ### End Live Activity
271
271
 
272
- Call `endStream(...)` with the same `streamKey` 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.
272
+ Call `endStream(...)` with the same `streamKey` to dismiss the Live Activity. You can include final values before it is removed. Set `auto_dismiss_seconds` to dismiss it after a delay in seconds, or `auto_dismiss_minutes` for minutes. Use `0` for immediate dismissal. Seconds take precedence if both are set.
273
273
 
274
274
  ```ts
275
275
  await activitysmith.liveActivities.endStream("prod-web-1", {
@@ -281,25 +281,82 @@ await activitysmith.liveActivities.endStream("prod-web-1", {
281
281
  { label: "CPU", value: 7, unit: "%" },
282
282
  { label: "MEM", value: 38, unit: "%" },
283
283
  ],
284
- auto_dismiss_minutes: 2,
284
+ auto_dismiss_seconds: 30,
285
285
  },
286
286
  });
287
287
  ```
288
288
 
289
+ ### Icons and Badges
290
+
291
+ Add more context to Live Activities with icons and badges.
292
+
293
+ #### Icon
294
+
295
+ Supported Live Activity types: `stats`, `metrics`, `progress`, `segmented_progress`, `alert`, and `timer`.
296
+
297
+ ![Metrics Live Activity with an SF Symbol icon on the iPhone Lock Screen](https://cdn.activitysmith.com/features/metrics-live-activity-with-icon.png)
298
+
299
+ ```ts
300
+ await activitysmith.liveActivities.stream("prod-web-1", {
301
+ content_state: ActivitySmith.contentState({
302
+ title: "Server Health",
303
+ subtitle: "prod-web-1",
304
+ type: "metrics",
305
+ icon: ActivitySmith.alertIcon("server.rack", { color: "blue" }),
306
+ metrics: [
307
+ { label: "CPU", value: 18, unit: "%" },
308
+ { label: "MEM", value: 42, unit: "%" },
309
+ ],
310
+ }),
311
+ });
312
+ ```
313
+
314
+ The `icon.symbol` value is an Apple SF Symbol name. Browse the catalog with one of these tools:
315
+
316
+ - [ActivitySmith app](https://apps.apple.com/us/app/activitysmith/id6752254835) - Open Settings -> SF Symbols to browse 45 hand-picked icons ready to use
317
+ - [SF Symbols](https://developer.apple.com/sf-symbols/) - Apple's official macOS app
318
+ - [Interactful](https://apps.apple.com/app/interactful/id1528095640) - free third-party iOS app listing all SF Symbols under Foundations -> Iconography
319
+
320
+ #### Badge
321
+
322
+ Badges are supported by `alert`, `progress`, and `segmented_progress` Live Activities.
323
+
324
+ ![Progress Live Activity with a badge on the iPhone Lock Screen](https://cdn.activitysmith.com/features/progress-live-activity-with-badge.png)
325
+
326
+ ```ts
327
+ await activitysmith.liveActivities.stream("nightly-database-backup", {
328
+ content_state: ActivitySmith.contentState({
329
+ title: "Nightly Database Backup",
330
+ subtitle: "verify restore",
331
+ type: "progress",
332
+ badge: ActivitySmith.alertBadge("S3", { color: "cyan" }),
333
+ percentage: 62,
334
+ }),
335
+ });
336
+ ```
337
+
338
+ ### Live Activity Colors
339
+
340
+ Choose from these colors for the Live Activity accent, including progress bars and action buttons, or apply them to an individual icon or badge:
341
+
342
+ `lime`, `green`, `cyan`, `blue`, `purple`, `magenta`, `red`, `orange`, `yellow`, `gray`
343
+
289
344
  ### Live Activity Action
290
345
 
291
- Live Activities can include an action button.
346
+ ![Metrics Live Activity with action](https://cdn.activitysmith.com/features/metrics-live-activity-action.png)
292
347
 
293
- - `open_url`: open an HTTPS URL.
294
- - `open_url` with a `shortcuts://` URL: run an Apple Shortcut, for example to open an app.
295
- - `webhook`: trigger a backend GET/POST workflow.
348
+ Live Activities can include an action button.
296
349
 
297
- <p align="center">
298
- <img src="https://cdn.activitysmith.com/features/metrics-live-activity-action.png" alt="Live Activity with action button" width="680" />
299
- </p>
350
+ - `open_url`: Open a web page or run an iOS Shortcut
351
+ - `webhook`: Trigger a backend GET/POST workflow
300
352
 
301
353
  #### Open URL action
302
354
 
355
+ Open a web page or run an iOS Shortcut when someone taps the button. Supported links:
356
+
357
+ - **HTTP/HTTPS:** Web pages, e.g. `https://example.com`
358
+ - **Shortcuts:** Run Jarvis with `shortcuts://run-shortcut?name=Jarvis` <!-- full-width -->
359
+
303
360
  ```ts
304
361
  await activitysmith.liveActivities.stream("prod-web-1", {
305
362
  content_state: {
@@ -314,7 +371,7 @@ await activitysmith.liveActivities.stream("prod-web-1", {
314
371
  action: {
315
372
  title: "Dashboard",
316
373
  type: "open_url",
317
- url: "https://ops.example.com/servers/prod-web-1",
374
+ url: "https://status.example.com/servers/prod-web-1",
318
375
  },
319
376
  });
320
377
  ```
@@ -322,13 +379,15 @@ await activitysmith.liveActivities.stream("prod-web-1", {
322
379
  #### Apple Shortcut action
323
380
 
324
381
  ```ts
325
- await activitysmith.liveActivities.stream("deploy-payments-api", {
382
+ await activitysmith.liveActivities.stream("prod-web-1", {
326
383
  content_state: {
327
- title: "Deploying payments-api",
328
- subtitle: "Running database migrations",
329
- type: "segmented_progress",
330
- number_of_steps: 5,
331
- current_step: 3,
384
+ title: "Server Health",
385
+ subtitle: "prod-web-1",
386
+ type: "metrics",
387
+ metrics: [
388
+ { label: "CPU", value: 76, unit: "%" },
389
+ { label: "MEM", value: 52, unit: "%" },
390
+ ],
332
391
  },
333
392
  action: {
334
393
  title: "Chat with Jarvis",
@@ -364,9 +423,7 @@ await activitysmith.liveActivities.stream("search-reindex", {
364
423
 
365
424
  #### Secondary action
366
425
 
367
- <p align="center">
368
- <img src="https://cdn.activitysmith.com/features/live-activity-secondary-action.png" alt="Alert Live Activity with primary and secondary action buttons" width="680" />
369
- </p>
426
+ ![Alert Live Activity with primary and secondary action buttons](https://cdn.activitysmith.com/features/live-activity-secondary-action.png)
370
427
 
371
428
  Use `secondary_action` when you want a second button beside the primary `action`.
372
429
 
@@ -411,76 +468,13 @@ await activitysmith.liveActivities.stream("agent-approval", {
411
468
  });
412
469
  ```
413
470
 
414
- ### Icons and Badges
415
-
416
- Add more context to Live Activities with icons and badges.
471
+ ## Lock Screen Widgets
417
472
 
418
- #### Icon
473
+ ![Lock screen widgets](https://cdn.activitysmith.com/features/lock-screen-widgets.png)
419
474
 
420
- Supported Live Activity types: `stats`, `metrics`, `progress`, `segmented_progress`, `alert`, and `timer`.
475
+ 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 [web app](https://activitysmith.com/app/widgets), then update the metric value using our API, add a widget to your lock screen and it will fetch the latest update automatically.
421
476
 
422
- <p align="center">
423
- <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" />
424
- </p>
425
-
426
- ```ts
427
- await activitysmith.liveActivities.stream("prod-web-1", {
428
- content_state: ActivitySmith.contentState({
429
- title: "Server Health",
430
- subtitle: "prod-web-1",
431
- type: "metrics",
432
- icon: ActivitySmith.alertIcon("server.rack", { color: "blue" }),
433
- metrics: [
434
- { label: "CPU", value: 18, unit: "%" },
435
- { label: "MEM", value: 42, unit: "%" },
436
- ],
437
- }),
438
- });
439
- ```
440
-
441
- The `icon.symbol` value is an Apple SF Symbol name. Browse the catalog with one of these tools:
442
-
443
- - [ActivitySmith app](https://apps.apple.com/us/app/activitysmith/id6752254835) - Open Settings -> SF Symbols to browse 45 hand-picked icons ready to use
444
- - [SF Symbols](https://developer.apple.com/sf-symbols/) - Apple's official macOS app
445
- - [Interactful](https://apps.apple.com/app/interactful/id1528095640) - free third-party iOS app listing all SF Symbols under Foundations -> Iconography
446
-
447
- #### Badge
448
-
449
- Badges are supported by `alert`, `progress`, and `segmented_progress` Live Activities.
450
-
451
- <p align="center">
452
- <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" />
453
- </p>
454
-
455
- ```ts
456
- await activitysmith.liveActivities.stream("nightly-database-backup", {
457
- content_state: ActivitySmith.contentState({
458
- title: "Nightly Database Backup",
459
- subtitle: "verify restore",
460
- type: "progress",
461
- badge: ActivitySmith.alertBadge("S3", { color: "cyan" }),
462
- percentage: 62,
463
- }),
464
- });
465
- ```
466
-
467
- ### Live Activity Colors
468
-
469
- Choose from these colors for the Live Activity accent, including progress bars and action buttons, or apply them to an individual icon or badge:
470
-
471
- `lime`, `green`, `cyan`, `blue`, `purple`, `magenta`, `red`, `orange`, `yellow`, `gray`
472
-
473
- ## Widgets
474
-
475
- <p align="center">
476
- <img src="https://cdn.activitysmith.com/features/lock-screen-widgets.png" alt="Lock screen widgets" width="680" />
477
- </p>
478
-
479
- 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.
480
-
481
- <p align="center">
482
- <img src="https://cdn.activitysmith.com/features/create-widget-metric.png" alt="Create widget metric" width="680" />
483
- </p>
477
+ ![Create widget metric](https://cdn.activitysmith.com/features/create-widget-metric.png)
484
478
 
485
479
  Use the metric key to update its value.
486
480
 
@@ -496,65 +490,60 @@ await activitysmith.metrics.update("prod.status", "healthy");
496
490
 
497
491
  ## App Icon Badge Count
498
492
 
499
- <p align="center">
500
- <img src="https://cdn.activitysmith.com/features/badge-count.png" alt="ActivitySmith app icon with an App Icon Badge Count" width="680" />
501
- </p>
493
+ ![ActivitySmith app icon with an App Icon Badge Count](https://cdn.activitysmith.com/features/badge-count.png)
502
494
 
503
495
  Show the number you care about on your ActivitySmith app icon. Track MRR, a customer count, a stock price, or any other value you want to keep in view.
504
496
 
505
- Set or update the badge value.
497
+ ### Set or update the badge value
506
498
 
507
- ```ts
499
+ ```js
508
500
  await activitysmith.badgeCount(8333);
509
501
  ```
510
502
 
511
- To clear the badge, set its value to 0.
503
+ ### Clear the badge
512
504
 
513
- ```ts
505
+ Pass `0` to clear the badge.
506
+
507
+ ```js
514
508
  await activitysmith.badgeCount(0);
515
509
  ```
516
510
 
517
- ## Channels
518
-
519
- Use `channels` to target specific team members or devices
511
+ ## Metadata
520
512
 
521
- ### Push Notifications
513
+ Metadata adds extra information to Push Notification and Live Activity details in ActivitySmith. It does not appear in the notification or Live Activity on your device.
522
514
 
523
- ```ts
515
+ ```js
524
516
  await activitysmith.notifications.send({
525
517
  title: "New subscription 💸",
526
518
  message: "Customer upgraded to Pro plan",
527
- channels: ["sales", "customer-success"],
519
+ metadata: {
520
+ customer_id: "382",
521
+ plan: "Pro",
522
+ amount: 29,
523
+ trial: false,
524
+ },
528
525
  });
529
- ```
530
-
531
- ### Live Activities
532
526
 
533
- ```ts
534
- await activitysmith.liveActivities.start({
527
+ await activitysmith.liveActivities.stream("customer-import", {
535
528
  content_state: {
536
- title: "Nightly Database Backup",
537
- subtitle: "verify restore",
529
+ title: "Customer Import",
538
530
  type: "progress",
539
- percentage: 62,
531
+ percentage: 60,
532
+ },
533
+ metadata: {
534
+ job_id: "import-382",
535
+ records: 1200,
540
536
  },
541
- channels: ["sales", "customer-success"],
542
537
  });
543
538
  ```
544
539
 
545
- ### App Icon Badge Count
546
-
547
- ```ts
548
- await activitysmith.badgeCount(3, {
549
- channels: ["sales", "customer-success"],
550
- });
551
- ```
540
+ Values can be strings, numbers, or booleans. Metadata supports up to 50 entries and 16 KB of JSON, with keys up to 100 characters and strings up to 4,000 characters. Nested objects, arrays, and null values are not supported.
552
541
 
553
542
  ## Tags
554
543
 
555
544
  Use `tags` to organize and filter your Push Notification and Live Activity history. Tags are created automatically when you first use them.
556
545
 
557
- ```ts
546
+ ```js
558
547
  await activitysmith.notifications.send({
559
548
  title: "New subscription 💸",
560
549
  message: "Customer upgraded to Pro plan",
@@ -562,26 +551,56 @@ await activitysmith.notifications.send({
562
551
  });
563
552
  ```
564
553
 
554
+ On Live Activity stream updates and legacy `update` or `end` calls, omit `tags` to keep existing Tags, supply a list to replace them, or pass `tags: []` to clear them.
555
+
556
+ ```js
557
+ await activitysmith.liveActivities.update({
558
+ activity_id: "YOUR_ACTIVITY_ID",
559
+ content_state: { title: "Customer Import", percentage: 60 },
560
+ tags: [],
561
+ });
562
+ ```
563
+
564
+ ## Channels
565
+
566
+ Use `channels` to target specific team members or devices when sending Push Notifications, Live Activities, or App Icon Badge Count updates. Omit it for account-wide delivery.
567
+
568
+ ```js
569
+ await activitysmith.notifications.send({
570
+ title: "New subscription 💸",
571
+ message: "Customer upgraded to Pro plan",
572
+ channels: ["sales", "customer-success"],
573
+ });
574
+
575
+ await activitysmith.liveActivities.stream("nightly-backup", {
576
+ content_state: {
577
+ title: "Nightly database backup",
578
+ number_of_steps: 3,
579
+ current_step: 1,
580
+ type: "segmented_progress",
581
+ },
582
+ channels: ["ios-builds"],
583
+ });
584
+
585
+ await activitysmith.badgeCount(3, {
586
+ channels: ["sales", "customer-success"],
587
+ });
588
+ ```
589
+
565
590
  ## Error Handling
566
591
 
567
- ```ts
592
+ SDK calls return promises, so you can wrap API calls with `try/catch`:
593
+
594
+ ```js
568
595
  try {
569
- await activitysmith.notifications.send({
570
- title: "New subscription 💸",
571
- });
596
+ await activitysmith.notifications.send({ title: "Hello" });
572
597
  } catch (error) {
573
598
  console.error(error);
574
599
  }
575
600
  ```
576
601
 
577
- ## TypeScript Support
578
-
579
- This package is written in TypeScript and ships with type definitions out of the box.
580
-
581
- ## Requirements
582
-
583
- - Node.js 18 or newer
602
+ ## Additional Resources
584
603
 
585
- ## License
604
+ ### [NPM Package](https://www.npmjs.com/package/activitysmith)
586
605
 
587
- MIT
606
+ Install the ActivitySmith Node.js SDK from npm
@@ -70,6 +70,76 @@ export interface AlertPayload {
70
70
  */
71
71
  body?: string;
72
72
  }
73
+ /**
74
+ *
75
+ * @export
76
+ * @interface AppIconBadgeCountUpdateError
77
+ */
78
+ export interface AppIconBadgeCountUpdateError {
79
+ /**
80
+ *
81
+ * @type {string}
82
+ * @memberof AppIconBadgeCountUpdateError
83
+ */
84
+ error: string;
85
+ /**
86
+ *
87
+ * @type {string}
88
+ * @memberof AppIconBadgeCountUpdateError
89
+ */
90
+ code: AppIconBadgeCountUpdateErrorCodeEnum;
91
+ /**
92
+ *
93
+ * @type {string}
94
+ * @memberof AppIconBadgeCountUpdateError
95
+ */
96
+ message: string;
97
+ /**
98
+ *
99
+ * @type {number}
100
+ * @memberof AppIconBadgeCountUpdateError
101
+ */
102
+ badge: number;
103
+ /**
104
+ *
105
+ * @type {number}
106
+ * @memberof AppIconBadgeCountUpdateError
107
+ */
108
+ devices_targeted?: number;
109
+ /**
110
+ *
111
+ * @type {number}
112
+ * @memberof AppIconBadgeCountUpdateError
113
+ */
114
+ devices_updated: number;
115
+ /**
116
+ *
117
+ * @type {number}
118
+ * @memberof AppIconBadgeCountUpdateError
119
+ */
120
+ users_updated?: number;
121
+ /**
122
+ * Deprecated compatibility alias for devices_updated.
123
+ * @type {number}
124
+ * @memberof AppIconBadgeCountUpdateError
125
+ * @deprecated
126
+ */
127
+ devices_notified?: number;
128
+ /**
129
+ *
130
+ * @type {Array<string>}
131
+ * @memberof AppIconBadgeCountUpdateError
132
+ */
133
+ effective_channel_slugs?: Array<string>;
134
+ }
135
+ /**
136
+ * @export
137
+ */
138
+ export declare const AppIconBadgeCountUpdateErrorCodeEnum: {
139
+ readonly DeviceDisconnected: "badge_device_disconnected";
140
+ readonly UpdateFailed: "badge_update_failed";
141
+ };
142
+ export type AppIconBadgeCountUpdateErrorCodeEnum = typeof AppIconBadgeCountUpdateErrorCodeEnum[keyof typeof AppIconBadgeCountUpdateErrorCodeEnum];
73
143
  /**
74
144
  *
75
145
  * @export
@@ -108,17 +178,31 @@ export interface AppIconBadgeCountUpdateResponse {
108
178
  */
109
179
  badge: number;
110
180
  /**
111
- *
181
+ * Number of devices whose App Icon Badge Count was updated.
112
182
  * @type {number}
113
183
  * @memberof AppIconBadgeCountUpdateResponse
114
184
  */
115
- devices_notified: number;
185
+ devices_updated: number;
116
186
  /**
117
- *
187
+ * Number of account users with at least one updated device.
188
+ * @type {number}
189
+ * @memberof AppIconBadgeCountUpdateResponse
190
+ */
191
+ users_updated: number;
192
+ /**
193
+ * Deprecated compatibility alias for devices_updated.
194
+ * @type {number}
195
+ * @memberof AppIconBadgeCountUpdateResponse
196
+ * @deprecated
197
+ */
198
+ devices_notified?: number;
199
+ /**
200
+ * Deprecated compatibility alias for users_updated.
118
201
  * @type {number}
119
202
  * @memberof AppIconBadgeCountUpdateResponse
203
+ * @deprecated
120
204
  */
121
- users_notified: number;
205
+ users_notified?: number;
122
206
  /**
123
207
  *
124
208
  * @type {Array<string>}
@@ -822,12 +906,26 @@ export type LiveActivityColor = typeof LiveActivityColor[keyof typeof LiveActivi
822
906
  * @interface LiveActivityEndRequest
823
907
  */
824
908
  export interface LiveActivityEndRequest {
909
+ /**
910
+ * Additional information shown in notification and Live Activity details in ActivitySmith. Not displayed in the Push Notification or Live Activity on the device. Values must be strings, finite numbers, or booleans. At most 50 entries and 16 KB of serialized UTF-8 JSON. Omit on updates to preserve existing Metadata; send {} to clear it.
911
+ * @type {{ [key: string]: MetadataValue; }}
912
+ * @memberof LiveActivityEndRequest
913
+ */
914
+ metadata?: {
915
+ [key: string]: MetadataValue;
916
+ };
825
917
  /**
826
918
  *
827
919
  * @type {string}
828
920
  * @memberof LiveActivityEndRequest
829
921
  */
830
922
  activity_id: string;
923
+ /**
924
+ * Tags for notification history. Omit to keep existing Tags, supply an array to replace them, or send an empty array to clear them.
925
+ * @type {Array<string>}
926
+ * @memberof LiveActivityEndRequest
927
+ */
928
+ tags?: Array<string>;
831
929
  /**
832
930
  *
833
931
  * @type {ContentStateEnd}
@@ -909,11 +1007,23 @@ export interface LiveActivityLimitError {
909
1007
  */
910
1008
  limit: number;
911
1009
  /**
912
- * Current number of active Live Activities.
1010
+ * Highest number of active Live Activities among the targeted devices.
913
1011
  * @type {number}
914
1012
  * @memberof LiveActivityLimitError
915
1013
  */
916
1014
  active: number;
1015
+ /**
1016
+ * Number of targeted devices that have reached the enforced iOS Live Activity concurrency threshold. Included only when targeted devices have mixed capacity.
1017
+ * @type {number}
1018
+ * @memberof LiveActivityLimitError
1019
+ */
1020
+ blocked_devices?: number;
1021
+ /**
1022
+ * Total number of targeted devices. Included only when targeted devices have mixed capacity.
1023
+ * @type {number}
1024
+ * @memberof LiveActivityLimitError
1025
+ */
1026
+ targeted_devices?: number;
917
1027
  }
918
1028
  /**
919
1029
  * Start a new Live Activity. The response includes activity_id for later update and end calls.
@@ -921,6 +1031,14 @@ export interface LiveActivityLimitError {
921
1031
  * @interface LiveActivityStartRequest
922
1032
  */
923
1033
  export interface LiveActivityStartRequest {
1034
+ /**
1035
+ * Additional information shown in notification and Live Activity details in ActivitySmith. Not displayed in the Push Notification or Live Activity on the device. Values must be strings, finite numbers, or booleans. At most 50 entries and 16 KB of serialized UTF-8 JSON. Omit on updates to preserve existing Metadata; send {} to clear it.
1036
+ * @type {{ [key: string]: MetadataValue; }}
1037
+ * @memberof LiveActivityStartRequest
1038
+ */
1039
+ metadata?: {
1040
+ [key: string]: MetadataValue;
1041
+ };
924
1042
  /**
925
1043
  *
926
1044
  * @type {ContentStateStart}
@@ -1013,6 +1131,20 @@ export interface LiveActivityStartResponse {
1013
1131
  * @interface LiveActivityStreamDeleteRequest
1014
1132
  */
1015
1133
  export interface LiveActivityStreamDeleteRequest {
1134
+ /**
1135
+ * Additional information shown in notification and Live Activity details in ActivitySmith. Not displayed in the Push Notification or Live Activity on the device. Values must be strings, finite numbers, or booleans. At most 50 entries and 16 KB of serialized UTF-8 JSON. Omit on updates to preserve existing Metadata; send {} to clear it.
1136
+ * @type {{ [key: string]: MetadataValue; }}
1137
+ * @memberof LiveActivityStreamDeleteRequest
1138
+ */
1139
+ metadata?: {
1140
+ [key: string]: MetadataValue;
1141
+ };
1142
+ /**
1143
+ * Optional tags to organize and filter notification history.
1144
+ * @type {Array<string>}
1145
+ * @memberof LiveActivityStreamDeleteRequest
1146
+ */
1147
+ tags?: Array<string>;
1016
1148
  /**
1017
1149
  *
1018
1150
  * @type {StreamContentState}
@@ -1184,6 +1316,14 @@ export type LiveActivityStreamPutResponseOperationEnum = typeof LiveActivityStre
1184
1316
  * @interface LiveActivityStreamRequest
1185
1317
  */
1186
1318
  export interface LiveActivityStreamRequest {
1319
+ /**
1320
+ * Additional information shown in notification and Live Activity details in ActivitySmith. Not displayed in the Push Notification or Live Activity on the device. Values must be strings, finite numbers, or booleans. At most 50 entries and 16 KB of serialized UTF-8 JSON. Omit on updates to preserve existing Metadata; send {} to clear it.
1321
+ * @type {{ [key: string]: MetadataValue; }}
1322
+ * @memberof LiveActivityStreamRequest
1323
+ */
1324
+ metadata?: {
1325
+ [key: string]: MetadataValue;
1326
+ };
1187
1327
  /**
1188
1328
  *
1189
1329
  * @type {StreamContentState}
@@ -1233,12 +1373,26 @@ export interface LiveActivityStreamRequest {
1233
1373
  * @interface LiveActivityUpdateRequest
1234
1374
  */
1235
1375
  export interface LiveActivityUpdateRequest {
1376
+ /**
1377
+ * Additional information shown in notification and Live Activity details in ActivitySmith. Not displayed in the Push Notification or Live Activity on the device. Values must be strings, finite numbers, or booleans. At most 50 entries and 16 KB of serialized UTF-8 JSON. Omit on updates to preserve existing Metadata; send {} to clear it.
1378
+ * @type {{ [key: string]: MetadataValue; }}
1379
+ * @memberof LiveActivityUpdateRequest
1380
+ */
1381
+ metadata?: {
1382
+ [key: string]: MetadataValue;
1383
+ };
1236
1384
  /**
1237
1385
  *
1238
1386
  * @type {string}
1239
1387
  * @memberof LiveActivityUpdateRequest
1240
1388
  */
1241
1389
  activity_id: string;
1390
+ /**
1391
+ * Tags for notification history. Omit to keep existing Tags, supply an array to replace them, or send an empty array to clear them.
1392
+ * @type {Array<string>}
1393
+ * @memberof LiveActivityUpdateRequest
1394
+ */
1395
+ tags?: Array<string>;
1242
1396
  /**
1243
1397
  *
1244
1398
  * @type {ContentStateUpdate}
@@ -1304,6 +1458,12 @@ export declare const LiveActivityWebhookMethod: {
1304
1458
  readonly Post: "POST";
1305
1459
  };
1306
1460
  export type LiveActivityWebhookMethod = typeof LiveActivityWebhookMethod[keyof typeof LiveActivityWebhookMethod];
1461
+ /**
1462
+ * @type MetadataValue
1463
+ *
1464
+ * @export
1465
+ */
1466
+ export type MetadataValue = boolean | number | string;
1307
1467
  /**
1308
1468
  *
1309
1469
  * @export
@@ -1425,7 +1585,7 @@ export interface PushNotificationAction {
1425
1585
  */
1426
1586
  type: PushNotificationActionType;
1427
1587
  /**
1428
- * Action URL. For open_url, use an HTTP or HTTPS URL or a shortcuts://run-shortcut?name=... URL that runs a specific iPhone Shortcut. For webhook, use an HTTPS URL called by the ActivitySmith backend.
1588
+ * Action URL. For open_url, use HTTP, HTTPS, Shortcuts, or an installed app’s custom URL scheme, such as spotify:// or spotify:track:123. Custom app schemes require iOS 1.13.4 build 2 or later; no web fallback is provided. Internal and executable schemes are blocked. For webhook, use an HTTPS URL called by the ActivitySmith backend.
1429
1589
  * @type {string}
1430
1590
  * @memberof PushNotificationAction
1431
1591
  */
@@ -1459,6 +1619,14 @@ export type PushNotificationActionType = typeof PushNotificationActionType[keyof
1459
1619
  */
1460
1620
  export interface PushNotificationRequest {
1461
1621
  [key: string]: any | any;
1622
+ /**
1623
+ * Additional information shown in notification and Live Activity details in ActivitySmith. Not displayed in the Push Notification or Live Activity on the device. Values must be strings, finite numbers, or booleans. At most 50 entries and 16 KB of serialized UTF-8 JSON. Omit on updates to preserve existing Metadata; send {} to clear it.
1624
+ * @type {{ [key: string]: MetadataValue; }}
1625
+ * @memberof PushNotificationRequest
1626
+ */
1627
+ metadata?: {
1628
+ [key: string]: MetadataValue;
1629
+ };
1462
1630
  /**
1463
1631
  *
1464
1632
  * @type {string}
@@ -1484,7 +1652,7 @@ export interface PushNotificationRequest {
1484
1652
  */
1485
1653
  media?: string;
1486
1654
  /**
1487
- * Optional HTTP URL, HTTPS URL, or shortcuts://run-shortcut?name=... URL opened when the user taps the notification body. Use shortcuts://run-shortcut?name=... to run a specific iPhone Shortcut that already exists on the user's device. Overrides the default tap target from `media` when both are provided.
1655
+ * Optional HTTP, HTTPS, Shortcuts, or installed app URL opened when the user taps the notification body. Custom schemes such as spotify:// and spotify:track:123 require iOS 1.13.4 build 2 or later and an installed handler; no web fallback is provided. Internal and executable schemes are blocked. Overrides the default tap target from media.
1488
1656
  * @type {string}
1489
1657
  * @memberof PushNotificationRequest
1490
1658
  */
@@ -1790,3 +1958,9 @@ export declare const StreamContentStateStepColorsEnum: {
1790
1958
  readonly Gray: "gray";
1791
1959
  };
1792
1960
  export type StreamContentStateStepColorsEnum = typeof StreamContentStateStepColorsEnum[keyof typeof StreamContentStateStepColorsEnum];
1961
+ /**
1962
+ * @type UpdateAppIconBadgeCount422Response
1963
+ *
1964
+ * @export
1965
+ */
1966
+ export type UpdateAppIconBadgeCount422Response = AppIconBadgeCountUpdateError | NoRecipientsError;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StreamContentStateStepColorsEnum = exports.StreamContentStateStepColorEnum = exports.StreamContentStateColorEnum = exports.StreamContentStateTypeEnum = exports.PushNotificationWebhookMethod = exports.PushNotificationActionType = exports.LiveActivityWebhookMethod = exports.LiveActivityStreamPutResponseOperationEnum = exports.LiveActivityStreamDeleteResponseOperationEnum = exports.LiveActivityColor = exports.LiveActivityActionType = exports.ContentStateUpdateStepColorsEnum = exports.ContentStateUpdateStepColorEnum = exports.ContentStateUpdateColorEnum = exports.ContentStateUpdateTypeEnum = exports.ContentStateStartStepColorsEnum = exports.ContentStateStartStepColorEnum = exports.ContentStateStartColorEnum = exports.ContentStateStartTypeEnum = exports.ContentStateEndStepColorsEnum = exports.ContentStateEndStepColorEnum = exports.ContentStateEndColorEnum = exports.ContentStateEndTypeEnum = exports.ActivityMetricColorEnum = void 0;
3
+ exports.StreamContentStateStepColorsEnum = exports.StreamContentStateStepColorEnum = exports.StreamContentStateColorEnum = exports.StreamContentStateTypeEnum = exports.PushNotificationWebhookMethod = exports.PushNotificationActionType = exports.LiveActivityWebhookMethod = exports.LiveActivityStreamPutResponseOperationEnum = exports.LiveActivityStreamDeleteResponseOperationEnum = exports.LiveActivityColor = exports.LiveActivityActionType = exports.ContentStateUpdateStepColorsEnum = exports.ContentStateUpdateStepColorEnum = exports.ContentStateUpdateColorEnum = exports.ContentStateUpdateTypeEnum = exports.ContentStateStartStepColorsEnum = exports.ContentStateStartStepColorEnum = exports.ContentStateStartColorEnum = exports.ContentStateStartTypeEnum = exports.ContentStateEndStepColorsEnum = exports.ContentStateEndStepColorEnum = exports.ContentStateEndColorEnum = exports.ContentStateEndTypeEnum = exports.AppIconBadgeCountUpdateErrorCodeEnum = exports.ActivityMetricColorEnum = void 0;
4
4
  /**
5
5
  * @export
6
6
  */
@@ -16,6 +16,13 @@ exports.ActivityMetricColorEnum = {
16
16
  Yellow: 'yellow',
17
17
  Gray: 'gray'
18
18
  };
19
+ /**
20
+ * @export
21
+ */
22
+ exports.AppIconBadgeCountUpdateErrorCodeEnum = {
23
+ DeviceDisconnected: 'badge_device_disconnected',
24
+ UpdateFailed: 'badge_update_failed'
25
+ };
19
26
  /**
20
27
  * @export
21
28
  */
@@ -1,6 +1,10 @@
1
1
  import { AppIconBadgesApi, LiveActivitiesApi, MetricsApi, PushNotificationsApi } from "../generated/index";
2
2
  export interface ActivitySmithOptions {
3
3
  apiKey: string;
4
+ sdk?: {
5
+ name: string;
6
+ version: string;
7
+ };
4
8
  }
5
9
  type PushRequestBody = Parameters<PushNotificationsApi["sendPushNotification"]>[0]["pushNotificationRequest"];
6
10
  type PushSendParameters = Parameters<PushNotificationsApi["sendPushNotification"]>[0];
@@ -2,9 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ActivitySmith = exports.MetricsResource = exports.LiveActivitiesResource = exports.NotificationsResource = void 0;
4
4
  const index_1 = require("../generated/index");
5
- const SDK_VERSION = "1.10.0";
5
+ const SDK_VERSION = "1.11.0";
6
6
  const SDK_HEADER_NAME = "X-ActivitySmith-SDK";
7
- const SDK_HEADER_VALUE = `node-v${SDK_VERSION}`;
7
+ const DEFAULT_SDK_NAME = "node";
8
+ const SDK_HEADER_VALUE = `${DEFAULT_SDK_NAME}-v${SDK_VERSION}`;
8
9
  const LiveActivityTypes = {
9
10
  segmentedProgress: "segmented_progress",
10
11
  progress: "progress",
@@ -28,6 +29,20 @@ function withTargetChannels(request) {
28
29
  function compactObject(value) {
29
30
  return Object.fromEntries(Object.entries(value).filter(([, entryValue]) => entryValue !== undefined));
30
31
  }
32
+ function sdkHeaderValue(sdk) {
33
+ if (!sdk) {
34
+ return SDK_HEADER_VALUE;
35
+ }
36
+ const name = sdk.name.trim().toLowerCase();
37
+ const version = sdk.version.trim();
38
+ if (!/^[a-z][a-z0-9]*$/.test(name)) {
39
+ throw new Error("ActivitySmith: sdk.name must start with a letter and contain only letters and numbers");
40
+ }
41
+ if (!version) {
42
+ throw new Error("ActivitySmith: sdk.version is required");
43
+ }
44
+ return `${name}-v${version}`;
45
+ }
31
46
  function contentState(value) {
32
47
  return compactObject(value);
33
48
  }
@@ -180,7 +195,7 @@ class ActivitySmith {
180
195
  const config = new index_1.Configuration({
181
196
  accessToken: opts.apiKey,
182
197
  headers: {
183
- [SDK_HEADER_NAME]: SDK_HEADER_VALUE,
198
+ [SDK_HEADER_NAME]: sdkHeaderValue(opts.sdk),
184
199
  },
185
200
  });
186
201
  this.notifications = new NotificationsResource(new index_1.PushNotificationsApi(config));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "activitysmith",
3
- "version": "1.10.0",
3
+ "version": "1.11.0",
4
4
  "description": "Official ActivitySmith Node.js SDK",
5
5
  "keywords": [
6
6
  "activitysmith",
@@ -44,7 +44,7 @@
44
44
  "node": ">=18"
45
45
  },
46
46
  "scripts": {
47
- "clean": "tsc -b --clean",
47
+ "clean": "tsc -b --clean && node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\"",
48
48
  "build": "npm run clean && tsc -b",
49
49
  "prepublishOnly": "npm run build",
50
50
  "test": "npm run build && vitest run"