@sendly/node 3.13.0 → 3.13.2

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
@@ -54,6 +54,11 @@ interface SendMessageRequest {
54
54
  * - "transactional": OTPs, confirmations, alerts - bypasses quiet hours (24/7)
55
55
  */
56
56
  messageType?: MessageType;
57
+ /**
58
+ * Custom JSON metadata to attach to the message (max 4KB).
59
+ * Stored on the message record and included in webhook event payloads.
60
+ */
61
+ metadata?: Record<string, any>;
57
62
  }
58
63
  /**
59
64
  * Message status values
@@ -135,6 +140,10 @@ interface Message {
135
140
  * ISO 8601 timestamp when the message was delivered (if applicable)
136
141
  */
137
142
  deliveredAt?: string | null;
143
+ /**
144
+ * Custom JSON metadata attached to the message
145
+ */
146
+ metadata?: Record<string, any>;
138
147
  }
139
148
  /**
140
149
  * Options for listing messages
@@ -195,6 +204,11 @@ interface ScheduleMessageRequest {
195
204
  * - "transactional": OTPs, confirmations, alerts - bypasses quiet hours (24/7)
196
205
  */
197
206
  messageType?: MessageType;
207
+ /**
208
+ * Custom JSON metadata to attach to the message (max 4KB).
209
+ * Stored on the message record and included in webhook event payloads.
210
+ */
211
+ metadata?: Record<string, any>;
198
212
  }
199
213
  /**
200
214
  * Scheduled message status values
@@ -334,6 +348,11 @@ interface BatchMessageRequest {
334
348
  * - "transactional": OTPs, confirmations, alerts - bypasses quiet hours (24/7)
335
349
  */
336
350
  messageType?: MessageType;
351
+ /**
352
+ * Custom JSON metadata to attach to all messages in the batch (max 4KB).
353
+ * Stored on each message record and included in webhook event payloads.
354
+ */
355
+ metadata?: Record<string, any>;
337
356
  }
338
357
  /**
339
358
  * Result for a single message in a batch
@@ -1178,6 +1197,26 @@ interface CampaignPreview {
1178
1197
  creditsPerMessage: number;
1179
1198
  totalCredits: number;
1180
1199
  }>;
1200
+ /** Number of recipients blocked due to destination restrictions */
1201
+ blockedCount?: number;
1202
+ /** Number of recipients that can be reached */
1203
+ sendableCount?: number;
1204
+ /** Per-country breakdown with access info */
1205
+ byCountry?: Record<string, {
1206
+ count: number;
1207
+ credits: number;
1208
+ allowed: boolean;
1209
+ blockedReason?: string;
1210
+ }>;
1211
+ /** Validation warnings */
1212
+ warnings?: string[];
1213
+ /** User's messaging profile access info */
1214
+ messagingProfile?: {
1215
+ canSendDomestic: boolean;
1216
+ canSendInternational: boolean;
1217
+ verificationType: string | null;
1218
+ verificationStatus: string | null;
1219
+ };
1181
1220
  }
1182
1221
  /**
1183
1222
  * Options for listing campaigns
@@ -1389,6 +1428,28 @@ interface UpdateContactListRequest {
1389
1428
  interface ContactListsResponse {
1390
1429
  lists: ContactList[];
1391
1430
  }
1431
+ interface ImportContactItem {
1432
+ phone: string;
1433
+ name?: string;
1434
+ email?: string;
1435
+ optedInAt?: string;
1436
+ }
1437
+ interface ImportContactsRequest {
1438
+ contacts: ImportContactItem[];
1439
+ listId?: string;
1440
+ optedInAt?: string;
1441
+ }
1442
+ interface ImportContactsError {
1443
+ index: number;
1444
+ phone: string;
1445
+ error: string;
1446
+ }
1447
+ interface ImportContactsResponse {
1448
+ imported: number;
1449
+ skippedDuplicates: number;
1450
+ errors: ImportContactsError[];
1451
+ totalErrors: number;
1452
+ }
1392
1453
 
1393
1454
  /**
1394
1455
  * HTTP Client Utility
@@ -2729,6 +2790,7 @@ declare class ContactsResource {
2729
2790
  * ```
2730
2791
  */
2731
2792
  delete(id: string): Promise<void>;
2793
+ import(request: ImportContactsRequest): Promise<ImportContactsResponse>;
2732
2794
  private transformContact;
2733
2795
  }
2734
2796
  /**
@@ -3471,4 +3533,4 @@ declare class Webhooks {
3471
3533
  */
3472
3534
  type WebhookMessageData = WebhookMessageObject;
3473
3535
 
3474
- export { ALL_SUPPORTED_COUNTRIES, type Account, type ApiErrorResponse, type ApiKey, AuthenticationError, type BatchListResponse, type BatchMessageItem, type BatchMessageRequest, type BatchMessageResponse, type BatchMessageResult, type BatchStatus, CREDITS_PER_SMS, type Campaign, type CampaignListResponse, type CampaignPreview, type CampaignStatus, type CancelledMessageResponse, type CheckVerificationRequest, type CheckVerificationResponse, type CircuitState, type Contact, type ContactList, type ContactListResponse, type ContactListsResponse, type CreateCampaignRequest, type CreateContactListRequest, type CreateContactRequest, type CreateTemplateRequest, type CreateVerifySessionRequest, type CreateWebhookOptions, type CreditTransaction, type Credits, type DeliveryStatus, InsufficientCreditsError, type ListBatchesOptions, type ListCampaignsOptions, type ListContactsOptions, type ListMessagesOptions, type ListScheduledMessagesOptions, type ListVerificationsOptions, type Message, type MessageListResponse, type MessageStatus, type MessageType, NetworkError, NotFoundError, type PricingTier, RateLimitError, type RateLimitInfo, SANDBOX_TEST_NUMBERS, SUPPORTED_COUNTRIES, type ScheduleCampaignRequest, type ScheduleMessageRequest, type ScheduledMessage, type ScheduledMessageListResponse, type ScheduledMessageStatus, type SendMessageRequest, type SendVerificationRequest, type SendVerificationResponse, type SenderType, Sendly, type SendlyConfig, SendlyError, type SendlyErrorCode, type Template, type TemplateListResponse, type TemplatePreview, type TemplateStatus, type TemplateVariable, TimeoutError, type UpdateCampaignRequest, type UpdateContactListRequest, type UpdateContactRequest, type UpdateTemplateRequest, type UpdateWebhookOptions, type ValidateSessionTokenRequest, type ValidateSessionTokenResponse, ValidationError, type Verification, type VerificationDeliveryStatus, type VerificationListResponse, type VerificationStatus, type VerifySession, type VerifySessionStatus, type Webhook, type WebhookCreatedResponse, type WebhookDelivery, type WebhookEvent, type WebhookEventType, type WebhookMessageData, type WebhookMessageStatus, type WebhookSecretRotation, WebhookSignatureError, type WebhookTestResult, Webhooks, calculateSegments, Sendly as default, generateWebhookSignature, getCountryFromPhone, isCountrySupported, parseWebhookEvent, validateMessageText, validatePhoneNumber, validateSenderId, verifyWebhookSignature };
3536
+ export { ALL_SUPPORTED_COUNTRIES, type Account, type ApiErrorResponse, type ApiKey, AuthenticationError, type BatchListResponse, type BatchMessageItem, type BatchMessageRequest, type BatchMessageResponse, type BatchMessageResult, type BatchStatus, CREDITS_PER_SMS, type Campaign, type CampaignListResponse, type CampaignPreview, type CampaignStatus, type CancelledMessageResponse, type CheckVerificationRequest, type CheckVerificationResponse, type CircuitState, type Contact, type ContactList, type ContactListResponse, type ContactListsResponse, type CreateCampaignRequest, type CreateContactListRequest, type CreateContactRequest, type CreateTemplateRequest, type CreateVerifySessionRequest, type CreateWebhookOptions, type CreditTransaction, type Credits, type DeliveryStatus, type ImportContactItem, type ImportContactsError, type ImportContactsRequest, type ImportContactsResponse, InsufficientCreditsError, type ListBatchesOptions, type ListCampaignsOptions, type ListContactsOptions, type ListMessagesOptions, type ListScheduledMessagesOptions, type ListVerificationsOptions, type Message, type MessageListResponse, type MessageStatus, type MessageType, NetworkError, NotFoundError, type PricingTier, RateLimitError, type RateLimitInfo, SANDBOX_TEST_NUMBERS, SUPPORTED_COUNTRIES, type ScheduleCampaignRequest, type ScheduleMessageRequest, type ScheduledMessage, type ScheduledMessageListResponse, type ScheduledMessageStatus, type SendMessageRequest, type SendVerificationRequest, type SendVerificationResponse, type SenderType, Sendly, type SendlyConfig, SendlyError, type SendlyErrorCode, type Template, type TemplateListResponse, type TemplatePreview, type TemplateStatus, type TemplateVariable, TimeoutError, type UpdateCampaignRequest, type UpdateContactListRequest, type UpdateContactRequest, type UpdateTemplateRequest, type UpdateWebhookOptions, type ValidateSessionTokenRequest, type ValidateSessionTokenResponse, ValidationError, type Verification, type VerificationDeliveryStatus, type VerificationListResponse, type VerificationStatus, type VerifySession, type VerifySessionStatus, type Webhook, type WebhookCreatedResponse, type WebhookDelivery, type WebhookEvent, type WebhookEventType, type WebhookMessageData, type WebhookMessageStatus, type WebhookSecretRotation, WebhookSignatureError, type WebhookTestResult, Webhooks, calculateSegments, Sendly as default, generateWebhookSignature, getCountryFromPhone, isCountrySupported, parseWebhookEvent, validateMessageText, validatePhoneNumber, validateSenderId, verifyWebhookSignature };
package/dist/index.d.ts CHANGED
@@ -54,6 +54,11 @@ interface SendMessageRequest {
54
54
  * - "transactional": OTPs, confirmations, alerts - bypasses quiet hours (24/7)
55
55
  */
56
56
  messageType?: MessageType;
57
+ /**
58
+ * Custom JSON metadata to attach to the message (max 4KB).
59
+ * Stored on the message record and included in webhook event payloads.
60
+ */
61
+ metadata?: Record<string, any>;
57
62
  }
58
63
  /**
59
64
  * Message status values
@@ -135,6 +140,10 @@ interface Message {
135
140
  * ISO 8601 timestamp when the message was delivered (if applicable)
136
141
  */
137
142
  deliveredAt?: string | null;
143
+ /**
144
+ * Custom JSON metadata attached to the message
145
+ */
146
+ metadata?: Record<string, any>;
138
147
  }
139
148
  /**
140
149
  * Options for listing messages
@@ -195,6 +204,11 @@ interface ScheduleMessageRequest {
195
204
  * - "transactional": OTPs, confirmations, alerts - bypasses quiet hours (24/7)
196
205
  */
197
206
  messageType?: MessageType;
207
+ /**
208
+ * Custom JSON metadata to attach to the message (max 4KB).
209
+ * Stored on the message record and included in webhook event payloads.
210
+ */
211
+ metadata?: Record<string, any>;
198
212
  }
199
213
  /**
200
214
  * Scheduled message status values
@@ -334,6 +348,11 @@ interface BatchMessageRequest {
334
348
  * - "transactional": OTPs, confirmations, alerts - bypasses quiet hours (24/7)
335
349
  */
336
350
  messageType?: MessageType;
351
+ /**
352
+ * Custom JSON metadata to attach to all messages in the batch (max 4KB).
353
+ * Stored on each message record and included in webhook event payloads.
354
+ */
355
+ metadata?: Record<string, any>;
337
356
  }
338
357
  /**
339
358
  * Result for a single message in a batch
@@ -1178,6 +1197,26 @@ interface CampaignPreview {
1178
1197
  creditsPerMessage: number;
1179
1198
  totalCredits: number;
1180
1199
  }>;
1200
+ /** Number of recipients blocked due to destination restrictions */
1201
+ blockedCount?: number;
1202
+ /** Number of recipients that can be reached */
1203
+ sendableCount?: number;
1204
+ /** Per-country breakdown with access info */
1205
+ byCountry?: Record<string, {
1206
+ count: number;
1207
+ credits: number;
1208
+ allowed: boolean;
1209
+ blockedReason?: string;
1210
+ }>;
1211
+ /** Validation warnings */
1212
+ warnings?: string[];
1213
+ /** User's messaging profile access info */
1214
+ messagingProfile?: {
1215
+ canSendDomestic: boolean;
1216
+ canSendInternational: boolean;
1217
+ verificationType: string | null;
1218
+ verificationStatus: string | null;
1219
+ };
1181
1220
  }
1182
1221
  /**
1183
1222
  * Options for listing campaigns
@@ -1389,6 +1428,28 @@ interface UpdateContactListRequest {
1389
1428
  interface ContactListsResponse {
1390
1429
  lists: ContactList[];
1391
1430
  }
1431
+ interface ImportContactItem {
1432
+ phone: string;
1433
+ name?: string;
1434
+ email?: string;
1435
+ optedInAt?: string;
1436
+ }
1437
+ interface ImportContactsRequest {
1438
+ contacts: ImportContactItem[];
1439
+ listId?: string;
1440
+ optedInAt?: string;
1441
+ }
1442
+ interface ImportContactsError {
1443
+ index: number;
1444
+ phone: string;
1445
+ error: string;
1446
+ }
1447
+ interface ImportContactsResponse {
1448
+ imported: number;
1449
+ skippedDuplicates: number;
1450
+ errors: ImportContactsError[];
1451
+ totalErrors: number;
1452
+ }
1392
1453
 
1393
1454
  /**
1394
1455
  * HTTP Client Utility
@@ -2729,6 +2790,7 @@ declare class ContactsResource {
2729
2790
  * ```
2730
2791
  */
2731
2792
  delete(id: string): Promise<void>;
2793
+ import(request: ImportContactsRequest): Promise<ImportContactsResponse>;
2732
2794
  private transformContact;
2733
2795
  }
2734
2796
  /**
@@ -3471,4 +3533,4 @@ declare class Webhooks {
3471
3533
  */
3472
3534
  type WebhookMessageData = WebhookMessageObject;
3473
3535
 
3474
- export { ALL_SUPPORTED_COUNTRIES, type Account, type ApiErrorResponse, type ApiKey, AuthenticationError, type BatchListResponse, type BatchMessageItem, type BatchMessageRequest, type BatchMessageResponse, type BatchMessageResult, type BatchStatus, CREDITS_PER_SMS, type Campaign, type CampaignListResponse, type CampaignPreview, type CampaignStatus, type CancelledMessageResponse, type CheckVerificationRequest, type CheckVerificationResponse, type CircuitState, type Contact, type ContactList, type ContactListResponse, type ContactListsResponse, type CreateCampaignRequest, type CreateContactListRequest, type CreateContactRequest, type CreateTemplateRequest, type CreateVerifySessionRequest, type CreateWebhookOptions, type CreditTransaction, type Credits, type DeliveryStatus, InsufficientCreditsError, type ListBatchesOptions, type ListCampaignsOptions, type ListContactsOptions, type ListMessagesOptions, type ListScheduledMessagesOptions, type ListVerificationsOptions, type Message, type MessageListResponse, type MessageStatus, type MessageType, NetworkError, NotFoundError, type PricingTier, RateLimitError, type RateLimitInfo, SANDBOX_TEST_NUMBERS, SUPPORTED_COUNTRIES, type ScheduleCampaignRequest, type ScheduleMessageRequest, type ScheduledMessage, type ScheduledMessageListResponse, type ScheduledMessageStatus, type SendMessageRequest, type SendVerificationRequest, type SendVerificationResponse, type SenderType, Sendly, type SendlyConfig, SendlyError, type SendlyErrorCode, type Template, type TemplateListResponse, type TemplatePreview, type TemplateStatus, type TemplateVariable, TimeoutError, type UpdateCampaignRequest, type UpdateContactListRequest, type UpdateContactRequest, type UpdateTemplateRequest, type UpdateWebhookOptions, type ValidateSessionTokenRequest, type ValidateSessionTokenResponse, ValidationError, type Verification, type VerificationDeliveryStatus, type VerificationListResponse, type VerificationStatus, type VerifySession, type VerifySessionStatus, type Webhook, type WebhookCreatedResponse, type WebhookDelivery, type WebhookEvent, type WebhookEventType, type WebhookMessageData, type WebhookMessageStatus, type WebhookSecretRotation, WebhookSignatureError, type WebhookTestResult, Webhooks, calculateSegments, Sendly as default, generateWebhookSignature, getCountryFromPhone, isCountrySupported, parseWebhookEvent, validateMessageText, validatePhoneNumber, validateSenderId, verifyWebhookSignature };
3536
+ export { ALL_SUPPORTED_COUNTRIES, type Account, type ApiErrorResponse, type ApiKey, AuthenticationError, type BatchListResponse, type BatchMessageItem, type BatchMessageRequest, type BatchMessageResponse, type BatchMessageResult, type BatchStatus, CREDITS_PER_SMS, type Campaign, type CampaignListResponse, type CampaignPreview, type CampaignStatus, type CancelledMessageResponse, type CheckVerificationRequest, type CheckVerificationResponse, type CircuitState, type Contact, type ContactList, type ContactListResponse, type ContactListsResponse, type CreateCampaignRequest, type CreateContactListRequest, type CreateContactRequest, type CreateTemplateRequest, type CreateVerifySessionRequest, type CreateWebhookOptions, type CreditTransaction, type Credits, type DeliveryStatus, type ImportContactItem, type ImportContactsError, type ImportContactsRequest, type ImportContactsResponse, InsufficientCreditsError, type ListBatchesOptions, type ListCampaignsOptions, type ListContactsOptions, type ListMessagesOptions, type ListScheduledMessagesOptions, type ListVerificationsOptions, type Message, type MessageListResponse, type MessageStatus, type MessageType, NetworkError, NotFoundError, type PricingTier, RateLimitError, type RateLimitInfo, SANDBOX_TEST_NUMBERS, SUPPORTED_COUNTRIES, type ScheduleCampaignRequest, type ScheduleMessageRequest, type ScheduledMessage, type ScheduledMessageListResponse, type ScheduledMessageStatus, type SendMessageRequest, type SendVerificationRequest, type SendVerificationResponse, type SenderType, Sendly, type SendlyConfig, SendlyError, type SendlyErrorCode, type Template, type TemplateListResponse, type TemplatePreview, type TemplateStatus, type TemplateVariable, TimeoutError, type UpdateCampaignRequest, type UpdateContactListRequest, type UpdateContactRequest, type UpdateTemplateRequest, type UpdateWebhookOptions, type ValidateSessionTokenRequest, type ValidateSessionTokenResponse, ValidationError, type Verification, type VerificationDeliveryStatus, type VerificationListResponse, type VerificationStatus, type VerifySession, type VerifySessionStatus, type Webhook, type WebhookCreatedResponse, type WebhookDelivery, type WebhookEvent, type WebhookEventType, type WebhookMessageData, type WebhookMessageStatus, type WebhookSecretRotation, WebhookSignatureError, type WebhookTestResult, Webhooks, calculateSegments, Sendly as default, generateWebhookSignature, getCountryFromPhone, isCountrySupported, parseWebhookEvent, validateMessageText, validatePhoneNumber, validateSenderId, verifyWebhookSignature };
package/dist/index.js CHANGED
@@ -639,7 +639,8 @@ var MessagesResource = class {
639
639
  to: request.to,
640
640
  text: request.text,
641
641
  ...request.from && { from: request.from },
642
- ...request.messageType && { messageType: request.messageType }
642
+ ...request.messageType && { messageType: request.messageType },
643
+ ...request.metadata && { metadata: request.metadata }
643
644
  }
644
645
  });
645
646
  return message;
@@ -804,7 +805,8 @@ var MessagesResource = class {
804
805
  text: request.text,
805
806
  scheduledAt: request.scheduledAt,
806
807
  ...request.from && { from: request.from },
807
- ...request.messageType && { messageType: request.messageType }
808
+ ...request.messageType && { messageType: request.messageType },
809
+ ...request.metadata && { metadata: request.metadata }
808
810
  }
809
811
  });
810
812
  return scheduled;
@@ -928,7 +930,8 @@ var MessagesResource = class {
928
930
  body: {
929
931
  messages: request.messages,
930
932
  ...request.from && { from: request.from },
931
- ...request.messageType && { messageType: request.messageType }
933
+ ...request.messageType && { messageType: request.messageType },
934
+ ...request.metadata && { metadata: request.metadata }
932
935
  }
933
936
  });
934
937
  return batch;
@@ -2508,6 +2511,18 @@ var ContactsResource = class {
2508
2511
  path: `/contacts/${id}`
2509
2512
  });
2510
2513
  }
2514
+ async import(request) {
2515
+ const body = {
2516
+ contacts: request.contacts
2517
+ };
2518
+ if (request.listId) body.listId = request.listId;
2519
+ if (request.optedInAt) body.optedInAt = request.optedInAt;
2520
+ return this.http.request({
2521
+ method: "POST",
2522
+ path: "/contacts/import",
2523
+ body
2524
+ });
2525
+ }
2511
2526
  transformContact(raw) {
2512
2527
  return {
2513
2528
  id: raw.id,
package/dist/index.mjs CHANGED
@@ -579,7 +579,8 @@ var MessagesResource = class {
579
579
  to: request.to,
580
580
  text: request.text,
581
581
  ...request.from && { from: request.from },
582
- ...request.messageType && { messageType: request.messageType }
582
+ ...request.messageType && { messageType: request.messageType },
583
+ ...request.metadata && { metadata: request.metadata }
583
584
  }
584
585
  });
585
586
  return message;
@@ -744,7 +745,8 @@ var MessagesResource = class {
744
745
  text: request.text,
745
746
  scheduledAt: request.scheduledAt,
746
747
  ...request.from && { from: request.from },
747
- ...request.messageType && { messageType: request.messageType }
748
+ ...request.messageType && { messageType: request.messageType },
749
+ ...request.metadata && { metadata: request.metadata }
748
750
  }
749
751
  });
750
752
  return scheduled;
@@ -868,7 +870,8 @@ var MessagesResource = class {
868
870
  body: {
869
871
  messages: request.messages,
870
872
  ...request.from && { from: request.from },
871
- ...request.messageType && { messageType: request.messageType }
873
+ ...request.messageType && { messageType: request.messageType },
874
+ ...request.metadata && { metadata: request.metadata }
872
875
  }
873
876
  });
874
877
  return batch;
@@ -2448,6 +2451,18 @@ var ContactsResource = class {
2448
2451
  path: `/contacts/${id}`
2449
2452
  });
2450
2453
  }
2454
+ async import(request) {
2455
+ const body = {
2456
+ contacts: request.contacts
2457
+ };
2458
+ if (request.listId) body.listId = request.listId;
2459
+ if (request.optedInAt) body.optedInAt = request.optedInAt;
2460
+ return this.http.request({
2461
+ method: "POST",
2462
+ path: "/contacts/import",
2463
+ body
2464
+ });
2465
+ }
2451
2466
  transformContact(raw) {
2452
2467
  return {
2453
2468
  id: raw.id,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sendly/node",
3
- "version": "3.13.0",
3
+ "version": "3.13.2",
4
4
  "description": "Official Sendly Node.js SDK for SMS messaging",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",