activitysmith 0.1.3 → 0.1.5

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
@@ -36,11 +36,34 @@ const activitysmith = new ActivitySmith({
36
36
 
37
37
  ### Send a Push Notification
38
38
 
39
+ <p align="center">
40
+ <img src="https://cdn.activitysmith.com/features/new-subscription-push-notification.png" alt="Push notification example" width="680" />
41
+ </p>
42
+
39
43
  ```ts
40
44
  const response = await activitysmith.notifications.send({
41
- title: "Build Failed",
42
- message: "CI pipeline failed on main branch",
43
- channels: ["devs", "ops"], // Optional
45
+ title: "New subscription 💸",
46
+ message: "Customer upgraded to Pro plan",
47
+ redirection:
48
+ "https://crm.example.com/customers/cus_9f3a1d", // Optional
49
+ actions: [
50
+ {
51
+ title: "Open CRM Profile",
52
+ type: "open_url",
53
+ url: "https://crm.example.com/customers/cus_9f3a1d",
54
+ },
55
+ {
56
+ title: "Start Onboarding Workflow",
57
+ type: "webhook",
58
+ url: "https://hooks.example.com/activitysmith/onboarding/start",
59
+ method: "POST",
60
+ body: {
61
+ customer_id: "cus_9f3a1d",
62
+ plan: "pro",
63
+ },
64
+ },
65
+ ], // Optional (max 4)
66
+ channels: ["sales", "customer-success"], // Optional
44
67
  });
45
68
 
46
69
  console.log(response.success);
@@ -49,12 +72,16 @@ console.log(response.devices_notified);
49
72
 
50
73
  ### Start a Live Activity
51
74
 
75
+ <p align="center">
76
+ <img src="https://cdn.activitysmith.com/features/start-live-activity.png" alt="Start live activity example" width="680" />
77
+ </p>
78
+
52
79
  ```ts
53
80
  const start = await activitysmith.liveActivities.start({
54
81
  content_state: {
55
- title: "ActivitySmith API Deployment",
56
- subtitle: "start",
57
- number_of_steps: 4,
82
+ title: "Nightly database backup",
83
+ subtitle: "create snapshot",
84
+ number_of_steps: 3,
58
85
  current_step: 1,
59
86
  type: "segmented_progress",
60
87
  color: "yellow",
@@ -67,13 +94,17 @@ const activityId = start.activity_id;
67
94
 
68
95
  ### Update a Live Activity
69
96
 
97
+ <p align="center">
98
+ <img src="https://cdn.activitysmith.com/features/update-live-activity.png" alt="Update live activity example" width="680" />
99
+ </p>
100
+
70
101
  ```ts
71
102
  const update = await activitysmith.liveActivities.update({
72
103
  activity_id: activityId,
73
104
  content_state: {
74
- title: "ActivitySmith API Deployment",
75
- subtitle: "npm i & pm2",
76
- current_step: 3,
105
+ title: "Nightly database backup",
106
+ subtitle: "upload archive",
107
+ current_step: 2,
77
108
  },
78
109
  });
79
110
 
@@ -82,14 +113,18 @@ console.log(update.devices_notified);
82
113
 
83
114
  ### End a Live Activity
84
115
 
116
+ <p align="center">
117
+ <img src="https://cdn.activitysmith.com/features/end-live-activity.png" alt="End live activity example" width="680" />
118
+ </p>
119
+
85
120
  ```ts
86
121
  const end = await activitysmith.liveActivities.end({
87
122
  activity_id: activityId,
88
123
  content_state: {
89
- title: "ActivitySmith API Deployment",
90
- subtitle: "done",
91
- current_step: 4,
92
- auto_dismiss_minutes: 3,
124
+ title: "Nightly database backup",
125
+ subtitle: "verify restore",
126
+ current_step: 3,
127
+ auto_dismiss_minutes: 2,
93
128
  },
94
129
  });
95
130
 
@@ -101,7 +136,7 @@ console.log(end.success);
101
136
  ```ts
102
137
  try {
103
138
  await activitysmith.notifications.send({
104
- title: "Build Failed",
139
+ title: "New subscription 💸",
105
140
  });
106
141
  } catch (error) {
107
142
  console.error(error);
@@ -19,12 +19,12 @@ export interface SendPushNotificationRequest {
19
19
  */
20
20
  export declare class PushNotificationsApi extends runtime.BaseAPI {
21
21
  /**
22
- * Sends a push notification to devices matched by API key scope and optional target channels.
22
+ * Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL (tap) and up to 4 interactive actions (long-press on iOS).
23
23
  * Send a push notification
24
24
  */
25
25
  sendPushNotificationRaw(requestParameters: SendPushNotificationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PushNotificationResponse>>;
26
26
  /**
27
- * Sends a push notification to devices matched by API key scope and optional target channels.
27
+ * Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL (tap) and up to 4 interactive actions (long-press on iOS).
28
28
  * Send a push notification
29
29
  */
30
30
  sendPushNotification(requestParameters: SendPushNotificationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PushNotificationResponse>;
@@ -20,7 +20,7 @@ const runtime = require("../runtime");
20
20
  */
21
21
  class PushNotificationsApi extends runtime.BaseAPI {
22
22
  /**
23
- * Sends a push notification to devices matched by API key scope and optional target channels.
23
+ * Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL (tap) and up to 4 interactive actions (long-press on iOS).
24
24
  * Send a push notification
25
25
  */
26
26
  async sendPushNotificationRaw(requestParameters, initOverrides) {
@@ -47,7 +47,7 @@ class PushNotificationsApi extends runtime.BaseAPI {
47
47
  return new runtime.JSONApiResponse(response);
48
48
  }
49
49
  /**
50
- * Sends a push notification to devices matched by API key scope and optional target channels.
50
+ * Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL (tap) and up to 4 interactive actions (long-press on iOS).
51
51
  * Send a push notification
52
52
  */
53
53
  async sendPushNotification(requestParameters, initOverrides) {
@@ -557,6 +557,55 @@ export interface NoRecipientsError {
557
557
  */
558
558
  effective_channel_slugs?: Array<string>;
559
559
  }
560
+ /**
561
+ *
562
+ * @export
563
+ * @interface PushNotificationAction
564
+ */
565
+ export interface PushNotificationAction {
566
+ [key: string]: any | any;
567
+ /**
568
+ * Button title displayed in iOS expanded notification UI.
569
+ * @type {string}
570
+ * @memberof PushNotificationAction
571
+ */
572
+ title: string;
573
+ /**
574
+ *
575
+ * @type {PushNotificationActionType}
576
+ * @memberof PushNotificationAction
577
+ */
578
+ type: PushNotificationActionType;
579
+ /**
580
+ * HTTPS URL. For open_url it is opened in browser. For webhook it is called by ActivitySmith backend.
581
+ * @type {string}
582
+ * @memberof PushNotificationAction
583
+ */
584
+ url: string;
585
+ /**
586
+ * Webhook HTTP method. Used only when type=webhook.
587
+ * @type {PushNotificationWebhookMethod}
588
+ * @memberof PushNotificationAction
589
+ */
590
+ method?: PushNotificationWebhookMethod;
591
+ /**
592
+ * Optional webhook payload body. Used only when type=webhook.
593
+ * @type {{ [key: string]: any; }}
594
+ * @memberof PushNotificationAction
595
+ */
596
+ body?: {
597
+ [key: string]: any;
598
+ };
599
+ }
600
+ /**
601
+ *
602
+ * @export
603
+ */
604
+ export declare const PushNotificationActionType: {
605
+ readonly OpenUrl: "open_url";
606
+ readonly Webhook: "webhook";
607
+ };
608
+ export type PushNotificationActionType = typeof PushNotificationActionType[keyof typeof PushNotificationActionType];
560
609
  /**
561
610
  *
562
611
  * @export
@@ -582,6 +631,18 @@ export interface PushNotificationRequest {
582
631
  * @memberof PushNotificationRequest
583
632
  */
584
633
  subtitle?: string;
634
+ /**
635
+ * Optional HTTPS URL opened when user taps the notification body.
636
+ * @type {string}
637
+ * @memberof PushNotificationRequest
638
+ */
639
+ redirection?: string;
640
+ /**
641
+ * Optional interactive actions shown on iOS long-press.
642
+ * @type {Array<PushNotificationAction>}
643
+ * @memberof PushNotificationRequest
644
+ */
645
+ actions?: Array<PushNotificationAction>;
585
646
  /**
586
647
  *
587
648
  * @type {{ [key: string]: any; }}
@@ -647,6 +708,15 @@ export interface PushNotificationResponse {
647
708
  */
648
709
  timestamp: string;
649
710
  }
711
+ /**
712
+ *
713
+ * @export
714
+ */
715
+ export declare const PushNotificationWebhookMethod: {
716
+ readonly Get: "GET";
717
+ readonly Post: "POST";
718
+ };
719
+ export type PushNotificationWebhookMethod = typeof PushNotificationWebhookMethod[keyof typeof PushNotificationWebhookMethod];
650
720
  /**
651
721
  *
652
722
  * @export
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ContentStateUpdateStepColorEnum = exports.ContentStateUpdateColorEnum = exports.ContentStateStartStepColorEnum = exports.ContentStateStartColorEnum = exports.ContentStateStartTypeEnum = exports.ContentStateEndStepColorEnum = exports.ContentStateEndColorEnum = void 0;
3
+ exports.PushNotificationWebhookMethod = exports.PushNotificationActionType = exports.ContentStateUpdateStepColorEnum = exports.ContentStateUpdateColorEnum = exports.ContentStateStartStepColorEnum = exports.ContentStateStartColorEnum = exports.ContentStateStartTypeEnum = exports.ContentStateEndStepColorEnum = exports.ContentStateEndColorEnum = void 0;
4
4
  /**
5
5
  * @export
6
6
  */
@@ -91,3 +91,19 @@ exports.ContentStateUpdateStepColorEnum = {
91
91
  Orange: 'orange',
92
92
  Yellow: 'yellow'
93
93
  };
94
+ /**
95
+ *
96
+ * @export
97
+ */
98
+ exports.PushNotificationActionType = {
99
+ OpenUrl: 'open_url',
100
+ Webhook: 'webhook'
101
+ };
102
+ /**
103
+ *
104
+ * @export
105
+ */
106
+ exports.PushNotificationWebhookMethod = {
107
+ Get: 'GET',
108
+ Post: 'POST'
109
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "activitysmith",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Official ActivitySmith Node.js SDK",
5
5
  "keywords": [
6
6
  "activitysmith",