@sendly/node 3.10.0 → 3.12.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/dist/index.d.mts CHANGED
@@ -59,7 +59,7 @@ interface SendMessageRequest {
59
59
  * Message status values
60
60
  * Note: "sending" was removed as it doesn't exist in the database
61
61
  */
62
- type MessageStatus = "queued" | "sent" | "delivered" | "failed";
62
+ type MessageStatus = "queued" | "sent" | "delivered" | "failed" | "bounced";
63
63
  /**
64
64
  * How the message was sent
65
65
  */
@@ -1042,6 +1042,39 @@ interface TemplatePreview {
1042
1042
  /** Variables detected */
1043
1043
  variables: TemplateVariable[];
1044
1044
  }
1045
+ type VerifySessionStatus = "pending" | "phone_submitted" | "code_sent" | "verified" | "expired" | "cancelled";
1046
+ interface CreateVerifySessionRequest {
1047
+ successUrl: string;
1048
+ cancelUrl?: string;
1049
+ brandName?: string;
1050
+ brandColor?: string;
1051
+ metadata?: Record<string, unknown>;
1052
+ }
1053
+ interface VerifySession {
1054
+ id: string;
1055
+ url: string;
1056
+ status: VerifySessionStatus;
1057
+ successUrl: string;
1058
+ cancelUrl?: string;
1059
+ brandName?: string;
1060
+ brandColor?: string;
1061
+ phone?: string;
1062
+ verificationId?: string;
1063
+ token?: string;
1064
+ metadata?: Record<string, unknown>;
1065
+ expiresAt: string;
1066
+ createdAt: string;
1067
+ }
1068
+ interface ValidateSessionTokenRequest {
1069
+ token: string;
1070
+ }
1071
+ interface ValidateSessionTokenResponse {
1072
+ valid: boolean;
1073
+ sessionId?: string;
1074
+ phone?: string;
1075
+ verifiedAt?: string;
1076
+ metadata?: Record<string, unknown>;
1077
+ }
1045
1078
 
1046
1079
  /**
1047
1080
  * HTTP Client Utility
@@ -1739,6 +1772,12 @@ declare class AccountResource {
1739
1772
  * @packageDocumentation
1740
1773
  */
1741
1774
 
1775
+ declare class SessionsResource {
1776
+ private readonly http;
1777
+ constructor(http: HttpClient);
1778
+ create(request: CreateVerifySessionRequest): Promise<VerifySession>;
1779
+ validate(request: ValidateSessionTokenRequest): Promise<ValidateSessionTokenResponse>;
1780
+ }
1742
1781
  /**
1743
1782
  * Verify API resource for OTP verification
1744
1783
  *
@@ -1762,6 +1801,7 @@ declare class AccountResource {
1762
1801
  */
1763
1802
  declare class VerifyResource {
1764
1803
  private readonly http;
1804
+ readonly sessions: SessionsResource;
1765
1805
  constructor(http: HttpClient);
1766
1806
  /**
1767
1807
  * Send an OTP verification code
@@ -2587,4 +2627,4 @@ declare class Webhooks {
2587
2627
  */
2588
2628
  type WebhookMessageData = WebhookMessageObject;
2589
2629
 
2590
- 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 CancelledMessageResponse, type CheckVerificationRequest, type CheckVerificationResponse, type CircuitState, type CreateTemplateRequest, type CreateWebhookOptions, type CreditTransaction, type Credits, type DeliveryStatus, InsufficientCreditsError, type ListBatchesOptions, 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 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 UpdateTemplateRequest, type UpdateWebhookOptions, ValidationError, type Verification, type VerificationDeliveryStatus, type VerificationListResponse, type VerificationStatus, 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 };
2630
+ 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 CancelledMessageResponse, type CheckVerificationRequest, type CheckVerificationResponse, type CircuitState, type CreateTemplateRequest, type CreateVerifySessionRequest, type CreateWebhookOptions, type CreditTransaction, type Credits, type DeliveryStatus, InsufficientCreditsError, type ListBatchesOptions, 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 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 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
@@ -59,7 +59,7 @@ interface SendMessageRequest {
59
59
  * Message status values
60
60
  * Note: "sending" was removed as it doesn't exist in the database
61
61
  */
62
- type MessageStatus = "queued" | "sent" | "delivered" | "failed";
62
+ type MessageStatus = "queued" | "sent" | "delivered" | "failed" | "bounced";
63
63
  /**
64
64
  * How the message was sent
65
65
  */
@@ -1042,6 +1042,39 @@ interface TemplatePreview {
1042
1042
  /** Variables detected */
1043
1043
  variables: TemplateVariable[];
1044
1044
  }
1045
+ type VerifySessionStatus = "pending" | "phone_submitted" | "code_sent" | "verified" | "expired" | "cancelled";
1046
+ interface CreateVerifySessionRequest {
1047
+ successUrl: string;
1048
+ cancelUrl?: string;
1049
+ brandName?: string;
1050
+ brandColor?: string;
1051
+ metadata?: Record<string, unknown>;
1052
+ }
1053
+ interface VerifySession {
1054
+ id: string;
1055
+ url: string;
1056
+ status: VerifySessionStatus;
1057
+ successUrl: string;
1058
+ cancelUrl?: string;
1059
+ brandName?: string;
1060
+ brandColor?: string;
1061
+ phone?: string;
1062
+ verificationId?: string;
1063
+ token?: string;
1064
+ metadata?: Record<string, unknown>;
1065
+ expiresAt: string;
1066
+ createdAt: string;
1067
+ }
1068
+ interface ValidateSessionTokenRequest {
1069
+ token: string;
1070
+ }
1071
+ interface ValidateSessionTokenResponse {
1072
+ valid: boolean;
1073
+ sessionId?: string;
1074
+ phone?: string;
1075
+ verifiedAt?: string;
1076
+ metadata?: Record<string, unknown>;
1077
+ }
1045
1078
 
1046
1079
  /**
1047
1080
  * HTTP Client Utility
@@ -1739,6 +1772,12 @@ declare class AccountResource {
1739
1772
  * @packageDocumentation
1740
1773
  */
1741
1774
 
1775
+ declare class SessionsResource {
1776
+ private readonly http;
1777
+ constructor(http: HttpClient);
1778
+ create(request: CreateVerifySessionRequest): Promise<VerifySession>;
1779
+ validate(request: ValidateSessionTokenRequest): Promise<ValidateSessionTokenResponse>;
1780
+ }
1742
1781
  /**
1743
1782
  * Verify API resource for OTP verification
1744
1783
  *
@@ -1762,6 +1801,7 @@ declare class AccountResource {
1762
1801
  */
1763
1802
  declare class VerifyResource {
1764
1803
  private readonly http;
1804
+ readonly sessions: SessionsResource;
1765
1805
  constructor(http: HttpClient);
1766
1806
  /**
1767
1807
  * Send an OTP verification code
@@ -2587,4 +2627,4 @@ declare class Webhooks {
2587
2627
  */
2588
2628
  type WebhookMessageData = WebhookMessageObject;
2589
2629
 
2590
- 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 CancelledMessageResponse, type CheckVerificationRequest, type CheckVerificationResponse, type CircuitState, type CreateTemplateRequest, type CreateWebhookOptions, type CreditTransaction, type Credits, type DeliveryStatus, InsufficientCreditsError, type ListBatchesOptions, 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 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 UpdateTemplateRequest, type UpdateWebhookOptions, ValidationError, type Verification, type VerificationDeliveryStatus, type VerificationListResponse, type VerificationStatus, 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 };
2630
+ 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 CancelledMessageResponse, type CheckVerificationRequest, type CheckVerificationResponse, type CircuitState, type CreateTemplateRequest, type CreateVerifySessionRequest, type CreateWebhookOptions, type CreditTransaction, type Credits, type DeliveryStatus, InsufficientCreditsError, type ListBatchesOptions, 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 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 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
@@ -1523,10 +1523,60 @@ var AccountResource = class {
1523
1523
  };
1524
1524
 
1525
1525
  // src/resources/verify.ts
1526
+ var SessionsResource = class {
1527
+ http;
1528
+ constructor(http) {
1529
+ this.http = http;
1530
+ }
1531
+ async create(request) {
1532
+ const response = await this.http.request({
1533
+ method: "POST",
1534
+ path: "/verify/sessions",
1535
+ body: {
1536
+ success_url: request.successUrl,
1537
+ ...request.cancelUrl && { cancel_url: request.cancelUrl },
1538
+ ...request.brandName && { brand_name: request.brandName },
1539
+ ...request.brandColor && { brand_color: request.brandColor },
1540
+ ...request.metadata && { metadata: request.metadata }
1541
+ }
1542
+ });
1543
+ return {
1544
+ id: response.id,
1545
+ url: response.url,
1546
+ status: response.status,
1547
+ successUrl: response.success_url,
1548
+ cancelUrl: response.cancel_url,
1549
+ brandName: response.brand_name,
1550
+ brandColor: response.brand_color,
1551
+ phone: response.phone,
1552
+ verificationId: response.verification_id,
1553
+ token: response.token,
1554
+ metadata: response.metadata,
1555
+ expiresAt: response.expires_at,
1556
+ createdAt: response.created_at
1557
+ };
1558
+ }
1559
+ async validate(request) {
1560
+ const response = await this.http.request({
1561
+ method: "POST",
1562
+ path: "/verify/sessions/validate",
1563
+ body: { token: request.token }
1564
+ });
1565
+ return {
1566
+ valid: response.valid,
1567
+ sessionId: response.session_id,
1568
+ phone: response.phone,
1569
+ verifiedAt: response.verified_at,
1570
+ metadata: response.metadata
1571
+ };
1572
+ }
1573
+ };
1526
1574
  var VerifyResource = class {
1527
1575
  http;
1576
+ sessions;
1528
1577
  constructor(http) {
1529
1578
  this.http = http;
1579
+ this.sessions = new SessionsResource(http);
1530
1580
  }
1531
1581
  /**
1532
1582
  * Send an OTP verification code
package/dist/index.mjs CHANGED
@@ -1463,10 +1463,60 @@ var AccountResource = class {
1463
1463
  };
1464
1464
 
1465
1465
  // src/resources/verify.ts
1466
+ var SessionsResource = class {
1467
+ http;
1468
+ constructor(http) {
1469
+ this.http = http;
1470
+ }
1471
+ async create(request) {
1472
+ const response = await this.http.request({
1473
+ method: "POST",
1474
+ path: "/verify/sessions",
1475
+ body: {
1476
+ success_url: request.successUrl,
1477
+ ...request.cancelUrl && { cancel_url: request.cancelUrl },
1478
+ ...request.brandName && { brand_name: request.brandName },
1479
+ ...request.brandColor && { brand_color: request.brandColor },
1480
+ ...request.metadata && { metadata: request.metadata }
1481
+ }
1482
+ });
1483
+ return {
1484
+ id: response.id,
1485
+ url: response.url,
1486
+ status: response.status,
1487
+ successUrl: response.success_url,
1488
+ cancelUrl: response.cancel_url,
1489
+ brandName: response.brand_name,
1490
+ brandColor: response.brand_color,
1491
+ phone: response.phone,
1492
+ verificationId: response.verification_id,
1493
+ token: response.token,
1494
+ metadata: response.metadata,
1495
+ expiresAt: response.expires_at,
1496
+ createdAt: response.created_at
1497
+ };
1498
+ }
1499
+ async validate(request) {
1500
+ const response = await this.http.request({
1501
+ method: "POST",
1502
+ path: "/verify/sessions/validate",
1503
+ body: { token: request.token }
1504
+ });
1505
+ return {
1506
+ valid: response.valid,
1507
+ sessionId: response.session_id,
1508
+ phone: response.phone,
1509
+ verifiedAt: response.verified_at,
1510
+ metadata: response.metadata
1511
+ };
1512
+ }
1513
+ };
1466
1514
  var VerifyResource = class {
1467
1515
  http;
1516
+ sessions;
1468
1517
  constructor(http) {
1469
1518
  this.http = http;
1519
+ this.sessions = new SessionsResource(http);
1470
1520
  }
1471
1521
  /**
1472
1522
  * Send an OTP verification code
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sendly/node",
3
- "version": "3.10.0",
3
+ "version": "3.12.0",
4
4
  "description": "Official Sendly Node.js SDK for SMS messaging",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",