@sendly/node 3.18.0 → 3.19.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/README.md +114 -1
- package/dist/index.d.mts +496 -1
- package/dist/index.d.ts +496 -1
- package/dist/index.js +507 -3
- package/dist/index.mjs +507 -3
- 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)
|
package/dist/index.d.mts
CHANGED
|
@@ -25,6 +25,7 @@ interface SendlyConfig {
|
|
|
25
25
|
* @default 3
|
|
26
26
|
*/
|
|
27
27
|
maxRetries?: number;
|
|
28
|
+
organizationId?: string;
|
|
28
29
|
}
|
|
29
30
|
/**
|
|
30
31
|
* Message type for compliance classification
|
|
@@ -1504,6 +1505,366 @@ interface ImportContactsResponse {
|
|
|
1504
1505
|
errors: ImportContactsError[];
|
|
1505
1506
|
totalErrors: number;
|
|
1506
1507
|
}
|
|
1508
|
+
interface EnterpriseAccount {
|
|
1509
|
+
id: string;
|
|
1510
|
+
maxWorkspaces: number;
|
|
1511
|
+
workspaceCount: number;
|
|
1512
|
+
workspaces: EnterpriseWorkspaceSummary[];
|
|
1513
|
+
metadata: Record<string, unknown>;
|
|
1514
|
+
}
|
|
1515
|
+
interface EnterpriseWorkspaceSummary {
|
|
1516
|
+
id: string;
|
|
1517
|
+
name: string;
|
|
1518
|
+
slug: string;
|
|
1519
|
+
verificationStatus: string | null;
|
|
1520
|
+
verificationType: string | null;
|
|
1521
|
+
tollFreeNumber: string | null;
|
|
1522
|
+
creditBalance: number;
|
|
1523
|
+
}
|
|
1524
|
+
interface EnterpriseWorkspace {
|
|
1525
|
+
id: string;
|
|
1526
|
+
name: string;
|
|
1527
|
+
slug: string;
|
|
1528
|
+
verificationStatus: string | null;
|
|
1529
|
+
verificationType: string | null;
|
|
1530
|
+
tollFreeNumber: string | null;
|
|
1531
|
+
creditBalance: number;
|
|
1532
|
+
keyCount: number;
|
|
1533
|
+
messages30d: number;
|
|
1534
|
+
delivered30d: number;
|
|
1535
|
+
failed30d: number;
|
|
1536
|
+
createdAt: string;
|
|
1537
|
+
}
|
|
1538
|
+
interface EnterpriseWorkspaceDetail {
|
|
1539
|
+
id: string;
|
|
1540
|
+
name: string;
|
|
1541
|
+
slug: string;
|
|
1542
|
+
verificationStatus: string | null;
|
|
1543
|
+
tollFreeNumber: string | null;
|
|
1544
|
+
businessName: string | null;
|
|
1545
|
+
creditBalance: number;
|
|
1546
|
+
keys: Array<{
|
|
1547
|
+
id: string;
|
|
1548
|
+
name: string;
|
|
1549
|
+
keyPrefix: string;
|
|
1550
|
+
createdAt: string;
|
|
1551
|
+
lastUsedAt: string | null;
|
|
1552
|
+
}>;
|
|
1553
|
+
messages30d: number;
|
|
1554
|
+
delivered30d: number;
|
|
1555
|
+
failed30d: number;
|
|
1556
|
+
deliveryRate: number;
|
|
1557
|
+
}
|
|
1558
|
+
interface CreateWorkspaceOptions {
|
|
1559
|
+
name: string;
|
|
1560
|
+
description?: string;
|
|
1561
|
+
}
|
|
1562
|
+
interface ProvisionWorkspaceOptions {
|
|
1563
|
+
name: string;
|
|
1564
|
+
sourceWorkspaceId?: string;
|
|
1565
|
+
inheritWithNewNumber?: boolean;
|
|
1566
|
+
verification?: {
|
|
1567
|
+
businessName: string;
|
|
1568
|
+
website: string;
|
|
1569
|
+
address: {
|
|
1570
|
+
street: string;
|
|
1571
|
+
city: string;
|
|
1572
|
+
state: string;
|
|
1573
|
+
zip: string;
|
|
1574
|
+
country?: string;
|
|
1575
|
+
};
|
|
1576
|
+
contact: {
|
|
1577
|
+
firstName: string;
|
|
1578
|
+
lastName: string;
|
|
1579
|
+
email: string;
|
|
1580
|
+
phone: string;
|
|
1581
|
+
};
|
|
1582
|
+
brn?: string;
|
|
1583
|
+
brnType?: string;
|
|
1584
|
+
brnCountry?: string;
|
|
1585
|
+
useCase: string;
|
|
1586
|
+
useCaseSummary: string;
|
|
1587
|
+
sampleMessages: string;
|
|
1588
|
+
optInWorkflow: string;
|
|
1589
|
+
optInImageUrls?: string;
|
|
1590
|
+
monthlyVolume?: string;
|
|
1591
|
+
};
|
|
1592
|
+
creditAmount?: number;
|
|
1593
|
+
creditSourceWorkspaceId?: string;
|
|
1594
|
+
keyName?: string;
|
|
1595
|
+
keyType?: "test" | "live";
|
|
1596
|
+
webhookUrl?: string;
|
|
1597
|
+
generateOptInPage?: boolean;
|
|
1598
|
+
}
|
|
1599
|
+
interface ProvisionWorkspaceResult {
|
|
1600
|
+
workspace: {
|
|
1601
|
+
id: string;
|
|
1602
|
+
name: string;
|
|
1603
|
+
slug: string;
|
|
1604
|
+
};
|
|
1605
|
+
verification?: {
|
|
1606
|
+
id: string;
|
|
1607
|
+
status: string;
|
|
1608
|
+
type: string;
|
|
1609
|
+
tollFreeNumber: string | null;
|
|
1610
|
+
inherited?: boolean;
|
|
1611
|
+
newNumber?: boolean;
|
|
1612
|
+
};
|
|
1613
|
+
credits?: {
|
|
1614
|
+
balance: number;
|
|
1615
|
+
transferred?: number;
|
|
1616
|
+
};
|
|
1617
|
+
apiKey?: {
|
|
1618
|
+
id: string;
|
|
1619
|
+
name: string;
|
|
1620
|
+
prefix: string;
|
|
1621
|
+
key?: string;
|
|
1622
|
+
};
|
|
1623
|
+
optInPage?: {
|
|
1624
|
+
url: string;
|
|
1625
|
+
slug: string;
|
|
1626
|
+
pageId: string;
|
|
1627
|
+
};
|
|
1628
|
+
legalPages?: {
|
|
1629
|
+
privacyUrl?: string;
|
|
1630
|
+
termsUrl?: string;
|
|
1631
|
+
};
|
|
1632
|
+
webhook?: {
|
|
1633
|
+
id: string;
|
|
1634
|
+
url: string;
|
|
1635
|
+
};
|
|
1636
|
+
apiBaseUrl?: string;
|
|
1637
|
+
dashboardUrl?: string;
|
|
1638
|
+
}
|
|
1639
|
+
interface TransferCreditsOptions {
|
|
1640
|
+
sourceWorkspaceId: string;
|
|
1641
|
+
amount: number;
|
|
1642
|
+
}
|
|
1643
|
+
interface TransferCreditsResult {
|
|
1644
|
+
success: boolean;
|
|
1645
|
+
sourceBalance: number;
|
|
1646
|
+
targetBalance: number;
|
|
1647
|
+
}
|
|
1648
|
+
interface CreateKeyOptions {
|
|
1649
|
+
name?: string;
|
|
1650
|
+
type?: "live" | "test";
|
|
1651
|
+
}
|
|
1652
|
+
interface CreatedApiKey {
|
|
1653
|
+
id: string;
|
|
1654
|
+
name: string;
|
|
1655
|
+
key: string;
|
|
1656
|
+
keyPrefix: string;
|
|
1657
|
+
createdAt: string;
|
|
1658
|
+
}
|
|
1659
|
+
interface WorkspaceCredits {
|
|
1660
|
+
balance: number;
|
|
1661
|
+
lifetimeCredits: number;
|
|
1662
|
+
}
|
|
1663
|
+
interface EnterpriseWebhook {
|
|
1664
|
+
url: string;
|
|
1665
|
+
}
|
|
1666
|
+
interface EnterpriseWebhookTestResult {
|
|
1667
|
+
success: boolean;
|
|
1668
|
+
statusCode?: number;
|
|
1669
|
+
statusText?: string;
|
|
1670
|
+
error?: string;
|
|
1671
|
+
}
|
|
1672
|
+
interface AnalyticsOverview {
|
|
1673
|
+
totalMessages: number;
|
|
1674
|
+
deliveredMessages: number;
|
|
1675
|
+
failedMessages: number;
|
|
1676
|
+
deliveryRate: number;
|
|
1677
|
+
totalCreditsUsed: number;
|
|
1678
|
+
activeWorkspaces: number;
|
|
1679
|
+
}
|
|
1680
|
+
interface MessageAnalyticsDataPoint {
|
|
1681
|
+
date: string;
|
|
1682
|
+
sent: number;
|
|
1683
|
+
delivered: number;
|
|
1684
|
+
failed: number;
|
|
1685
|
+
}
|
|
1686
|
+
interface MessageAnalytics {
|
|
1687
|
+
period: string;
|
|
1688
|
+
data: MessageAnalyticsDataPoint[];
|
|
1689
|
+
}
|
|
1690
|
+
interface DeliveryAnalyticsItem {
|
|
1691
|
+
workspaceId: string;
|
|
1692
|
+
name: string;
|
|
1693
|
+
sent: number;
|
|
1694
|
+
delivered: number;
|
|
1695
|
+
failed: number;
|
|
1696
|
+
rate: number;
|
|
1697
|
+
}
|
|
1698
|
+
interface CreditAnalyticsDataPoint {
|
|
1699
|
+
date: string;
|
|
1700
|
+
used: number;
|
|
1701
|
+
transferred: number;
|
|
1702
|
+
purchased: number;
|
|
1703
|
+
}
|
|
1704
|
+
interface CreditAnalytics {
|
|
1705
|
+
period: string;
|
|
1706
|
+
data: CreditAnalyticsDataPoint[];
|
|
1707
|
+
}
|
|
1708
|
+
type AnalyticsPeriod = "7d" | "30d" | "90d";
|
|
1709
|
+
interface OptInPage {
|
|
1710
|
+
id: string;
|
|
1711
|
+
slug: string;
|
|
1712
|
+
url: string;
|
|
1713
|
+
businessName: string;
|
|
1714
|
+
useCase: string | null;
|
|
1715
|
+
isActive: boolean;
|
|
1716
|
+
viewCount: number;
|
|
1717
|
+
logoUrl: string | null;
|
|
1718
|
+
headerColor: string | null;
|
|
1719
|
+
buttonColor: string | null;
|
|
1720
|
+
customHeadline: string | null;
|
|
1721
|
+
createdAt: string;
|
|
1722
|
+
}
|
|
1723
|
+
interface CreateOptInPageOptions {
|
|
1724
|
+
businessName: string;
|
|
1725
|
+
useCase?: string;
|
|
1726
|
+
useCaseSummary?: string;
|
|
1727
|
+
sampleMessages?: string;
|
|
1728
|
+
}
|
|
1729
|
+
interface CreateOptInPageResult {
|
|
1730
|
+
id: string;
|
|
1731
|
+
slug: string;
|
|
1732
|
+
url: string;
|
|
1733
|
+
businessName: string;
|
|
1734
|
+
}
|
|
1735
|
+
interface UpdateOptInPageOptions {
|
|
1736
|
+
logoUrl?: string;
|
|
1737
|
+
headerColor?: string;
|
|
1738
|
+
buttonColor?: string;
|
|
1739
|
+
customHeadline?: string;
|
|
1740
|
+
customBenefits?: string[];
|
|
1741
|
+
}
|
|
1742
|
+
interface WorkspaceWebhook {
|
|
1743
|
+
id: string;
|
|
1744
|
+
url: string;
|
|
1745
|
+
events: string[];
|
|
1746
|
+
isActive: boolean;
|
|
1747
|
+
createdAt: string;
|
|
1748
|
+
}
|
|
1749
|
+
interface SetWorkspaceWebhookOptions {
|
|
1750
|
+
url: string;
|
|
1751
|
+
events?: string[];
|
|
1752
|
+
description?: string;
|
|
1753
|
+
}
|
|
1754
|
+
interface SetWorkspaceWebhookResult {
|
|
1755
|
+
id: string;
|
|
1756
|
+
url: string;
|
|
1757
|
+
events: string[];
|
|
1758
|
+
secret?: string;
|
|
1759
|
+
created?: boolean;
|
|
1760
|
+
updated?: boolean;
|
|
1761
|
+
}
|
|
1762
|
+
interface SuspendWorkspaceOptions {
|
|
1763
|
+
reason?: string;
|
|
1764
|
+
}
|
|
1765
|
+
interface SuspendWorkspaceResult {
|
|
1766
|
+
id: string;
|
|
1767
|
+
status: string;
|
|
1768
|
+
suspendedAt: string;
|
|
1769
|
+
}
|
|
1770
|
+
interface ResumeWorkspaceResult {
|
|
1771
|
+
id: string;
|
|
1772
|
+
status: string;
|
|
1773
|
+
}
|
|
1774
|
+
interface AutoTopUpSettings {
|
|
1775
|
+
enabled: boolean;
|
|
1776
|
+
threshold: number;
|
|
1777
|
+
amount: number;
|
|
1778
|
+
sourceWorkspaceId: string | null;
|
|
1779
|
+
}
|
|
1780
|
+
interface UpdateAutoTopUpOptions {
|
|
1781
|
+
enabled: boolean;
|
|
1782
|
+
threshold: number;
|
|
1783
|
+
amount: number;
|
|
1784
|
+
sourceWorkspaceId?: string | null;
|
|
1785
|
+
}
|
|
1786
|
+
interface BillingBreakdownOptions {
|
|
1787
|
+
period?: AnalyticsPeriod;
|
|
1788
|
+
page?: number;
|
|
1789
|
+
limit?: number;
|
|
1790
|
+
}
|
|
1791
|
+
interface WorkspaceBillingItem {
|
|
1792
|
+
id: string;
|
|
1793
|
+
name: string;
|
|
1794
|
+
creditsUsed: number;
|
|
1795
|
+
creditsPurchased: number;
|
|
1796
|
+
creditsTransferredIn: number;
|
|
1797
|
+
creditsTransferredOut: number;
|
|
1798
|
+
messagesSent: number;
|
|
1799
|
+
messagesDelivered: number;
|
|
1800
|
+
workspaceFee: number;
|
|
1801
|
+
allocatedPlatformFee: number;
|
|
1802
|
+
totalCost: number;
|
|
1803
|
+
}
|
|
1804
|
+
interface BillingBreakdown {
|
|
1805
|
+
period: string;
|
|
1806
|
+
summary: {
|
|
1807
|
+
platformFee: number;
|
|
1808
|
+
totalWorkspaceFees: number;
|
|
1809
|
+
totalCreditsUsed: number;
|
|
1810
|
+
totalCost: number;
|
|
1811
|
+
};
|
|
1812
|
+
workspaces: WorkspaceBillingItem[];
|
|
1813
|
+
}
|
|
1814
|
+
interface BulkProvisionWorkspace {
|
|
1815
|
+
name: string;
|
|
1816
|
+
sourceWorkspaceId?: string;
|
|
1817
|
+
creditAmount?: number;
|
|
1818
|
+
creditSourceWorkspaceId?: string;
|
|
1819
|
+
}
|
|
1820
|
+
interface BulkProvisionResultItem {
|
|
1821
|
+
name: string;
|
|
1822
|
+
status: "success" | "partial" | "failed";
|
|
1823
|
+
workspaceId?: string;
|
|
1824
|
+
slug?: string;
|
|
1825
|
+
warning?: string;
|
|
1826
|
+
error?: string;
|
|
1827
|
+
}
|
|
1828
|
+
interface BulkProvisionResult {
|
|
1829
|
+
results: BulkProvisionResultItem[];
|
|
1830
|
+
summary: {
|
|
1831
|
+
total: number;
|
|
1832
|
+
succeeded: number;
|
|
1833
|
+
failed: number;
|
|
1834
|
+
};
|
|
1835
|
+
}
|
|
1836
|
+
interface DnsRecord {
|
|
1837
|
+
type: string;
|
|
1838
|
+
name: string;
|
|
1839
|
+
value: string;
|
|
1840
|
+
}
|
|
1841
|
+
interface SetCustomDomainResult {
|
|
1842
|
+
domain: string;
|
|
1843
|
+
verified: boolean;
|
|
1844
|
+
dnsInstructions: {
|
|
1845
|
+
cname: DnsRecord;
|
|
1846
|
+
txt: DnsRecord;
|
|
1847
|
+
};
|
|
1848
|
+
}
|
|
1849
|
+
interface SendInvitationOptions {
|
|
1850
|
+
email: string;
|
|
1851
|
+
role: "admin" | "member" | "viewer";
|
|
1852
|
+
}
|
|
1853
|
+
interface Invitation {
|
|
1854
|
+
id: string;
|
|
1855
|
+
email: string;
|
|
1856
|
+
role: string;
|
|
1857
|
+
status: string;
|
|
1858
|
+
expiresAt: string;
|
|
1859
|
+
}
|
|
1860
|
+
interface QuotaSettings {
|
|
1861
|
+
monthlyMessageQuota: number | null;
|
|
1862
|
+
messagesThisMonth: number;
|
|
1863
|
+
quotaResetAt: string | null;
|
|
1864
|
+
}
|
|
1865
|
+
interface UpdateQuotaOptions {
|
|
1866
|
+
monthlyMessageQuota: number | null;
|
|
1867
|
+
}
|
|
1507
1868
|
|
|
1508
1869
|
/**
|
|
1509
1870
|
* HTTP Client Utility
|
|
@@ -1515,6 +1876,7 @@ interface HttpClientConfig {
|
|
|
1515
1876
|
baseUrl: string;
|
|
1516
1877
|
timeout: number;
|
|
1517
1878
|
maxRetries: number;
|
|
1879
|
+
organizationId?: string;
|
|
1518
1880
|
}
|
|
1519
1881
|
/**
|
|
1520
1882
|
* HTTP client for making API requests
|
|
@@ -1522,6 +1884,7 @@ interface HttpClientConfig {
|
|
|
1522
1884
|
declare class HttpClient {
|
|
1523
1885
|
private readonly config;
|
|
1524
1886
|
private rateLimitInfo?;
|
|
1887
|
+
organizationId?: string;
|
|
1525
1888
|
constructor(config: Partial<HttpClientConfig> & {
|
|
1526
1889
|
apiKey: string;
|
|
1527
1890
|
});
|
|
@@ -3050,6 +3413,121 @@ declare class MediaResource {
|
|
|
3050
3413
|
upload(file: Buffer | NodeJS.ReadableStream, options?: MediaUploadOptions): Promise<MediaFile>;
|
|
3051
3414
|
}
|
|
3052
3415
|
|
|
3416
|
+
declare class WorkspacesSubResource {
|
|
3417
|
+
private readonly http;
|
|
3418
|
+
constructor(http: HttpClient);
|
|
3419
|
+
create(options: CreateWorkspaceOptions): Promise<EnterpriseWorkspace>;
|
|
3420
|
+
list(): Promise<{
|
|
3421
|
+
workspaces: EnterpriseWorkspace[];
|
|
3422
|
+
maxWorkspaces: number;
|
|
3423
|
+
workspacesUsed: number;
|
|
3424
|
+
pagination?: {
|
|
3425
|
+
page: number;
|
|
3426
|
+
limit: number;
|
|
3427
|
+
total: number;
|
|
3428
|
+
totalPages: number;
|
|
3429
|
+
};
|
|
3430
|
+
summary?: {
|
|
3431
|
+
totalCredits: number;
|
|
3432
|
+
totalMessages30d: number;
|
|
3433
|
+
verified: number;
|
|
3434
|
+
pending: number;
|
|
3435
|
+
unverified: number;
|
|
3436
|
+
};
|
|
3437
|
+
}>;
|
|
3438
|
+
get(workspaceId: string): Promise<EnterpriseWorkspaceDetail>;
|
|
3439
|
+
delete(workspaceId: string): Promise<void>;
|
|
3440
|
+
submitVerification(workspaceId: string, data: {
|
|
3441
|
+
businessName: string;
|
|
3442
|
+
businessType: string;
|
|
3443
|
+
ein: string;
|
|
3444
|
+
address: string;
|
|
3445
|
+
city: string;
|
|
3446
|
+
state: string;
|
|
3447
|
+
zip: string;
|
|
3448
|
+
useCase: string;
|
|
3449
|
+
sampleMessages: string[];
|
|
3450
|
+
monthlyVolume?: number;
|
|
3451
|
+
}): Promise<unknown>;
|
|
3452
|
+
inheritVerification(workspaceId: string, options: {
|
|
3453
|
+
sourceWorkspaceId: string;
|
|
3454
|
+
}): Promise<unknown>;
|
|
3455
|
+
getVerification(workspaceId: string): Promise<unknown>;
|
|
3456
|
+
transferCredits(workspaceId: string, options: TransferCreditsOptions): Promise<TransferCreditsResult>;
|
|
3457
|
+
getCredits(workspaceId: string): Promise<WorkspaceCredits>;
|
|
3458
|
+
createKey(workspaceId: string, options?: CreateKeyOptions): Promise<CreatedApiKey>;
|
|
3459
|
+
listKeys(workspaceId: string): Promise<Array<{
|
|
3460
|
+
id: string;
|
|
3461
|
+
name: string;
|
|
3462
|
+
keyPrefix: string;
|
|
3463
|
+
createdAt: string;
|
|
3464
|
+
lastUsedAt: string | null;
|
|
3465
|
+
}>>;
|
|
3466
|
+
revokeKey(workspaceId: string, keyId: string): Promise<void>;
|
|
3467
|
+
listOptInPages(workspaceId: string): Promise<OptInPage[]>;
|
|
3468
|
+
createOptInPage(workspaceId: string, options: CreateOptInPageOptions): Promise<CreateOptInPageResult>;
|
|
3469
|
+
updateOptInPage(workspaceId: string, pageId: string, options: UpdateOptInPageOptions): Promise<OptInPage>;
|
|
3470
|
+
deleteOptInPage(workspaceId: string, pageId: string): Promise<void>;
|
|
3471
|
+
setWebhook(workspaceId: string, options: SetWorkspaceWebhookOptions): Promise<SetWorkspaceWebhookResult>;
|
|
3472
|
+
listWebhooks(workspaceId: string): Promise<WorkspaceWebhook[]>;
|
|
3473
|
+
deleteWebhooks(workspaceId: string, webhookId?: string): Promise<void>;
|
|
3474
|
+
testWebhook(workspaceId: string): Promise<EnterpriseWebhookTestResult>;
|
|
3475
|
+
suspend(workspaceId: string, options?: SuspendWorkspaceOptions): Promise<SuspendWorkspaceResult>;
|
|
3476
|
+
resume(workspaceId: string): Promise<ResumeWorkspaceResult>;
|
|
3477
|
+
provisionBulk(workspaces: BulkProvisionWorkspace[]): Promise<BulkProvisionResult>;
|
|
3478
|
+
setCustomDomain(workspaceId: string, pageId: string, domain: string): Promise<SetCustomDomainResult>;
|
|
3479
|
+
sendInvitation(workspaceId: string, options: SendInvitationOptions): Promise<Invitation>;
|
|
3480
|
+
listInvitations(workspaceId: string): Promise<Invitation[]>;
|
|
3481
|
+
cancelInvitation(workspaceId: string, inviteId: string): Promise<void>;
|
|
3482
|
+
getQuota(workspaceId: string): Promise<QuotaSettings>;
|
|
3483
|
+
setQuota(workspaceId: string, options: UpdateQuotaOptions): Promise<QuotaSettings>;
|
|
3484
|
+
}
|
|
3485
|
+
declare class WebhooksSubResource {
|
|
3486
|
+
private readonly http;
|
|
3487
|
+
constructor(http: HttpClient);
|
|
3488
|
+
set(options: {
|
|
3489
|
+
url: string;
|
|
3490
|
+
}): Promise<EnterpriseWebhook>;
|
|
3491
|
+
get(): Promise<EnterpriseWebhook>;
|
|
3492
|
+
delete(): Promise<void>;
|
|
3493
|
+
test(): Promise<EnterpriseWebhookTestResult>;
|
|
3494
|
+
}
|
|
3495
|
+
declare class AnalyticsSubResource {
|
|
3496
|
+
private readonly http;
|
|
3497
|
+
constructor(http: HttpClient);
|
|
3498
|
+
overview(): Promise<AnalyticsOverview>;
|
|
3499
|
+
messages(options?: {
|
|
3500
|
+
period?: AnalyticsPeriod;
|
|
3501
|
+
workspaceId?: string;
|
|
3502
|
+
}): Promise<MessageAnalytics>;
|
|
3503
|
+
delivery(): Promise<DeliveryAnalyticsItem[]>;
|
|
3504
|
+
credits(options?: {
|
|
3505
|
+
period?: AnalyticsPeriod;
|
|
3506
|
+
}): Promise<CreditAnalytics>;
|
|
3507
|
+
}
|
|
3508
|
+
declare class SettingsSubResource {
|
|
3509
|
+
private readonly http;
|
|
3510
|
+
constructor(http: HttpClient);
|
|
3511
|
+
getAutoTopUp(): Promise<AutoTopUpSettings>;
|
|
3512
|
+
updateAutoTopUp(options: UpdateAutoTopUpOptions): Promise<AutoTopUpSettings>;
|
|
3513
|
+
}
|
|
3514
|
+
declare class BillingSubResource {
|
|
3515
|
+
private readonly http;
|
|
3516
|
+
constructor(http: HttpClient);
|
|
3517
|
+
getBreakdown(options?: BillingBreakdownOptions): Promise<BillingBreakdown>;
|
|
3518
|
+
}
|
|
3519
|
+
declare class EnterpriseResource {
|
|
3520
|
+
private readonly http;
|
|
3521
|
+
readonly workspaces: WorkspacesSubResource;
|
|
3522
|
+
readonly webhooks: WebhooksSubResource;
|
|
3523
|
+
readonly analytics: AnalyticsSubResource;
|
|
3524
|
+
readonly settings: SettingsSubResource;
|
|
3525
|
+
readonly billing: BillingSubResource;
|
|
3526
|
+
constructor(http: HttpClient);
|
|
3527
|
+
getAccount(): Promise<EnterpriseAccount>;
|
|
3528
|
+
provision(options: ProvisionWorkspaceOptions): Promise<ProvisionWorkspaceResult>;
|
|
3529
|
+
}
|
|
3530
|
+
|
|
3053
3531
|
/**
|
|
3054
3532
|
* Sendly Client
|
|
3055
3533
|
* @packageDocumentation
|
|
@@ -3240,6 +3718,22 @@ declare class Sendly {
|
|
|
3240
3718
|
* ```
|
|
3241
3719
|
*/
|
|
3242
3720
|
readonly media: MediaResource;
|
|
3721
|
+
/**
|
|
3722
|
+
* Enterprise API resource - Multi-workspace management
|
|
3723
|
+
*
|
|
3724
|
+
* @example
|
|
3725
|
+
* ```typescript
|
|
3726
|
+
* // Get enterprise account
|
|
3727
|
+
* const account = await sendly.enterprise.getAccount();
|
|
3728
|
+
*
|
|
3729
|
+
* // Create a workspace
|
|
3730
|
+
* const workspace = await sendly.enterprise.workspaces.create({ name: 'New Workspace' });
|
|
3731
|
+
*
|
|
3732
|
+
* // Get analytics
|
|
3733
|
+
* const overview = await sendly.enterprise.analytics.overview();
|
|
3734
|
+
* ```
|
|
3735
|
+
*/
|
|
3736
|
+
readonly enterprise: EnterpriseResource;
|
|
3243
3737
|
private readonly http;
|
|
3244
3738
|
private readonly config;
|
|
3245
3739
|
/**
|
|
@@ -3284,6 +3778,7 @@ declare class Sendly {
|
|
|
3284
3778
|
* Get the configured base URL
|
|
3285
3779
|
*/
|
|
3286
3780
|
getBaseUrl(): string;
|
|
3781
|
+
setOrganizationId(id: string): void;
|
|
3287
3782
|
}
|
|
3288
3783
|
|
|
3289
3784
|
/**
|
|
@@ -3690,4 +4185,4 @@ declare class Webhooks {
|
|
|
3690
4185
|
*/
|
|
3691
4186
|
type WebhookMessageData = WebhookMessageObject;
|
|
3692
4187
|
|
|
3693
|
-
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 MediaFile, type MediaUploadOptions, 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 };
|
|
4188
|
+
export { ALL_SUPPORTED_COUNTRIES, type Account, type AnalyticsOverview, type AnalyticsPeriod, type ApiErrorResponse, type ApiKey, AuthenticationError, type AutoTopUpSettings, type BatchListResponse, type BatchMessageItem, type BatchMessageRequest, type BatchMessageResponse, type BatchMessageResult, type BatchStatus, type BillingBreakdown, type BillingBreakdownOptions, type BulkProvisionResult, type BulkProvisionResultItem, type BulkProvisionWorkspace, 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 CreateKeyOptions, type CreateOptInPageOptions, type CreateOptInPageResult, type CreateTemplateRequest, type CreateVerifySessionRequest, type CreateWebhookOptions, type CreateWorkspaceOptions, type CreatedApiKey, type CreditAnalytics, type CreditAnalyticsDataPoint, type CreditTransaction, type Credits, type DeliveryAnalyticsItem, type DeliveryStatus, type DnsRecord, type EnterpriseAccount, type EnterpriseWebhook, type EnterpriseWebhookTestResult, type EnterpriseWorkspace, type EnterpriseWorkspaceDetail, type EnterpriseWorkspaceSummary, type ImportContactItem, type ImportContactsError, type ImportContactsRequest, type ImportContactsResponse, InsufficientCreditsError, type Invitation, type ListBatchesOptions, type ListCampaignsOptions, type ListContactsOptions, type ListMessagesOptions, type ListScheduledMessagesOptions, type ListVerificationsOptions, type MediaFile, type MediaUploadOptions, type Message, type MessageAnalytics, type MessageAnalyticsDataPoint, type MessageListResponse, type MessageStatus, type MessageType, NetworkError, NotFoundError, type OptInPage, type PricingTier, type ProvisionWorkspaceOptions, type ProvisionWorkspaceResult, type QuotaSettings, RateLimitError, type RateLimitInfo, type ResumeWorkspaceResult, SANDBOX_TEST_NUMBERS, SUPPORTED_COUNTRIES, type ScheduleCampaignRequest, type ScheduleMessageRequest, type ScheduledMessage, type ScheduledMessageListResponse, type ScheduledMessageStatus, type SendInvitationOptions, type SendMessageRequest, type SendVerificationRequest, type SendVerificationResponse, type SenderType, Sendly, type SendlyConfig, SendlyError, type SendlyErrorCode, type SetCustomDomainResult, type SetWorkspaceWebhookOptions, type SetWorkspaceWebhookResult, type SuspendWorkspaceOptions, type SuspendWorkspaceResult, type Template, type TemplateListResponse, type TemplatePreview, type TemplateStatus, type TemplateVariable, TimeoutError, type TransferCreditsOptions, type TransferCreditsResult, type UpdateAutoTopUpOptions, type UpdateCampaignRequest, type UpdateContactListRequest, type UpdateContactRequest, type UpdateOptInPageOptions, type UpdateQuotaOptions, 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, type WorkspaceBillingItem, type WorkspaceCredits, type WorkspaceWebhook, calculateSegments, Sendly as default, generateWebhookSignature, getCountryFromPhone, isCountrySupported, parseWebhookEvent, validateMessageText, validatePhoneNumber, validateSenderId, verifyWebhookSignature };
|