activitysmith 0.1.5 → 0.1.6

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.
Files changed (2) hide show
  1. package/README.md +42 -25
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -44,26 +44,6 @@ const activitysmith = new ActivitySmith({
44
44
  const response = await activitysmith.notifications.send({
45
45
  title: "New subscription 💸",
46
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
67
47
  });
68
48
 
69
49
  console.log(response.success);
@@ -131,6 +111,48 @@ const end = await activitysmith.liveActivities.end({
131
111
  console.log(end.success);
132
112
  ```
133
113
 
114
+ ## Channels
115
+
116
+ Channels are used to target specific team members or devices. Can be used for both push notifications and live activities.
117
+
118
+ ```ts
119
+ const response = await activitysmith.notifications.send({
120
+ title: "New subscription 💸",
121
+ message: "Customer upgraded to Pro plan",
122
+ channels: ["sales", "customer-success"], // Optional
123
+ });
124
+ ```
125
+
126
+ ## Push Notification Redirection and Actions
127
+
128
+ 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.
129
+ Webhooks are executed by ActivitySmith backend.
130
+
131
+ ```ts
132
+ const response = await activitysmith.notifications.send({
133
+ title: "New subscription 💸",
134
+ message: "Customer upgraded to Pro plan",
135
+ redirection: "https://crm.example.com/customers/cus_9f3a1d", // Optional
136
+ actions: [
137
+ {
138
+ title: "Open CRM Profile",
139
+ type: "open_url",
140
+ url: "https://crm.example.com/customers/cus_9f3a1d",
141
+ },
142
+ {
143
+ title: "Start Onboarding Workflow",
144
+ type: "webhook",
145
+ url: "https://hooks.example.com/activitysmith/onboarding/start",
146
+ method: "POST",
147
+ body: {
148
+ customer_id: "cus_9f3a1d",
149
+ plan: "pro",
150
+ },
151
+ },
152
+ ], // Optional (max 4)
153
+ });
154
+ ```
155
+
134
156
  ## Error Handling
135
157
 
136
158
  ```ts
@@ -143,11 +165,6 @@ try {
143
165
  }
144
166
  ```
145
167
 
146
- ## API Surface
147
-
148
- - `activitysmith.notifications`
149
- - `activitysmith.liveActivities`
150
-
151
168
  ## TypeScript Support
152
169
 
153
170
  This package is written in TypeScript and ships with type definitions out of the box.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "activitysmith",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Official ActivitySmith Node.js SDK",
5
5
  "keywords": [
6
6
  "activitysmith",