activitysmith 0.1.8 → 1.0.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
@@ -32,7 +32,7 @@ const activitysmith = new ActivitySmith({
32
32
  });
33
33
  ```
34
34
 
35
- ## Usage
35
+ ## Push Notifications
36
36
 
37
37
  ### Send a Push Notification
38
38
 
@@ -41,13 +41,72 @@ const activitysmith = new ActivitySmith({
41
41
  </p>
42
42
 
43
43
  ```ts
44
- const response = await activitysmith.notifications.send({
44
+ await activitysmith.notifications.send({
45
45
  title: "New subscription 💸",
46
46
  message: "Customer upgraded to Pro plan",
47
47
  });
48
+ ```
49
+
50
+ ### Rich Push Notifications with Media
51
+
52
+ <p align="center">
53
+ <img src="https://cdn.activitysmith.com/features/rich-push-notification-with-image.png" alt="Rich push notification with image" width="680" />
54
+ </p>
48
55
 
49
- console.log(response.success);
50
- console.log(response.devices_notified);
56
+ ```ts
57
+ await activitysmith.notifications.send({
58
+ title: "Homepage ready",
59
+ message: "Your agent finished the redesign.",
60
+ media: "https://cdn.example.com/output/homepage-v2.png",
61
+ redirection: "https://github.com/acme/web/pull/482",
62
+ });
63
+ ```
64
+
65
+ 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.
66
+
67
+ <p align="center">
68
+ <img src="https://cdn.activitysmith.com/features/rich-push-notification-with-audio.png" alt="Rich push notification with audio" width="680" />
69
+ </p>
70
+
71
+ What will work:
72
+
73
+ - direct image URL: `.jpg`, `.png`, `.gif`, etc.
74
+ - direct audio file URL: `.mp3`, `.m4a`, etc.
75
+ - direct video file URL: `.mp4`, `.mov`, etc.
76
+ - URL that responds with a proper media `Content-Type`, even if the path has no extension
77
+
78
+ ### Actionable Push Notifications
79
+
80
+ <p align="center">
81
+ <img src="https://cdn.activitysmith.com/features/actionable-push-notifications-2.png" alt="Actionable push notification example" width="680" />
82
+ </p>
83
+
84
+ Actionable push notifications can open a URL on tap or trigger actions when someone long-presses the notification.
85
+ Webhooks are executed by the ActivitySmith backend.
86
+
87
+ ```ts
88
+ await activitysmith.notifications.send({
89
+ title: "New subscription 💸",
90
+ message: "Customer upgraded to Pro plan",
91
+ redirection: "https://crm.example.com/customers/cus_9f3a1d", // Optional
92
+ actions: [
93
+ {
94
+ title: "Open CRM Profile",
95
+ type: "open_url",
96
+ url: "https://crm.example.com/customers/cus_9f3a1d",
97
+ },
98
+ {
99
+ title: "Start Onboarding Workflow",
100
+ type: "webhook",
101
+ url: "https://hooks.example.com/activitysmith/onboarding/start",
102
+ method: "POST",
103
+ body: {
104
+ customer_id: "cus_9f3a1d",
105
+ plan: "pro",
106
+ },
107
+ },
108
+ ], // Optional (max 4)
109
+ });
51
110
  ```
52
111
 
53
112
  ## Live Activities
@@ -103,7 +162,7 @@ const activityId = start.activity_id;
103
162
  </p>
104
163
 
105
164
  ```ts
106
- const update = await activitysmith.liveActivities.update({
165
+ await activitysmith.liveActivities.update({
107
166
  activity_id: activityId,
108
167
  content_state: {
109
168
  title: "Nightly database backup",
@@ -112,8 +171,6 @@ const update = await activitysmith.liveActivities.update({
112
171
  current_step: 2,
113
172
  },
114
173
  });
115
-
116
- console.log(update.devices_notified);
117
174
  ```
118
175
 
119
176
  #### End
@@ -123,7 +180,7 @@ console.log(update.devices_notified);
123
180
  </p>
124
181
 
125
182
  ```ts
126
- const end = await activitysmith.liveActivities.end({
183
+ await activitysmith.liveActivities.end({
127
184
  activity_id: activityId,
128
185
  content_state: {
129
186
  title: "Nightly database backup",
@@ -133,8 +190,6 @@ const end = await activitysmith.liveActivities.end({
133
190
  auto_dismiss_minutes: 2,
134
191
  },
135
192
  });
136
-
137
- console.log(end.success);
138
193
  ```
139
194
 
140
195
  ### Progress Type
@@ -198,73 +253,68 @@ await activitysmith.liveActivities.end({
198
253
  });
199
254
  ```
200
255
 
201
- ## Channels
202
-
203
- Channels are used to target specific team members or devices. Can be used for both push notifications and live activities.
204
-
205
- ```ts
206
- const response = await activitysmith.notifications.send({
207
- title: "New subscription 💸",
208
- message: "Customer upgraded to Pro plan",
209
- channels: ["sales", "customer-success"], // Optional
210
- });
211
- ```
256
+ ### Live Activity Action
212
257
 
213
- ## Rich Push Notifications with Media
258
+ Just like Actionable Push Notifications, Live Activities can have a button that opens provided URL in a browser or triggers a webhook. Webhooks are executed by the ActivitySmith backend.
214
259
 
215
260
  <p align="center">
216
- <img src="https://cdn.activitysmith.com/features/rich-push-notification-with-image.png" alt="Rich push notification with image" width="680" />
261
+ <img src="https://cdn.activitysmith.com/features/live-activity-with-action.png?v=20260319-1" alt="Live Activity with action" width="680" />
217
262
  </p>
218
263
 
264
+ #### Open URL action
265
+
219
266
  ```ts
220
- const response = await activitysmith.notifications.send({
221
- title: "Homepage ready",
222
- message: "Your agent finished the redesign.",
223
- media: "https://cdn.example.com/output/homepage-v2.png",
224
- redirection: "https://github.com/acme/web/pull/482",
267
+ const start = await activitysmith.liveActivities.start({
268
+ content_state: {
269
+ title: "Deploying payments-api",
270
+ subtitle: "Running database migrations",
271
+ number_of_steps: 5,
272
+ current_step: 3,
273
+ type: "segmented_progress",
274
+ },
275
+ action: {
276
+ title: "Open Workflow",
277
+ type: "open_url",
278
+ url: "https://github.com/acme/payments-api/actions/runs/1234567890",
279
+ },
225
280
  });
226
- ```
227
-
228
- 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.
229
281
 
230
- <p align="center">
231
- <img src="https://cdn.activitysmith.com/features/rich-push-notification-with-audio.png" alt="Rich push notification with audio" width="680" />
232
- </p>
282
+ const activityId = start.activity_id;
283
+ ```
233
284
 
234
- What will work:
285
+ #### Webhook action
235
286
 
236
- - direct image URL: `.jpg`, `.png`, `.gif`, etc.
237
- - direct audio file URL: `.mp3`, `.m4a`, etc.
238
- - direct video file URL: `.mp4`, `.mov`, etc.
239
- - URL that responds with a proper media `Content-Type`, even if the path has no extension
287
+ ```ts
288
+ await activitysmith.liveActivities.update({
289
+ activity_id: activityId,
290
+ content_state: {
291
+ title: "Reindexing product search",
292
+ subtitle: "Shard 7 of 12",
293
+ number_of_steps: 12,
294
+ current_step: 7,
295
+ },
296
+ action: {
297
+ title: "Pause Reindex",
298
+ type: "webhook",
299
+ url: "https://ops.example.com/hooks/search/reindex/pause",
300
+ method: "POST",
301
+ body: {
302
+ job_id: "reindex-2026-03-19",
303
+ requested_by: "activitysmith-node",
304
+ },
305
+ },
306
+ });
307
+ ```
240
308
 
241
- ## Push Notification Redirection and Actions
309
+ ## Channels
242
310
 
243
- Push notification redirection and actions are optional and can be used to redirect the user to a specific URL when they tap the notification or to trigger a specific action when they long-press the notification.
244
- Webhooks are executed by ActivitySmith backend.
311
+ Channels are used to target specific team members or devices. Can be used for both push notifications and live activities.
245
312
 
246
313
  ```ts
247
- const response = await activitysmith.notifications.send({
314
+ await activitysmith.notifications.send({
248
315
  title: "New subscription 💸",
249
316
  message: "Customer upgraded to Pro plan",
250
- redirection: "https://crm.example.com/customers/cus_9f3a1d", // Optional
251
- actions: [
252
- {
253
- title: "Open CRM Profile",
254
- type: "open_url",
255
- url: "https://crm.example.com/customers/cus_9f3a1d",
256
- },
257
- {
258
- title: "Start Onboarding Workflow",
259
- type: "webhook",
260
- url: "https://hooks.example.com/activitysmith/onboarding/start",
261
- method: "POST",
262
- body: {
263
- customer_id: "cus_9f3a1d",
264
- plan: "pro",
265
- },
266
- },
267
- ], // Optional (max 4)
317
+ channels: ["sales", "customer-success"], // Optional
268
318
  });
269
319
  ```
270
320
 
@@ -396,6 +396,55 @@ export interface ForbiddenError {
396
396
  */
397
397
  message: string;
398
398
  }
399
+ /**
400
+ * Optional single action button shown in the Live Activity UI.
401
+ * @export
402
+ * @interface LiveActivityAction
403
+ */
404
+ export interface LiveActivityAction {
405
+ [key: string]: any | any;
406
+ /**
407
+ * Button title displayed in the Live Activity UI.
408
+ * @type {string}
409
+ * @memberof LiveActivityAction
410
+ */
411
+ title: string;
412
+ /**
413
+ *
414
+ * @type {LiveActivityActionType}
415
+ * @memberof LiveActivityAction
416
+ */
417
+ type: LiveActivityActionType;
418
+ /**
419
+ * HTTPS URL. For open_url it is opened in browser. For webhook it is called by ActivitySmith backend.
420
+ * @type {string}
421
+ * @memberof LiveActivityAction
422
+ */
423
+ url: string;
424
+ /**
425
+ * Webhook HTTP method. Used only when type=webhook.
426
+ * @type {LiveActivityWebhookMethod}
427
+ * @memberof LiveActivityAction
428
+ */
429
+ method?: LiveActivityWebhookMethod;
430
+ /**
431
+ * Optional webhook payload body. Used only when type=webhook.
432
+ * @type {{ [key: string]: any; }}
433
+ * @memberof LiveActivityAction
434
+ */
435
+ body?: {
436
+ [key: string]: any;
437
+ };
438
+ }
439
+ /**
440
+ *
441
+ * @export
442
+ */
443
+ export declare const LiveActivityActionType: {
444
+ readonly OpenUrl: "open_url";
445
+ readonly Webhook: "webhook";
446
+ };
447
+ export type LiveActivityActionType = typeof LiveActivityActionType[keyof typeof LiveActivityActionType];
399
448
  /**
400
449
  * End an existing Live Activity by activity_id.
401
450
  * @export
@@ -415,6 +464,12 @@ export interface LiveActivityEndRequest {
415
464
  * @memberof LiveActivityEndRequest
416
465
  */
417
466
  content_state: ContentStateEnd;
467
+ /**
468
+ *
469
+ * @type {LiveActivityAction}
470
+ * @memberof LiveActivityEndRequest
471
+ */
472
+ action?: LiveActivityAction;
418
473
  }
419
474
  /**
420
475
  * Returned after a Live Activity end event is sent or queued.
@@ -499,6 +554,12 @@ export interface LiveActivityStartRequest {
499
554
  * @memberof LiveActivityStartRequest
500
555
  */
501
556
  content_state: ContentStateStart;
557
+ /**
558
+ *
559
+ * @type {LiveActivityAction}
560
+ * @memberof LiveActivityStartRequest
561
+ */
562
+ action?: LiveActivityAction;
502
563
  /**
503
564
  *
504
565
  * @type {AlertPayload}
@@ -575,6 +636,12 @@ export interface LiveActivityUpdateRequest {
575
636
  * @memberof LiveActivityUpdateRequest
576
637
  */
577
638
  content_state: ContentStateUpdate;
639
+ /**
640
+ *
641
+ * @type {LiveActivityAction}
642
+ * @memberof LiveActivityUpdateRequest
643
+ */
644
+ action?: LiveActivityAction;
578
645
  }
579
646
  /**
580
647
  * Returned after a Live Activity update is sent or queued.
@@ -614,6 +681,15 @@ export interface LiveActivityUpdateResponse {
614
681
  */
615
682
  timestamp: string;
616
683
  }
684
+ /**
685
+ *
686
+ * @export
687
+ */
688
+ export declare const LiveActivityWebhookMethod: {
689
+ readonly Get: "GET";
690
+ readonly Post: "POST";
691
+ };
692
+ export type LiveActivityWebhookMethod = typeof LiveActivityWebhookMethod[keyof typeof LiveActivityWebhookMethod];
617
693
  /**
618
694
  *
619
695
  * @export
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PushNotificationWebhookMethod = exports.PushNotificationActionType = exports.ContentStateUpdateStepColorEnum = exports.ContentStateUpdateColorEnum = exports.ContentStateUpdateTypeEnum = exports.ContentStateStartStepColorEnum = exports.ContentStateStartColorEnum = exports.ContentStateStartTypeEnum = exports.ContentStateEndStepColorEnum = exports.ContentStateEndColorEnum = exports.ContentStateEndTypeEnum = void 0;
3
+ exports.PushNotificationWebhookMethod = exports.PushNotificationActionType = exports.LiveActivityWebhookMethod = exports.LiveActivityActionType = exports.ContentStateUpdateStepColorEnum = exports.ContentStateUpdateColorEnum = exports.ContentStateUpdateTypeEnum = exports.ContentStateStartStepColorEnum = exports.ContentStateStartColorEnum = exports.ContentStateStartTypeEnum = exports.ContentStateEndStepColorEnum = exports.ContentStateEndColorEnum = exports.ContentStateEndTypeEnum = void 0;
4
4
  /**
5
5
  * @export
6
6
  */
@@ -106,6 +106,22 @@ exports.ContentStateUpdateStepColorEnum = {
106
106
  Orange: 'orange',
107
107
  Yellow: 'yellow'
108
108
  };
109
+ /**
110
+ *
111
+ * @export
112
+ */
113
+ exports.LiveActivityActionType = {
114
+ OpenUrl: 'open_url',
115
+ Webhook: 'webhook'
116
+ };
117
+ /**
118
+ *
119
+ * @export
120
+ */
121
+ exports.LiveActivityWebhookMethod = {
122
+ Get: 'GET',
123
+ Post: 'POST'
124
+ };
109
125
  /**
110
126
  *
111
127
  * @export
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "activitysmith",
3
- "version": "0.1.8",
3
+ "version": "1.0.0",
4
4
  "description": "Official ActivitySmith Node.js SDK",
5
5
  "keywords": [
6
6
  "activitysmith",