@sendly/node 3.17.0 → 3.18.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/README.md +114 -1
- package/dist/index.d.mts +595 -1
- package/dist/index.d.ts +595 -1
- package/dist/index.js +593 -2
- package/dist/index.mjs +593 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -420,7 +420,7 @@ await sendly.messages.send({
|
|
|
420
420
|
import { CREDITS_PER_SMS, SUPPORTED_COUNTRIES } from '@sendly/node';
|
|
421
421
|
|
|
422
422
|
// Credits per SMS by tier
|
|
423
|
-
console.log(CREDITS_PER_SMS.domestic); //
|
|
423
|
+
console.log(CREDITS_PER_SMS.domestic); // 2 (US/Canada)
|
|
424
424
|
console.log(CREDITS_PER_SMS.tier1); // 8 (UK, Poland, India, etc.)
|
|
425
425
|
console.log(CREDITS_PER_SMS.tier2); // 12 (France, Japan, Australia, etc.)
|
|
426
426
|
console.log(CREDITS_PER_SMS.tier3); // 16 (Germany, Italy, Mexico, etc.)
|
|
@@ -605,6 +605,119 @@ Get an API key by ID.
|
|
|
605
605
|
|
|
606
606
|
Get usage statistics for an API key.
|
|
607
607
|
|
|
608
|
+
## Enterprise
|
|
609
|
+
|
|
610
|
+
The Enterprise API lets you programmatically manage workspaces, verification, credits, and API keys for multi-tenant platforms. Requires an enterprise master key (`sk_live_v1_master_*`).
|
|
611
|
+
|
|
612
|
+
### Quick Provision
|
|
613
|
+
|
|
614
|
+
Create a fully configured workspace in a single call:
|
|
615
|
+
|
|
616
|
+
```typescript
|
|
617
|
+
const client = new Sendly('sk_live_v1_master_YOUR_KEY');
|
|
618
|
+
|
|
619
|
+
// Inherit verification from an existing workspace (fastest)
|
|
620
|
+
const result = await client.enterprise.provision({
|
|
621
|
+
name: 'Acme Insurance - Austin',
|
|
622
|
+
sourceWorkspaceId: 'ws_verified',
|
|
623
|
+
creditAmount: 5000,
|
|
624
|
+
creditSourceWorkspaceId: 'ws_pool',
|
|
625
|
+
keyName: 'Production',
|
|
626
|
+
keyType: 'live',
|
|
627
|
+
generateOptInPage: true
|
|
628
|
+
});
|
|
629
|
+
|
|
630
|
+
console.log(result.workspace.id);
|
|
631
|
+
console.log(result.apiKey?.rawKey); // shown once
|
|
632
|
+
console.log(result.optInPage?.url); // hosted opt-in page
|
|
633
|
+
```
|
|
634
|
+
|
|
635
|
+
Three provisioning modes:
|
|
636
|
+
|
|
637
|
+
| Mode | Params | Description |
|
|
638
|
+
|------|--------|-------------|
|
|
639
|
+
| **Inherit** | `sourceWorkspaceId` | Shares toll-free number from verified workspace |
|
|
640
|
+
| **Inherit + New Number** | `sourceWorkspaceId` + `inheritWithNewNumber: true` | Copies business info, purchases new number |
|
|
641
|
+
| **Fresh** | `verification: { ... }` | Full business details, new number + carrier approval |
|
|
642
|
+
|
|
643
|
+
### Workspace Management
|
|
644
|
+
|
|
645
|
+
```typescript
|
|
646
|
+
// Create
|
|
647
|
+
const ws = await client.enterprise.workspaces.create({ name: 'Acme Insurance' });
|
|
648
|
+
|
|
649
|
+
// List
|
|
650
|
+
const { workspaces } = await client.enterprise.workspaces.list();
|
|
651
|
+
|
|
652
|
+
// Get details
|
|
653
|
+
const detail = await client.enterprise.workspaces.get('ws_xxx');
|
|
654
|
+
|
|
655
|
+
// Delete
|
|
656
|
+
await client.enterprise.workspaces.delete('ws_xxx');
|
|
657
|
+
```
|
|
658
|
+
|
|
659
|
+
### Verification
|
|
660
|
+
|
|
661
|
+
```typescript
|
|
662
|
+
// Submit full verification
|
|
663
|
+
await client.enterprise.workspaces.submitVerification('ws_xxx', {
|
|
664
|
+
businessName: 'Acme Insurance LLC',
|
|
665
|
+
businessType: 'llc',
|
|
666
|
+
ein: '12-3456789',
|
|
667
|
+
address: '100 Main St',
|
|
668
|
+
city: 'Austin',
|
|
669
|
+
state: 'TX',
|
|
670
|
+
zip: '78701',
|
|
671
|
+
useCase: 'Policy renewal reminders',
|
|
672
|
+
sampleMessages: ['Your policy renews on 3/15.']
|
|
673
|
+
});
|
|
674
|
+
|
|
675
|
+
// Inherit from verified workspace
|
|
676
|
+
await client.enterprise.workspaces.inheritVerification('ws_new', {
|
|
677
|
+
sourceWorkspaceId: 'ws_verified'
|
|
678
|
+
});
|
|
679
|
+
|
|
680
|
+
// Inherit with new number
|
|
681
|
+
await client.enterprise.workspaces.inheritVerification('ws_new', {
|
|
682
|
+
sourceWorkspaceId: 'ws_verified',
|
|
683
|
+
purchaseNewNumber: true
|
|
684
|
+
});
|
|
685
|
+
```
|
|
686
|
+
|
|
687
|
+
### Credits & API Keys
|
|
688
|
+
|
|
689
|
+
```typescript
|
|
690
|
+
// Transfer credits
|
|
691
|
+
await client.enterprise.workspaces.transferCredits('ws_dest', {
|
|
692
|
+
sourceWorkspaceId: 'ws_source',
|
|
693
|
+
amount: 5000
|
|
694
|
+
});
|
|
695
|
+
|
|
696
|
+
// Create workspace API key
|
|
697
|
+
const key = await client.enterprise.workspaces.createKey('ws_xxx', {
|
|
698
|
+
name: 'Production',
|
|
699
|
+
type: 'live'
|
|
700
|
+
});
|
|
701
|
+
console.log(key.rawKey); // shown once
|
|
702
|
+
|
|
703
|
+
// Revoke a key
|
|
704
|
+
await client.enterprise.workspaces.revokeKey('ws_xxx', 'key_abc');
|
|
705
|
+
```
|
|
706
|
+
|
|
707
|
+
### Webhooks & Analytics
|
|
708
|
+
|
|
709
|
+
```typescript
|
|
710
|
+
// Set enterprise webhook
|
|
711
|
+
await client.enterprise.webhooks.set({ url: 'https://yourapp.com/webhooks' });
|
|
712
|
+
|
|
713
|
+
// Analytics
|
|
714
|
+
const overview = await client.enterprise.analytics.overview();
|
|
715
|
+
const messages = await client.enterprise.analytics.messages({ period: '30d' });
|
|
716
|
+
const delivery = await client.enterprise.analytics.delivery();
|
|
717
|
+
```
|
|
718
|
+
|
|
719
|
+
Full enterprise docs: [sendly.live/docs/enterprise](https://sendly.live/docs/enterprise)
|
|
720
|
+
|
|
608
721
|
## Support
|
|
609
722
|
|
|
610
723
|
- 📚 [Documentation](https://sendly.live/docs)
|