@sendly/node
Advanced tools
+1
-1
| { | ||
| "name": "@sendly/node", | ||
| "version": "3.30.0", | ||
| "version": "3.31.0", | ||
| "description": "Official Sendly Node.js SDK for SMS messaging", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
+30
-30
@@ -188,4 +188,4 @@ <p align="center"> | ||
| }); | ||
| console.log(`Total credits needed: ${preview.totalCredits}`); | ||
| console.log(`Valid: ${preview.valid}, Invalid: ${preview.invalid}`); | ||
| console.log(`Credits needed: ${preview.creditsNeeded}`); | ||
| console.log(`Will send: ${preview.willSend}, Blocked: ${preview.blocked}`); | ||
| ``` | ||
@@ -237,3 +237,3 @@ | ||
| console.log(`Webhook ID: ${webhook.id}`); | ||
| console.log(`Secret: ${webhook.secret}`); // Store this securely! | ||
| console.log(`Secret: ${webhook.secret}`); // Only returned at creation - store securely! | ||
@@ -280,6 +280,7 @@ // List all webhooks | ||
| const signature = req.headers['x-sendly-signature']; | ||
| const timestamp = req.headers['x-sendly-timestamp']; | ||
| const payload = req.body; | ||
| try { | ||
| const event = webhooks.verifyAndParse(payload, signature); | ||
| const event = webhooks.parse(payload, signature, timestamp); | ||
@@ -317,3 +318,3 @@ switch (event.type) { | ||
| // View credit transaction history | ||
| const { data: transactions } = await sendly.account.getCreditTransactions(); | ||
| const transactions = await sendly.account.getCreditTransactions(); | ||
| for (const tx of transactions) { | ||
@@ -324,3 +325,3 @@ console.log(`${tx.type}: ${tx.amount} credits - ${tx.description}`); | ||
| // List API keys | ||
| const { data: keys } = await sendly.account.listApiKeys(); | ||
| const keys = await sendly.account.listApiKeys(); | ||
| for (const key of keys) { | ||
@@ -336,8 +337,5 @@ console.log(`${key.name}: ${key.prefix}*** (${key.type})`); | ||
| // Create a new API key | ||
| const newKey = await sendly.account.createApiKey({ | ||
| name: 'Production Key', | ||
| type: 'live', | ||
| scopes: ['sms:send', 'sms:read'] | ||
| }); | ||
| console.log(`New key: ${newKey.key}`); // Only shown once! | ||
| const { apiKey, key } = await sendly.account.createApiKey('Production Key'); | ||
| console.log(`New key: ${key}`); // Only shown once! | ||
| console.log(`Key ID: ${apiKey.id}`); | ||
@@ -534,7 +532,7 @@ // Revoke an API key | ||
| #### `cancelScheduled(id: string): Promise<CancelScheduledMessageResponse>` | ||
| #### `cancelScheduled(id: string): Promise<CancelledMessageResponse>` | ||
| Cancel a scheduled message and refund credits. | ||
| #### `sendBatch(request: SendBatchRequest): Promise<BatchMessageResponse>` | ||
| #### `sendBatch(request: BatchMessageRequest): Promise<BatchMessageResponse>` | ||
@@ -553,5 +551,5 @@ Send multiple messages in one API call. | ||
| #### `create(request: CreateWebhookRequest): Promise<Webhook>` | ||
| #### `create(options: CreateWebhookOptions): Promise<WebhookCreatedResponse>` | ||
| Create a new webhook endpoint. | ||
| Create a new webhook endpoint. The returned object includes a one-time `secret`. | ||
@@ -566,3 +564,3 @@ #### `list(): Promise<Webhook[]>` | ||
| #### `update(id: string, request: UpdateWebhookRequest): Promise<Webhook>` | ||
| #### `update(id: string, options: UpdateWebhookOptions): Promise<Webhook>` | ||
@@ -601,7 +599,7 @@ Update a webhook. | ||
| #### `getCreditTransactions(): Promise<CreditTransactionListResponse>` | ||
| #### `getCreditTransactions(options?: { limit?: number; offset?: number }): Promise<CreditTransaction[]>` | ||
| Get credit transaction history. | ||
| #### `listApiKeys(): Promise<ApiKeyListResponse>` | ||
| #### `listApiKeys(): Promise<ApiKey[]>` | ||
@@ -675,13 +673,14 @@ List API keys. | ||
| businessName: 'Acme Insurance LLC', | ||
| businessType: 'llc', | ||
| ein: '12-3456789', | ||
| address: '100 Main St', | ||
| city: 'Austin', | ||
| state: 'TX', | ||
| zip: '78701', | ||
| website: 'https://acme.com', | ||
| entityType: 'PRIVATE_PROFIT', | ||
| brn: '12-3456789', | ||
| brnType: 'EIN', | ||
| brnCountry: 'US', | ||
| address: { street: '100 Main St', city: 'Austin', state: 'TX', zip: '78701', country: 'US' }, | ||
| contact: { firstName: 'Jane', lastName: 'Doe', email: 'jane@acme.com', phone: '+15551234567' }, | ||
| useCase: 'Policy renewal reminders', | ||
| sampleMessages: ['Your policy renews on 3/15.'] | ||
| sampleMessages: 'Your policy renews on 3/15.' | ||
| }); | ||
| // Inherit from verified workspace | ||
| // Inherit from verified workspace (shares toll-free number) | ||
| await client.enterprise.workspaces.inheritVerification('ws_new', { | ||
@@ -691,6 +690,7 @@ sourceWorkspaceId: 'ws_verified' | ||
| // Inherit with new number | ||
| await client.enterprise.workspaces.inheritVerification('ws_new', { | ||
| // Inherit + new number: use provision() with inheritWithNewNumber instead | ||
| await client.enterprise.provision({ | ||
| name: 'Acme Insurance - Austin', | ||
| sourceWorkspaceId: 'ws_verified', | ||
| purchaseNewNumber: true | ||
| inheritWithNewNumber: true | ||
| }); | ||
@@ -697,0 +697,0 @@ ``` |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
532501
1.61%13217
1.06%