@sendmailos/sdk 1.2.1 → 1.2.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.
Files changed (2) hide show
  1. package/README.md +59 -1
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -33,11 +33,12 @@ await client.emails.send({
33
33
 
34
34
  - **Type-safe**: Full TypeScript support with exported types
35
35
  - **Lightweight**: Zero dependencies for core SDK
36
+ - **Email Automation**: Build workflows with triggers, delays, conditions, and actions
36
37
  - **Industry Templates**: 50+ pre-built templates for different industries
37
38
  - **Agency Workspaces**: Manage multiple clients from one account
38
39
  - **Pixel Tracking**: Track website visitors and link to email campaigns
40
+ - **Webhooks**: Real-time event notifications with signature verification
39
41
  - **React Components**: Pre-built components and hooks
40
- - **Webhook Verification**: Secure signature verification utilities
41
42
  - **Error Handling**: Custom error classes for different scenarios
42
43
 
43
44
  ## API Reference
@@ -451,6 +452,63 @@ await platform.workflows.trigger(data.workflow.id, {
451
452
  });
452
453
  ```
453
454
 
455
+ ## Webhooks
456
+
457
+ Receive real-time notifications when events occur (emails sent, opened, clicked, bounced, etc.).
458
+
459
+ ### Create & Manage Webhooks
460
+
461
+ ```typescript
462
+ // Create a webhook endpoint
463
+ const { webhook } = await client.webhooks.create({
464
+ url: 'https://yourserver.com/webhooks',
465
+ events: ['email.sent', 'email.delivered', 'email.opened', 'email.clicked', 'email.bounced'],
466
+ });
467
+
468
+ console.log('Webhook secret:', webhook.secret); // Use this to verify signatures
469
+
470
+ // List all webhooks
471
+ const { webhooks } = await client.webhooks.list();
472
+
473
+ // Get webhook with delivery history
474
+ const { webhook, recentDeliveries, stats } = await client.webhooks.get('webhook-id');
475
+
476
+ // Update webhook
477
+ await client.webhooks.update('webhook-id', {
478
+ events: ['email.sent', 'email.bounced', 'email.complained']
479
+ });
480
+
481
+ // Test webhook endpoint
482
+ const result = await client.webhooks.test('webhook-id');
483
+ if (result.test.sent) {
484
+ console.log(`Test delivered in ${result.test.responseTimeMs}ms`);
485
+ }
486
+
487
+ // Disable/Enable webhook
488
+ await client.webhooks.disable('webhook-id');
489
+ await client.webhooks.enable('webhook-id');
490
+
491
+ // Delete webhook
492
+ await client.webhooks.delete('webhook-id');
493
+ ```
494
+
495
+ ### Event Types
496
+
497
+ | Event | Description |
498
+ |-------|-------------|
499
+ | `email.sent` | Email was sent to the recipient |
500
+ | `email.delivered` | Email was delivered to recipient's server |
501
+ | `email.opened` | Recipient opened the email |
502
+ | `email.clicked` | Recipient clicked a link in the email |
503
+ | `email.bounced` | Email bounced (hard or soft) |
504
+ | `email.complained` | Recipient marked email as spam |
505
+ | `subscriber.created` | New subscriber was added |
506
+ | `subscriber.updated` | Subscriber was updated |
507
+ | `subscriber.unsubscribed` | Subscriber unsubscribed |
508
+ | `campaign.sent` | Campaign finished sending |
509
+ | `workflow.started` | Workflow execution started |
510
+ | `workflow.completed` | Workflow execution completed |
511
+
454
512
  ## Pixel Tracking
455
513
 
456
514
  Track website visitors and connect their behavior to email campaigns.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sendmailos/sdk",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "Official JavaScript/TypeScript SDK for SendMailOS email API",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",