@sendly/node 3.4.0 → 3.5.3
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/README.md +17 -9
- package/dist/index.d.mts +13 -10
- package/dist/index.d.ts +13 -10
- package/dist/index.js +11 -8
- package/dist/index.mjs +11 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -77,10 +77,17 @@ import Sendly from '@sendly/node';
|
|
|
77
77
|
|
|
78
78
|
const sendly = new Sendly('sk_live_v1_xxx');
|
|
79
79
|
|
|
80
|
-
// Basic usage
|
|
80
|
+
// Basic usage (marketing message - default)
|
|
81
81
|
const message = await sendly.messages.send({
|
|
82
82
|
to: '+15551234567',
|
|
83
|
-
text: '
|
|
83
|
+
text: 'Check out our new features!'
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
// Transactional message (bypasses quiet hours)
|
|
87
|
+
const message = await sendly.messages.send({
|
|
88
|
+
to: '+15551234567',
|
|
89
|
+
text: 'Your verification code is: 123456',
|
|
90
|
+
messageType: 'transactional'
|
|
84
91
|
});
|
|
85
92
|
|
|
86
93
|
// With custom sender ID (international)
|
|
@@ -201,12 +208,12 @@ console.log(sendly.isTestMode()); // true
|
|
|
201
208
|
|
|
202
209
|
// Use sandbox test numbers
|
|
203
210
|
await sendly.messages.send({
|
|
204
|
-
to: SANDBOX_TEST_NUMBERS.SUCCESS, // +
|
|
211
|
+
to: SANDBOX_TEST_NUMBERS.SUCCESS, // +15005550000 - Always succeeds
|
|
205
212
|
text: 'Test message'
|
|
206
213
|
});
|
|
207
214
|
|
|
208
215
|
await sendly.messages.send({
|
|
209
|
-
to: SANDBOX_TEST_NUMBERS.INVALID, // +
|
|
216
|
+
to: SANDBOX_TEST_NUMBERS.INVALID, // +15005550001 - Returns invalid_number error
|
|
210
217
|
text: 'Test message'
|
|
211
218
|
});
|
|
212
219
|
```
|
|
@@ -215,11 +222,12 @@ await sendly.messages.send({
|
|
|
215
222
|
|
|
216
223
|
| Number | Behavior |
|
|
217
224
|
|--------|----------|
|
|
218
|
-
| `+
|
|
219
|
-
| `+
|
|
220
|
-
| `+
|
|
221
|
-
| `+
|
|
222
|
-
| `+
|
|
225
|
+
| `+15005550000` | Success (instant) |
|
|
226
|
+
| `+15005550001` | Fails: invalid_number |
|
|
227
|
+
| `+15005550002` | Fails: unroutable_destination |
|
|
228
|
+
| `+15005550003` | Fails: queue_full |
|
|
229
|
+
| `+15005550004` | Fails: rate_limit_exceeded |
|
|
230
|
+
| `+15005550006` | Fails: carrier_violation |
|
|
223
231
|
|
|
224
232
|
## Pricing Tiers
|
|
225
233
|
|
package/dist/index.d.mts
CHANGED
|
@@ -440,7 +440,7 @@ interface BatchListResponse {
|
|
|
440
440
|
/**
|
|
441
441
|
* Error codes returned by the Sendly API
|
|
442
442
|
*/
|
|
443
|
-
type SendlyErrorCode = "invalid_request" | "unauthorized" | "invalid_auth_format" | "invalid_key_format" | "invalid_api_key" | "key_revoked" | "key_expired" | "insufficient_permissions" | "insufficient_credits" | "unsupported_destination" | "not_found" | "rate_limit_exceeded" | "internal_error";
|
|
443
|
+
type SendlyErrorCode = "invalid_request" | "unauthorized" | "invalid_auth_format" | "invalid_key_format" | "invalid_api_key" | "api_key_required" | "key_revoked" | "key_expired" | "insufficient_permissions" | "insufficient_credits" | "unsupported_destination" | "not_found" | "rate_limit_exceeded" | "internal_error";
|
|
444
444
|
/**
|
|
445
445
|
* Error response from the Sendly API
|
|
446
446
|
*/
|
|
@@ -755,19 +755,22 @@ interface ApiKey {
|
|
|
755
755
|
isRevoked: boolean;
|
|
756
756
|
}
|
|
757
757
|
/**
|
|
758
|
-
* Test phone numbers for sandbox mode
|
|
758
|
+
* Test phone numbers for sandbox mode.
|
|
759
|
+
* Use these with test API keys (sk_test_*) to simulate different scenarios.
|
|
759
760
|
*/
|
|
760
761
|
declare const SANDBOX_TEST_NUMBERS: {
|
|
761
|
-
/** Always succeeds
|
|
762
|
-
readonly SUCCESS: "+
|
|
763
|
-
/** Succeeds after 10 second delay */
|
|
764
|
-
readonly DELAYED: "+15550001010";
|
|
762
|
+
/** Always succeeds - any number not in error list succeeds */
|
|
763
|
+
readonly SUCCESS: "+15005550000";
|
|
765
764
|
/** Fails with invalid_number error */
|
|
766
|
-
readonly INVALID: "+
|
|
767
|
-
/** Fails with
|
|
768
|
-
readonly
|
|
765
|
+
readonly INVALID: "+15005550001";
|
|
766
|
+
/** Fails with unroutable destination error */
|
|
767
|
+
readonly UNROUTABLE: "+15005550002";
|
|
768
|
+
/** Fails with queue_full error */
|
|
769
|
+
readonly QUEUE_FULL: "+15005550003";
|
|
769
770
|
/** Fails with rate_limit_exceeded error */
|
|
770
|
-
readonly RATE_LIMITED: "+
|
|
771
|
+
readonly RATE_LIMITED: "+15005550004";
|
|
772
|
+
/** Fails with carrier_violation error */
|
|
773
|
+
readonly CARRIER_VIOLATION: "+15005550006";
|
|
771
774
|
};
|
|
772
775
|
|
|
773
776
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -440,7 +440,7 @@ interface BatchListResponse {
|
|
|
440
440
|
/**
|
|
441
441
|
* Error codes returned by the Sendly API
|
|
442
442
|
*/
|
|
443
|
-
type SendlyErrorCode = "invalid_request" | "unauthorized" | "invalid_auth_format" | "invalid_key_format" | "invalid_api_key" | "key_revoked" | "key_expired" | "insufficient_permissions" | "insufficient_credits" | "unsupported_destination" | "not_found" | "rate_limit_exceeded" | "internal_error";
|
|
443
|
+
type SendlyErrorCode = "invalid_request" | "unauthorized" | "invalid_auth_format" | "invalid_key_format" | "invalid_api_key" | "api_key_required" | "key_revoked" | "key_expired" | "insufficient_permissions" | "insufficient_credits" | "unsupported_destination" | "not_found" | "rate_limit_exceeded" | "internal_error";
|
|
444
444
|
/**
|
|
445
445
|
* Error response from the Sendly API
|
|
446
446
|
*/
|
|
@@ -755,19 +755,22 @@ interface ApiKey {
|
|
|
755
755
|
isRevoked: boolean;
|
|
756
756
|
}
|
|
757
757
|
/**
|
|
758
|
-
* Test phone numbers for sandbox mode
|
|
758
|
+
* Test phone numbers for sandbox mode.
|
|
759
|
+
* Use these with test API keys (sk_test_*) to simulate different scenarios.
|
|
759
760
|
*/
|
|
760
761
|
declare const SANDBOX_TEST_NUMBERS: {
|
|
761
|
-
/** Always succeeds
|
|
762
|
-
readonly SUCCESS: "+
|
|
763
|
-
/** Succeeds after 10 second delay */
|
|
764
|
-
readonly DELAYED: "+15550001010";
|
|
762
|
+
/** Always succeeds - any number not in error list succeeds */
|
|
763
|
+
readonly SUCCESS: "+15005550000";
|
|
765
764
|
/** Fails with invalid_number error */
|
|
766
|
-
readonly INVALID: "+
|
|
767
|
-
/** Fails with
|
|
768
|
-
readonly
|
|
765
|
+
readonly INVALID: "+15005550001";
|
|
766
|
+
/** Fails with unroutable destination error */
|
|
767
|
+
readonly UNROUTABLE: "+15005550002";
|
|
768
|
+
/** Fails with queue_full error */
|
|
769
|
+
readonly QUEUE_FULL: "+15005550003";
|
|
769
770
|
/** Fails with rate_limit_exceeded error */
|
|
770
|
-
readonly RATE_LIMITED: "+
|
|
771
|
+
readonly RATE_LIMITED: "+15005550004";
|
|
772
|
+
/** Fails with carrier_violation error */
|
|
773
|
+
readonly CARRIER_VIOLATION: "+15005550006";
|
|
771
774
|
};
|
|
772
775
|
|
|
773
776
|
/**
|
package/dist/index.js
CHANGED
|
@@ -93,6 +93,7 @@ var SendlyError = class _SendlyError extends Error {
|
|
|
93
93
|
case "invalid_auth_format":
|
|
94
94
|
case "invalid_key_format":
|
|
95
95
|
case "invalid_api_key":
|
|
96
|
+
case "api_key_required":
|
|
96
97
|
case "key_revoked":
|
|
97
98
|
case "key_expired":
|
|
98
99
|
case "insufficient_permissions":
|
|
@@ -440,16 +441,18 @@ var SUPPORTED_COUNTRIES = {
|
|
|
440
441
|
};
|
|
441
442
|
var ALL_SUPPORTED_COUNTRIES = Object.values(SUPPORTED_COUNTRIES).flat();
|
|
442
443
|
var SANDBOX_TEST_NUMBERS = {
|
|
443
|
-
/** Always succeeds
|
|
444
|
-
SUCCESS: "+
|
|
445
|
-
/** Succeeds after 10 second delay */
|
|
446
|
-
DELAYED: "+15550001010",
|
|
444
|
+
/** Always succeeds - any number not in error list succeeds */
|
|
445
|
+
SUCCESS: "+15005550000",
|
|
447
446
|
/** Fails with invalid_number error */
|
|
448
|
-
INVALID: "+
|
|
449
|
-
/** Fails with
|
|
450
|
-
|
|
447
|
+
INVALID: "+15005550001",
|
|
448
|
+
/** Fails with unroutable destination error */
|
|
449
|
+
UNROUTABLE: "+15005550002",
|
|
450
|
+
/** Fails with queue_full error */
|
|
451
|
+
QUEUE_FULL: "+15005550003",
|
|
451
452
|
/** Fails with rate_limit_exceeded error */
|
|
452
|
-
RATE_LIMITED: "+
|
|
453
|
+
RATE_LIMITED: "+15005550004",
|
|
454
|
+
/** Fails with carrier_violation error */
|
|
455
|
+
CARRIER_VIOLATION: "+15005550006"
|
|
453
456
|
};
|
|
454
457
|
|
|
455
458
|
// src/utils/validation.ts
|
package/dist/index.mjs
CHANGED
|
@@ -33,6 +33,7 @@ var SendlyError = class _SendlyError extends Error {
|
|
|
33
33
|
case "invalid_auth_format":
|
|
34
34
|
case "invalid_key_format":
|
|
35
35
|
case "invalid_api_key":
|
|
36
|
+
case "api_key_required":
|
|
36
37
|
case "key_revoked":
|
|
37
38
|
case "key_expired":
|
|
38
39
|
case "insufficient_permissions":
|
|
@@ -380,16 +381,18 @@ var SUPPORTED_COUNTRIES = {
|
|
|
380
381
|
};
|
|
381
382
|
var ALL_SUPPORTED_COUNTRIES = Object.values(SUPPORTED_COUNTRIES).flat();
|
|
382
383
|
var SANDBOX_TEST_NUMBERS = {
|
|
383
|
-
/** Always succeeds
|
|
384
|
-
SUCCESS: "+
|
|
385
|
-
/** Succeeds after 10 second delay */
|
|
386
|
-
DELAYED: "+15550001010",
|
|
384
|
+
/** Always succeeds - any number not in error list succeeds */
|
|
385
|
+
SUCCESS: "+15005550000",
|
|
387
386
|
/** Fails with invalid_number error */
|
|
388
|
-
INVALID: "+
|
|
389
|
-
/** Fails with
|
|
390
|
-
|
|
387
|
+
INVALID: "+15005550001",
|
|
388
|
+
/** Fails with unroutable destination error */
|
|
389
|
+
UNROUTABLE: "+15005550002",
|
|
390
|
+
/** Fails with queue_full error */
|
|
391
|
+
QUEUE_FULL: "+15005550003",
|
|
391
392
|
/** Fails with rate_limit_exceeded error */
|
|
392
|
-
RATE_LIMITED: "+
|
|
393
|
+
RATE_LIMITED: "+15005550004",
|
|
394
|
+
/** Fails with carrier_violation error */
|
|
395
|
+
CARRIER_VIOLATION: "+15005550006"
|
|
393
396
|
};
|
|
394
397
|
|
|
395
398
|
// src/utils/validation.ts
|