@sendly/node 3.1.0 → 3.4.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 +24 -2
- package/dist/index.d.ts +24 -2
- package/dist/index.js +7 -3
- package/dist/index.mjs +7 -3
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -26,6 +26,10 @@ interface SendlyConfig {
|
|
|
26
26
|
*/
|
|
27
27
|
maxRetries?: number;
|
|
28
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Message type for compliance classification
|
|
31
|
+
*/
|
|
32
|
+
type MessageType = "marketing" | "transactional";
|
|
29
33
|
/**
|
|
30
34
|
* Request payload for sending an SMS message
|
|
31
35
|
*/
|
|
@@ -44,6 +48,12 @@ interface SendMessageRequest {
|
|
|
44
48
|
* For US/Canada: Your verified toll-free number
|
|
45
49
|
*/
|
|
46
50
|
from?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Message type for compliance (default: "marketing")
|
|
53
|
+
* - "marketing": Promotional content, subject to quiet hours (8am-9pm recipient time)
|
|
54
|
+
* - "transactional": OTPs, confirmations, alerts - bypasses quiet hours (24/7)
|
|
55
|
+
*/
|
|
56
|
+
messageType?: MessageType;
|
|
47
57
|
}
|
|
48
58
|
/**
|
|
49
59
|
* Message status values
|
|
@@ -171,7 +181,7 @@ interface ScheduleMessageRequest {
|
|
|
171
181
|
*/
|
|
172
182
|
text: string;
|
|
173
183
|
/**
|
|
174
|
-
* When to send the message (ISO 8601 format, must be
|
|
184
|
+
* When to send the message (ISO 8601 format, must be 5 min - 5 days in future)
|
|
175
185
|
*/
|
|
176
186
|
scheduledAt: string;
|
|
177
187
|
/**
|
|
@@ -179,6 +189,12 @@ interface ScheduleMessageRequest {
|
|
|
179
189
|
* For US/Canada: This is ignored - toll-free number pool is used
|
|
180
190
|
*/
|
|
181
191
|
from?: string;
|
|
192
|
+
/**
|
|
193
|
+
* Message type for compliance (default: "marketing")
|
|
194
|
+
* - "marketing": Promotional content, subject to quiet hours (8am-9pm recipient time)
|
|
195
|
+
* - "transactional": OTPs, confirmations, alerts - bypasses quiet hours (24/7)
|
|
196
|
+
*/
|
|
197
|
+
messageType?: MessageType;
|
|
182
198
|
}
|
|
183
199
|
/**
|
|
184
200
|
* Scheduled message status values
|
|
@@ -312,6 +328,12 @@ interface BatchMessageRequest {
|
|
|
312
328
|
* For US/Canada destinations: This is ignored - toll-free number pool is used
|
|
313
329
|
*/
|
|
314
330
|
from?: string;
|
|
331
|
+
/**
|
|
332
|
+
* Message type for compliance (default: "marketing")
|
|
333
|
+
* - "marketing": Promotional content, subject to quiet hours (8am-9pm recipient time)
|
|
334
|
+
* - "transactional": OTPs, confirmations, alerts - bypasses quiet hours (24/7)
|
|
335
|
+
*/
|
|
336
|
+
messageType?: MessageType;
|
|
315
337
|
}
|
|
316
338
|
/**
|
|
317
339
|
* Result for a single message in a batch
|
|
@@ -1922,4 +1944,4 @@ declare class Webhooks {
|
|
|
1922
1944
|
*/
|
|
1923
1945
|
type WebhookMessageData = WebhookMessageObject;
|
|
1924
1946
|
|
|
1925
|
-
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 CircuitState, type CreateWebhookOptions, type CreditTransaction, type Credits, type DeliveryStatus, InsufficientCreditsError, type ListBatchesOptions, type ListMessagesOptions, type ListScheduledMessagesOptions, type Message, type MessageListResponse, type MessageStatus, NetworkError, NotFoundError, type PricingTier, RateLimitError, type RateLimitInfo, SANDBOX_TEST_NUMBERS, SUPPORTED_COUNTRIES, type ScheduleMessageRequest, type ScheduledMessage, type ScheduledMessageListResponse, type ScheduledMessageStatus, type SendMessageRequest, type SenderType, Sendly, type SendlyConfig, SendlyError, type SendlyErrorCode, TimeoutError, type UpdateWebhookOptions, ValidationError, 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 };
|
|
1947
|
+
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 CircuitState, type CreateWebhookOptions, type CreditTransaction, type Credits, type DeliveryStatus, InsufficientCreditsError, type ListBatchesOptions, type ListMessagesOptions, type ListScheduledMessagesOptions, 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 SenderType, Sendly, type SendlyConfig, SendlyError, type SendlyErrorCode, TimeoutError, type UpdateWebhookOptions, ValidationError, 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
|
@@ -26,6 +26,10 @@ interface SendlyConfig {
|
|
|
26
26
|
*/
|
|
27
27
|
maxRetries?: number;
|
|
28
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Message type for compliance classification
|
|
31
|
+
*/
|
|
32
|
+
type MessageType = "marketing" | "transactional";
|
|
29
33
|
/**
|
|
30
34
|
* Request payload for sending an SMS message
|
|
31
35
|
*/
|
|
@@ -44,6 +48,12 @@ interface SendMessageRequest {
|
|
|
44
48
|
* For US/Canada: Your verified toll-free number
|
|
45
49
|
*/
|
|
46
50
|
from?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Message type for compliance (default: "marketing")
|
|
53
|
+
* - "marketing": Promotional content, subject to quiet hours (8am-9pm recipient time)
|
|
54
|
+
* - "transactional": OTPs, confirmations, alerts - bypasses quiet hours (24/7)
|
|
55
|
+
*/
|
|
56
|
+
messageType?: MessageType;
|
|
47
57
|
}
|
|
48
58
|
/**
|
|
49
59
|
* Message status values
|
|
@@ -171,7 +181,7 @@ interface ScheduleMessageRequest {
|
|
|
171
181
|
*/
|
|
172
182
|
text: string;
|
|
173
183
|
/**
|
|
174
|
-
* When to send the message (ISO 8601 format, must be
|
|
184
|
+
* When to send the message (ISO 8601 format, must be 5 min - 5 days in future)
|
|
175
185
|
*/
|
|
176
186
|
scheduledAt: string;
|
|
177
187
|
/**
|
|
@@ -179,6 +189,12 @@ interface ScheduleMessageRequest {
|
|
|
179
189
|
* For US/Canada: This is ignored - toll-free number pool is used
|
|
180
190
|
*/
|
|
181
191
|
from?: string;
|
|
192
|
+
/**
|
|
193
|
+
* Message type for compliance (default: "marketing")
|
|
194
|
+
* - "marketing": Promotional content, subject to quiet hours (8am-9pm recipient time)
|
|
195
|
+
* - "transactional": OTPs, confirmations, alerts - bypasses quiet hours (24/7)
|
|
196
|
+
*/
|
|
197
|
+
messageType?: MessageType;
|
|
182
198
|
}
|
|
183
199
|
/**
|
|
184
200
|
* Scheduled message status values
|
|
@@ -312,6 +328,12 @@ interface BatchMessageRequest {
|
|
|
312
328
|
* For US/Canada destinations: This is ignored - toll-free number pool is used
|
|
313
329
|
*/
|
|
314
330
|
from?: string;
|
|
331
|
+
/**
|
|
332
|
+
* Message type for compliance (default: "marketing")
|
|
333
|
+
* - "marketing": Promotional content, subject to quiet hours (8am-9pm recipient time)
|
|
334
|
+
* - "transactional": OTPs, confirmations, alerts - bypasses quiet hours (24/7)
|
|
335
|
+
*/
|
|
336
|
+
messageType?: MessageType;
|
|
315
337
|
}
|
|
316
338
|
/**
|
|
317
339
|
* Result for a single message in a batch
|
|
@@ -1922,4 +1944,4 @@ declare class Webhooks {
|
|
|
1922
1944
|
*/
|
|
1923
1945
|
type WebhookMessageData = WebhookMessageObject;
|
|
1924
1946
|
|
|
1925
|
-
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 CircuitState, type CreateWebhookOptions, type CreditTransaction, type Credits, type DeliveryStatus, InsufficientCreditsError, type ListBatchesOptions, type ListMessagesOptions, type ListScheduledMessagesOptions, type Message, type MessageListResponse, type MessageStatus, NetworkError, NotFoundError, type PricingTier, RateLimitError, type RateLimitInfo, SANDBOX_TEST_NUMBERS, SUPPORTED_COUNTRIES, type ScheduleMessageRequest, type ScheduledMessage, type ScheduledMessageListResponse, type ScheduledMessageStatus, type SendMessageRequest, type SenderType, Sendly, type SendlyConfig, SendlyError, type SendlyErrorCode, TimeoutError, type UpdateWebhookOptions, ValidationError, 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 };
|
|
1947
|
+
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 CircuitState, type CreateWebhookOptions, type CreditTransaction, type Credits, type DeliveryStatus, InsufficientCreditsError, type ListBatchesOptions, type ListMessagesOptions, type ListScheduledMessagesOptions, 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 SenderType, Sendly, type SendlyConfig, SendlyError, type SendlyErrorCode, TimeoutError, type UpdateWebhookOptions, ValidationError, 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
|
@@ -781,12 +781,16 @@ var MessagesResource = class {
|
|
|
781
781
|
}
|
|
782
782
|
const scheduledTime = new Date(request.scheduledAt);
|
|
783
783
|
const now = /* @__PURE__ */ new Date();
|
|
784
|
-
const
|
|
784
|
+
const fiveMinutesFromNow = new Date(now.getTime() + 5 * 60 * 1e3);
|
|
785
|
+
const fiveDaysFromNow = new Date(now.getTime() + 5 * 24 * 60 * 60 * 1e3);
|
|
785
786
|
if (isNaN(scheduledTime.getTime())) {
|
|
786
787
|
throw new Error("Invalid scheduledAt format. Use ISO 8601 format.");
|
|
787
788
|
}
|
|
788
|
-
if (scheduledTime <=
|
|
789
|
-
throw new Error("scheduledAt must be at least
|
|
789
|
+
if (scheduledTime <= fiveMinutesFromNow) {
|
|
790
|
+
throw new Error("scheduledAt must be at least 5 minutes in the future.");
|
|
791
|
+
}
|
|
792
|
+
if (scheduledTime > fiveDaysFromNow) {
|
|
793
|
+
throw new Error("scheduledAt must be within 5 days.");
|
|
790
794
|
}
|
|
791
795
|
const scheduled = await this.http.request({
|
|
792
796
|
method: "POST",
|
package/dist/index.mjs
CHANGED
|
@@ -721,12 +721,16 @@ var MessagesResource = class {
|
|
|
721
721
|
}
|
|
722
722
|
const scheduledTime = new Date(request.scheduledAt);
|
|
723
723
|
const now = /* @__PURE__ */ new Date();
|
|
724
|
-
const
|
|
724
|
+
const fiveMinutesFromNow = new Date(now.getTime() + 5 * 60 * 1e3);
|
|
725
|
+
const fiveDaysFromNow = new Date(now.getTime() + 5 * 24 * 60 * 60 * 1e3);
|
|
725
726
|
if (isNaN(scheduledTime.getTime())) {
|
|
726
727
|
throw new Error("Invalid scheduledAt format. Use ISO 8601 format.");
|
|
727
728
|
}
|
|
728
|
-
if (scheduledTime <=
|
|
729
|
-
throw new Error("scheduledAt must be at least
|
|
729
|
+
if (scheduledTime <= fiveMinutesFromNow) {
|
|
730
|
+
throw new Error("scheduledAt must be at least 5 minutes in the future.");
|
|
731
|
+
}
|
|
732
|
+
if (scheduledTime > fiveDaysFromNow) {
|
|
733
|
+
throw new Error("scheduledAt must be within 5 days.");
|
|
730
734
|
}
|
|
731
735
|
const scheduled = await this.http.request({
|
|
732
736
|
method: "POST",
|