@sendly/node 3.26.0 → 3.27.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/dist/index.d.mts CHANGED
@@ -267,6 +267,65 @@ interface SuggestRepliesResponse {
267
267
  basedOnMessageId?: string;
268
268
  model?: string;
269
269
  }
270
+ interface ConversationContext {
271
+ context: string;
272
+ conversation: {
273
+ id: string;
274
+ phoneNumber: string;
275
+ status: string;
276
+ messageCount: number;
277
+ unreadCount: number;
278
+ };
279
+ tokenEstimate: number;
280
+ business?: {
281
+ name: string;
282
+ useCase?: string;
283
+ };
284
+ }
285
+ interface AutoLabelRule {
286
+ id: string;
287
+ name: string;
288
+ conditions: {
289
+ intent?: string | string[];
290
+ sentiment?: string | string[];
291
+ intentConfidenceMin?: number;
292
+ sentimentConfidenceMin?: number;
293
+ };
294
+ actions: {
295
+ addLabels: string[];
296
+ closeConversation?: boolean;
297
+ };
298
+ enabled: boolean;
299
+ priority: number;
300
+ createdAt: string;
301
+ updatedAt: string;
302
+ }
303
+ interface AutoLabelRuleListResponse {
304
+ data: AutoLabelRule[];
305
+ }
306
+ interface CreateAutoLabelRuleRequest {
307
+ name: string;
308
+ conditions: AutoLabelRule["conditions"];
309
+ actions: AutoLabelRule["actions"];
310
+ priority?: number;
311
+ }
312
+ interface UpdateAutoLabelRuleRequest {
313
+ name?: string;
314
+ conditions?: AutoLabelRule["conditions"];
315
+ actions?: AutoLabelRule["actions"];
316
+ enabled?: boolean;
317
+ priority?: number;
318
+ }
319
+ interface GenerateTemplateRequest {
320
+ description: string;
321
+ category?: string;
322
+ }
323
+ interface GeneratedTemplate {
324
+ name: string;
325
+ text: string;
326
+ variables: string[];
327
+ category: string;
328
+ }
270
329
  interface Label {
271
330
  id: string;
272
331
  name: string;
@@ -549,21 +608,29 @@ interface BatchMessageRequest {
549
608
  */
550
609
  interface BatchMessageResult {
551
610
  /**
552
- * Message ID (if successful)
611
+ * Message ID
553
612
  */
554
- id?: string;
613
+ id: string;
555
614
  /**
556
615
  * Destination phone number
557
616
  */
558
617
  to: string;
559
618
  /**
560
- * Status of this message
619
+ * Current message status
561
620
  */
562
- status: "queued" | "failed";
621
+ status: string;
563
622
  /**
564
623
  * Error message (if failed)
565
624
  */
566
- error?: string;
625
+ error?: string | null;
626
+ /**
627
+ * When the message was created
628
+ */
629
+ createdAt?: string;
630
+ /**
631
+ * When the message was delivered (if applicable)
632
+ */
633
+ deliveredAt?: string | null;
567
634
  }
568
635
  /**
569
636
  * Batch status values
@@ -3089,6 +3156,7 @@ declare class TemplatesResource {
3089
3156
  name?: string;
3090
3157
  }): Promise<Template>;
3091
3158
  private transformTemplate;
3159
+ generate(request: GenerateTemplateRequest): Promise<GeneratedTemplate>;
3092
3160
  }
3093
3161
 
3094
3162
  /**
@@ -3713,6 +3781,9 @@ declare class ConversationsResource {
3713
3781
  markRead(id: string): Promise<Conversation>;
3714
3782
  close(id: string): Promise<Conversation>;
3715
3783
  reopen(id: string): Promise<Conversation>;
3784
+ getContext(conversationId: string, options?: {
3785
+ maxMessages?: number;
3786
+ }): Promise<ConversationContext>;
3716
3787
  suggestReplies(conversationId: string): Promise<SuggestRepliesResponse>;
3717
3788
  addLabels(conversationId: string, labelIds: string[]): Promise<LabelListResponse>;
3718
3789
  removeLabel(conversationId: string, labelId: string): Promise<void>;
@@ -3737,6 +3808,15 @@ declare class DraftsResource {
3737
3808
  reject(id: string, reason?: string): Promise<MessageDraft>;
3738
3809
  }
3739
3810
 
3811
+ declare class RulesResource {
3812
+ private readonly http;
3813
+ constructor(http: HttpClient);
3814
+ list(): Promise<AutoLabelRuleListResponse>;
3815
+ create(request: CreateAutoLabelRuleRequest): Promise<AutoLabelRule>;
3816
+ update(id: string, request: UpdateAutoLabelRuleRequest): Promise<AutoLabelRule>;
3817
+ delete(id: string): Promise<void>;
3818
+ }
3819
+
3740
3820
  /**
3741
3821
  * Sendly Client
3742
3822
  * @packageDocumentation
@@ -3793,6 +3873,7 @@ declare class Sendly {
3793
3873
  readonly conversations: ConversationsResource;
3794
3874
  readonly labels: LabelsResource;
3795
3875
  readonly drafts: DraftsResource;
3876
+ readonly rules: RulesResource;
3796
3877
  /**
3797
3878
  * Webhooks API resource
3798
3879
  *
package/dist/index.d.ts CHANGED
@@ -267,6 +267,65 @@ interface SuggestRepliesResponse {
267
267
  basedOnMessageId?: string;
268
268
  model?: string;
269
269
  }
270
+ interface ConversationContext {
271
+ context: string;
272
+ conversation: {
273
+ id: string;
274
+ phoneNumber: string;
275
+ status: string;
276
+ messageCount: number;
277
+ unreadCount: number;
278
+ };
279
+ tokenEstimate: number;
280
+ business?: {
281
+ name: string;
282
+ useCase?: string;
283
+ };
284
+ }
285
+ interface AutoLabelRule {
286
+ id: string;
287
+ name: string;
288
+ conditions: {
289
+ intent?: string | string[];
290
+ sentiment?: string | string[];
291
+ intentConfidenceMin?: number;
292
+ sentimentConfidenceMin?: number;
293
+ };
294
+ actions: {
295
+ addLabels: string[];
296
+ closeConversation?: boolean;
297
+ };
298
+ enabled: boolean;
299
+ priority: number;
300
+ createdAt: string;
301
+ updatedAt: string;
302
+ }
303
+ interface AutoLabelRuleListResponse {
304
+ data: AutoLabelRule[];
305
+ }
306
+ interface CreateAutoLabelRuleRequest {
307
+ name: string;
308
+ conditions: AutoLabelRule["conditions"];
309
+ actions: AutoLabelRule["actions"];
310
+ priority?: number;
311
+ }
312
+ interface UpdateAutoLabelRuleRequest {
313
+ name?: string;
314
+ conditions?: AutoLabelRule["conditions"];
315
+ actions?: AutoLabelRule["actions"];
316
+ enabled?: boolean;
317
+ priority?: number;
318
+ }
319
+ interface GenerateTemplateRequest {
320
+ description: string;
321
+ category?: string;
322
+ }
323
+ interface GeneratedTemplate {
324
+ name: string;
325
+ text: string;
326
+ variables: string[];
327
+ category: string;
328
+ }
270
329
  interface Label {
271
330
  id: string;
272
331
  name: string;
@@ -549,21 +608,29 @@ interface BatchMessageRequest {
549
608
  */
550
609
  interface BatchMessageResult {
551
610
  /**
552
- * Message ID (if successful)
611
+ * Message ID
553
612
  */
554
- id?: string;
613
+ id: string;
555
614
  /**
556
615
  * Destination phone number
557
616
  */
558
617
  to: string;
559
618
  /**
560
- * Status of this message
619
+ * Current message status
561
620
  */
562
- status: "queued" | "failed";
621
+ status: string;
563
622
  /**
564
623
  * Error message (if failed)
565
624
  */
566
- error?: string;
625
+ error?: string | null;
626
+ /**
627
+ * When the message was created
628
+ */
629
+ createdAt?: string;
630
+ /**
631
+ * When the message was delivered (if applicable)
632
+ */
633
+ deliveredAt?: string | null;
567
634
  }
568
635
  /**
569
636
  * Batch status values
@@ -3089,6 +3156,7 @@ declare class TemplatesResource {
3089
3156
  name?: string;
3090
3157
  }): Promise<Template>;
3091
3158
  private transformTemplate;
3159
+ generate(request: GenerateTemplateRequest): Promise<GeneratedTemplate>;
3092
3160
  }
3093
3161
 
3094
3162
  /**
@@ -3713,6 +3781,9 @@ declare class ConversationsResource {
3713
3781
  markRead(id: string): Promise<Conversation>;
3714
3782
  close(id: string): Promise<Conversation>;
3715
3783
  reopen(id: string): Promise<Conversation>;
3784
+ getContext(conversationId: string, options?: {
3785
+ maxMessages?: number;
3786
+ }): Promise<ConversationContext>;
3716
3787
  suggestReplies(conversationId: string): Promise<SuggestRepliesResponse>;
3717
3788
  addLabels(conversationId: string, labelIds: string[]): Promise<LabelListResponse>;
3718
3789
  removeLabel(conversationId: string, labelId: string): Promise<void>;
@@ -3737,6 +3808,15 @@ declare class DraftsResource {
3737
3808
  reject(id: string, reason?: string): Promise<MessageDraft>;
3738
3809
  }
3739
3810
 
3811
+ declare class RulesResource {
3812
+ private readonly http;
3813
+ constructor(http: HttpClient);
3814
+ list(): Promise<AutoLabelRuleListResponse>;
3815
+ create(request: CreateAutoLabelRuleRequest): Promise<AutoLabelRule>;
3816
+ update(id: string, request: UpdateAutoLabelRuleRequest): Promise<AutoLabelRule>;
3817
+ delete(id: string): Promise<void>;
3818
+ }
3819
+
3740
3820
  /**
3741
3821
  * Sendly Client
3742
3822
  * @packageDocumentation
@@ -3793,6 +3873,7 @@ declare class Sendly {
3793
3873
  readonly conversations: ConversationsResource;
3794
3874
  readonly labels: LabelsResource;
3795
3875
  readonly drafts: DraftsResource;
3876
+ readonly rules: RulesResource;
3796
3877
  /**
3797
3878
  * Webhooks API resource
3798
3879
  *
package/dist/index.js CHANGED
@@ -2162,6 +2162,13 @@ var TemplatesResource = class {
2162
2162
  updatedAt: t.updated_at
2163
2163
  };
2164
2164
  }
2165
+ async generate(request) {
2166
+ return this.http.request({
2167
+ method: "POST",
2168
+ path: "/templates/generate",
2169
+ body: { ...request }
2170
+ });
2171
+ }
2165
2172
  };
2166
2173
 
2167
2174
  // src/resources/campaigns.ts
@@ -3443,6 +3450,15 @@ var ConversationsResource = class {
3443
3450
  path: `/conversations/${id}/reopen`
3444
3451
  });
3445
3452
  }
3453
+ async getContext(conversationId, options) {
3454
+ const params = new URLSearchParams();
3455
+ if (options?.maxMessages) params.set("max_messages", String(options.maxMessages));
3456
+ const qs = params.toString();
3457
+ return this.http.request({
3458
+ method: "GET",
3459
+ path: `/conversations/${conversationId}/context${qs ? `?${qs}` : ""}`
3460
+ });
3461
+ }
3446
3462
  async suggestReplies(conversationId) {
3447
3463
  return this.http.request({
3448
3464
  method: "POST",
@@ -3544,6 +3560,40 @@ var DraftsResource = class {
3544
3560
  }
3545
3561
  };
3546
3562
 
3563
+ // src/resources/rules.ts
3564
+ var RulesResource = class {
3565
+ http;
3566
+ constructor(http) {
3567
+ this.http = http;
3568
+ }
3569
+ async list() {
3570
+ return this.http.request({
3571
+ method: "GET",
3572
+ path: "/rules"
3573
+ });
3574
+ }
3575
+ async create(request) {
3576
+ return this.http.request({
3577
+ method: "POST",
3578
+ path: "/rules",
3579
+ body: { ...request }
3580
+ });
3581
+ }
3582
+ async update(id, request) {
3583
+ return this.http.request({
3584
+ method: "PATCH",
3585
+ path: `/rules/${id}`,
3586
+ body: { ...request }
3587
+ });
3588
+ }
3589
+ async delete(id) {
3590
+ await this.http.request({
3591
+ method: "DELETE",
3592
+ path: `/rules/${id}`
3593
+ });
3594
+ }
3595
+ };
3596
+
3547
3597
  // src/client.ts
3548
3598
  var DEFAULT_BASE_URL2 = "https://sendly.live/api/v1";
3549
3599
  var DEFAULT_TIMEOUT2 = 3e4;
@@ -3568,6 +3618,7 @@ var Sendly = class {
3568
3618
  conversations;
3569
3619
  labels;
3570
3620
  drafts;
3621
+ rules;
3571
3622
  /**
3572
3623
  * Webhooks API resource
3573
3624
  *
@@ -3755,6 +3806,7 @@ var Sendly = class {
3755
3806
  this.conversations = new ConversationsResource(this.http);
3756
3807
  this.labels = new LabelsResource(this.http);
3757
3808
  this.drafts = new DraftsResource(this.http);
3809
+ this.rules = new RulesResource(this.http);
3758
3810
  this.webhooks = new WebhooksResource(this.http);
3759
3811
  this.account = new AccountResource(this.http);
3760
3812
  this.verify = new VerifyResource(this.http);
package/dist/index.mjs CHANGED
@@ -2102,6 +2102,13 @@ var TemplatesResource = class {
2102
2102
  updatedAt: t.updated_at
2103
2103
  };
2104
2104
  }
2105
+ async generate(request) {
2106
+ return this.http.request({
2107
+ method: "POST",
2108
+ path: "/templates/generate",
2109
+ body: { ...request }
2110
+ });
2111
+ }
2105
2112
  };
2106
2113
 
2107
2114
  // src/resources/campaigns.ts
@@ -3383,6 +3390,15 @@ var ConversationsResource = class {
3383
3390
  path: `/conversations/${id}/reopen`
3384
3391
  });
3385
3392
  }
3393
+ async getContext(conversationId, options) {
3394
+ const params = new URLSearchParams();
3395
+ if (options?.maxMessages) params.set("max_messages", String(options.maxMessages));
3396
+ const qs = params.toString();
3397
+ return this.http.request({
3398
+ method: "GET",
3399
+ path: `/conversations/${conversationId}/context${qs ? `?${qs}` : ""}`
3400
+ });
3401
+ }
3386
3402
  async suggestReplies(conversationId) {
3387
3403
  return this.http.request({
3388
3404
  method: "POST",
@@ -3484,6 +3500,40 @@ var DraftsResource = class {
3484
3500
  }
3485
3501
  };
3486
3502
 
3503
+ // src/resources/rules.ts
3504
+ var RulesResource = class {
3505
+ http;
3506
+ constructor(http) {
3507
+ this.http = http;
3508
+ }
3509
+ async list() {
3510
+ return this.http.request({
3511
+ method: "GET",
3512
+ path: "/rules"
3513
+ });
3514
+ }
3515
+ async create(request) {
3516
+ return this.http.request({
3517
+ method: "POST",
3518
+ path: "/rules",
3519
+ body: { ...request }
3520
+ });
3521
+ }
3522
+ async update(id, request) {
3523
+ return this.http.request({
3524
+ method: "PATCH",
3525
+ path: `/rules/${id}`,
3526
+ body: { ...request }
3527
+ });
3528
+ }
3529
+ async delete(id) {
3530
+ await this.http.request({
3531
+ method: "DELETE",
3532
+ path: `/rules/${id}`
3533
+ });
3534
+ }
3535
+ };
3536
+
3487
3537
  // src/client.ts
3488
3538
  var DEFAULT_BASE_URL2 = "https://sendly.live/api/v1";
3489
3539
  var DEFAULT_TIMEOUT2 = 3e4;
@@ -3508,6 +3558,7 @@ var Sendly = class {
3508
3558
  conversations;
3509
3559
  labels;
3510
3560
  drafts;
3561
+ rules;
3511
3562
  /**
3512
3563
  * Webhooks API resource
3513
3564
  *
@@ -3695,6 +3746,7 @@ var Sendly = class {
3695
3746
  this.conversations = new ConversationsResource(this.http);
3696
3747
  this.labels = new LabelsResource(this.http);
3697
3748
  this.drafts = new DraftsResource(this.http);
3749
+ this.rules = new RulesResource(this.http);
3698
3750
  this.webhooks = new WebhooksResource(this.http);
3699
3751
  this.account = new AccountResource(this.http);
3700
3752
  this.verify = new VerifyResource(this.http);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sendly/node",
3
- "version": "3.26.0",
3
+ "version": "3.27.1",
4
4
  "description": "Official Sendly Node.js SDK for SMS messaging",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -27,10 +27,20 @@
27
27
  "keywords": [
28
28
  "sendly",
29
29
  "sms",
30
+ "sms-api",
30
31
  "messaging",
31
- "api",
32
- "text",
33
- "notifications"
32
+ "text-message",
33
+ "notifications",
34
+ "otp",
35
+ "phone-verification",
36
+ "bulk-sms",
37
+ "sms-gateway",
38
+ "twilio-alternative",
39
+ "mms",
40
+ "campaigns",
41
+ "webhooks",
42
+ "typescript",
43
+ "nodejs"
34
44
  ],
35
45
  "author": "Sendly <support@sendly.live>",
36
46
  "license": "MIT",