{"_id":"@afrisinc/notify-sdk","_rev":"4-36204976285b38e7d43a377ce55fd1aa","name":"@afrisinc/notify-sdk","dist-tags":{"latest":"0.6.0"},"versions":{"0.1.0":{"name":"@afrisinc/notify-sdk","version":"0.1.0","keywords":["notify","sdk","notifications","email","sms","push","webhooks","api"],"author":"","license":"MIT","_id":"@afrisinc/notify-sdk@0.1.0","maintainers":[{"name":"support-afrisinc","email":"support@afrisinc.com"}],"dist":{"shasum":"987c28e6158e8036ac600b014a5faea3d2298ad5","tarball":"https://registry.npmjs.org/@afrisinc/notify-sdk/-/notify-sdk-0.1.0.tgz","fileCount":8,"integrity":"sha512-5fTBVT4TtBEW3mq3QgWCU0yfyoWWn8K6gp8xjHstVscEWzM2BboO22U1WOdE2i6itB92z3aGfGC2q1M63QFNJA==","signatures":[{"sig":"MEUCIQD6KBBcZHrdn24beLii9S/WpqNjly+06KFtU2gAO4Fm9gIgLgfiWsgEGUrtDy9xN8Yewa6zATriblwLehFvmk0lQJQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":70476},"main":"dist/index.cjs","type":"module","types":"dist/index.d.ts","module":"dist/index.js","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"09a9f46f1f47b1650e7f3210d48bac278607acbb","scripts":{"dev":"tsup src/index.ts --format cjs,esm --dts --watch","lint":"eslint src test","test":"vitest run","build":"tsup src/index.ts --format cjs,esm --dts","check":"npm run typecheck && npm run lint && npm run format:check","clean":"rm -rf dist","format":"prettier --write \"src/**/*.ts\" \"test/**/*.ts\"","prepare":"husky","lint:fix":"eslint src test --fix","typecheck":"tsc --noEmit","playground":"tsx playground.ts","test:watch":"vitest","format:check":"prettier --check \"src/**/*.ts\" \"test/**/*.ts\"","prepublishOnly":"npm run build"},"_npmUser":{"name":"support-afrisinc","email":"support@afrisinc.com"},"repository":{"url":"","type":"git"},"_npmVersion":"11.12.1","description":"Official SDK for the Notify API — send notifications across email, SMS, push, and webhooks","directories":{},"_nodeVersion":"24.15.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.23.1","tsup":"^8.0.1","husky":"^9.1.7","eslint":"^9.7.0","vitest":"^1.2.0","prettier":"^3.3.0","@eslint/js":"^9.7.0","typescript":"^5.3.3","@types/node":"^20.11.0","typescript-eslint":"^8.0.0","eslint-config-prettier":"^9.1.0"},"_npmOperationalInternal":{"tmp":"tmp/notify-sdk_0.1.0_1784391105688_0.4606243832804662","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@afrisinc/notify-sdk","version":"0.1.1","keywords":["notify","sdk","notifications","email","sms","push","whatsapp","in-app","api"],"author":"","license":"MIT","_id":"@afrisinc/notify-sdk@0.1.1","maintainers":[{"name":"support-afrisinc","email":"support@afrisinc.com"}],"dist":{"shasum":"e6188cf07c76fd6944f88cd68f8bbce64921564c","tarball":"https://registry.npmjs.org/@afrisinc/notify-sdk/-/notify-sdk-0.1.1.tgz","fileCount":8,"integrity":"sha512-qeTN2w5Ejby7aOj+1FkicQMbQrJznIs/JsBNQTatM8tnteGGmXACdE4h4F6jemFQ69Ev5hXO7zWeUWyo+PZ6zQ==","signatures":[{"sig":"MEUCIDxd+lDEpF13iE6Sxq8F7LFDEIfn/IwLpZwq5deQFIl0AiEA4XBCkYQdwWgZa8zhr1BpKMohJ1DENInFwO+rS3Vb4ZY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":71093},"main":"dist/index.cjs","type":"module","types":"dist/index.d.ts","module":"dist/index.js","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"605b6b31f22989cc3d3e67f9a6b8dfda2d2d79fb","scripts":{"dev":"tsup src/index.ts --format cjs,esm --dts --watch","lint":"eslint src test","test":"vitest run","build":"tsup src/index.ts --format cjs,esm --dts","check":"npm run typecheck && npm run lint && npm run format:check","clean":"rm -rf dist","format":"prettier --write \"src/**/*.ts\" \"test/**/*.ts\"","prepare":"husky","lint:fix":"eslint src test --fix","typecheck":"tsc --noEmit","playground":"tsx playground.ts","test:watch":"vitest","format:check":"prettier --check \"src/**/*.ts\" \"test/**/*.ts\"","prepublishOnly":"npm run build"},"_npmUser":{"name":"support-afrisinc","email":"support@afrisinc.com"},"repository":{"url":"","type":"git"},"_npmVersion":"11.12.1","description":"Official SDK for the Notify API — send notifications across email, SMS, push, WhatsApp, and in-app","directories":{},"_nodeVersion":"24.15.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.23.1","tsup":"^8.0.1","husky":"^9.1.7","eslint":"^9.7.0","vitest":"^1.2.0","prettier":"^3.3.0","@eslint/js":"^9.7.0","typescript":"^5.3.3","@types/node":"^20.11.0","typescript-eslint":"^8.0.0","eslint-config-prettier":"^9.1.0"},"_npmOperationalInternal":{"tmp":"tmp/notify-sdk_0.1.1_1784391556837_0.619671999736251","host":"s3://npm-registry-packages-npm-production"}},"0.4.0":{"name":"@afrisinc/notify-sdk","version":"0.4.0","keywords":["notify","sdk","notifications","email","sms","push","whatsapp","in-app","api"],"author":"","license":"MIT","_id":"@afrisinc/notify-sdk@0.4.0","maintainers":[{"name":"support-afrisinc","email":"support@afrisinc.com"}],"dist":{"shasum":"b2a8b01aa745384f21470e8bb5d314d06348734b","tarball":"https://registry.npmjs.org/@afrisinc/notify-sdk/-/notify-sdk-0.4.0.tgz","fileCount":8,"integrity":"sha512-h1NwH1wnyaF7ds+g+6nJWkDj4AVV0V3T7B2hA/c1pVq1D98rRAw+xGGZ+3NpFw9nAT3Ez7BTs0NXlmO4uc/vsQ==","signatures":[{"sig":"MEQCIBNLUsK9bcz8EDOL1mVbFhtCQjQz5iOI4MRej1uLGiNRAiBRrZW1zAoo3u0hIcZGM6jcucIKi3QFqpgZDflgNviMvg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":84370},"main":"dist/index.cjs","type":"module","types":"dist/index.d.ts","module":"dist/index.js","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"f9bde6b0666ed5822b1fc2321dc40e93400f9620","scripts":{"dev":"tsup src/index.ts --format cjs,esm --dts --watch","lint":"eslint src test","test":"vitest run","build":"tsup src/index.ts --format cjs,esm --dts","check":"npm run typecheck && npm run lint && npm run format:check","clean":"rm -rf dist","format":"prettier --write \"src/**/*.ts\" \"test/**/*.ts\"","prepare":"husky","release":"npm version patch && npm publish","lint:fix":"eslint src test --fix","typecheck":"tsc --noEmit","playground":"tsx playground.ts","test:watch":"vitest","format:check":"prettier --check \"src/**/*.ts\" \"test/**/*.ts\"","release:major":"npm version major && npm publish","release:minor":"npm version minor && npm publish","prepublishOnly":"npm run build"},"_npmUser":{"name":"support-afrisinc","email":"support@afrisinc.com"},"repository":{"url":"","type":"git"},"_npmVersion":"11.6.1","description":"Official SDK for the Notify API — send notifications across email, SMS, push, WhatsApp, and in-app","directories":{},"_nodeVersion":"24.11.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.23.1","tsup":"^8.0.1","husky":"^9.1.7","eslint":"^9.7.0","vitest":"^1.2.0","prettier":"^3.3.0","@eslint/js":"^9.7.0","typescript":"^5.3.3","@types/node":"^20.11.0","typescript-eslint":"^8.0.0","eslint-config-prettier":"^9.1.0"},"_npmOperationalInternal":{"tmp":"tmp/notify-sdk_0.4.0_1787657859271_0.41016244300494464","host":"s3://npm-registry-packages-npm-production"}},"0.6.0":{"_id":"@afrisinc/notify-sdk@0.6.0","dist":{"shasum":"9867b8213afced1bcfc0aed3d232a4484d669dc7","tarball":"https://registry.npmjs.org/@afrisinc/notify-sdk/-/notify-sdk-0.6.0.tgz","fileCount":8,"integrity":"sha512-Cv8QDt+U2M//Ka/pWNFUtq5iq6fEzpQxnQ1OrdKO0notRfz8eT4ubsGbOjbLvhANKiqXpmDlhOMcqHyNj3WEKA==","signatures":[{"sig":"MEQCIE8nkc3aQtb6xnTKNAYgMkCLDkBE9qvpSZJLLc03AD5pAiAMuxGpFk2NVKKEGG439jKbfEVY1d7pX/EFyHri08w/Vg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCSMScL+W112PhQuj/HZGlNFZERPSmM8mqpUiNmPmIabwIhAKzqKT/bPYLjpd2qQskO795DQhkDWSEJcBVouP32knl0"}],"unpackedSize":91519},"main":"dist/index.cjs","name":"@afrisinc/notify-sdk","type":"module","types":"dist/index.d.ts","author":"","module":"dist/index.js","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"c417e570b8a61faea04c44ad64428deb41c08bec","license":"MIT","scripts":{"dev":"tsup src/index.ts --format cjs,esm --dts --watch","lint":"eslint src test","test":"vitest run","build":"tsup src/index.ts --format cjs,esm --dts","check":"npm run typecheck && npm run lint && npm run format:check","clean":"rm -rf dist","format":"prettier --write \"src/**/*.ts\" \"test/**/*.ts\"","prepare":"husky","release":"npm version patch && npm publish","lint:fix":"eslint src test --fix","typecheck":"tsc --noEmit","playground":"tsx playground.ts","test:watch":"vitest","format:check":"prettier --check \"src/**/*.ts\" \"test/**/*.ts\"","release:major":"npm version major && npm publish","release:minor":"npm version minor && npm publish","prepublishOnly":"npm run build"},"version":"0.6.0","_npmUser":{"name":"support-afrisinc","email":"support@afrisinc.com"},"keywords":["notify","sdk","notifications","email","sms","push","whatsapp","in-app","api"],"repository":{"url":"","type":"git"},"_npmVersion":"11.6.1","description":"Official SDK for the Notify API — send notifications across email, SMS, push, WhatsApp, and in-app","directories":{},"maintainers":[{"name":"support-afrisinc","email":"support@afrisinc.com"}],"_nodeVersion":"24.11.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.23.1","tsup":"^8.0.1","husky":"^9.1.7","eslint":"^9.7.0","vitest":"^1.2.0","prettier":"^3.3.0","@eslint/js":"^9.7.0","typescript":"^5.3.3","@types/node":"^20.11.0","typescript-eslint":"^8.0.0","eslint-config-prettier":"^9.1.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/notify-sdk_0.6.0_1787955016308_0.4515626879433383"}}},"time":{"created":"2026-07-18T16:11:45.541Z","modified":"2026-08-28T22:10:16.649Z","0.1.0":"2026-07-18T16:11:45.822Z","0.1.1":"2026-07-18T16:19:16.969Z","0.4.0":"2026-08-25T11:37:39.408Z","0.6.0":"2026-08-28T22:10:16.432Z"},"license":"MIT","keywords":["notify","sdk","notifications","email","sms","push","whatsapp","in-app","api"],"repository":{"url":"","type":"git"},"description":"Official SDK for the Notify API — send notifications across email, SMS, push, WhatsApp, and in-app","maintainers":[{"name":"support-afrisinc","email":"support@afrisinc.com"}],"readme":"# @afrisinc/notify-sdk\n\nOfficial SDK for the Notify API — send notifications across email, SMS, push, WhatsApp, and in-app.\n\n## Installation\n\n```bash\nnpm install @afrisinc/notify-sdk\n```\n\n## Quick Start\n\n```typescript\nimport { Notify } from '@afrisinc/notify-sdk';\n\nconst notify = new Notify({\n  apiKey: 'your_api_key'\n});\n\nawait notify.send({\n  to: 'user@example.com',\n  channel: 'email',\n  template: 'welcome',\n  data: { name: 'Alice' }\n});\n```\n\n## Usage\n\n### Send a Single Notification\n\n```typescript\nconst result = await notify.send({\n  to: 'user@example.com',\n  channel: 'email',\n  template: 'order-confirmation',\n  data: { orderId: 'ORD-123' },\n  priority: 'high'\n});\n\nconsole.log(result.id);     // notification ID\nconsole.log(result.status); // 'queued' | 'sent' | 'pending' | 'failed'\n```\n\n### Send SMS\n\n```typescript\nawait notify.send({\n  to: '+1234567890',\n  channel: 'sms',\n  template: 'verification-code',\n  data: { code: '123456' }\n});\n```\n\n### Send WhatsApp Message\n\n```typescript\nawait notify.send({\n  to: '+1234567890',\n  channel: 'whatsapp',\n  template: 'order-shipped',\n  data: { trackingNumber: 'TRK-456' }\n});\n```\n\n### Send Push Notification\n\n```typescript\nawait notify.send({\n  to: 'device_token',\n  channel: 'push',\n  data: { title: 'New message', body: 'You have a new message' }\n});\n```\n\n### Send In-App Notification\n\n```typescript\nawait notify.send({\n  to: 'user_id_123',\n  channel: 'in_app',\n  template: 'new-feature',\n  data: { feature: 'Dark Mode' }\n});\n```\n\n### Bulk Notifications\n\nSend up to 1000 notifications in a single request:\n\n```typescript\nconst result = await notify.bulk({\n  notifications: [\n    { to: 'user1@example.com', channel: 'email', data: { name: 'User 1' } },\n    { to: 'user2@example.com', channel: 'email', data: { name: 'User 2' } },\n    { to: '+1234567890', channel: 'sms', data: { code: '123456' } }\n  ]\n});\n\nconsole.log(result.accepted); // number of accepted notifications\nconsole.log(result.rejected); // number of rejected notifications\nconsole.log(result.errors);   // array of errors (if any)\n```\n\n### Get Notification Status\n\n```typescript\nconst notification = await notify.get('notification_id');\n\nconsole.log(notification.id);\nconsole.log(notification.status);\nconsole.log(notification.channel);\n```\n\n### List Notifications\n\n```typescript\nconst list = await notify.list({\n  channel: 'email',\n  status: 'sent',\n  page: 1,\n  limit: 20\n});\n\nconsole.log(list.items);      // array of notifications\nconsole.log(list.total);      // total count\nconsole.log(list.totalPages); // total pages\n```\n\n### Campaigns\n\nCreate a campaign for the app resolved from your API key. Supports `email`, `sms`, `push`, and `in_app` channels, either with inline content or a `templateId`.\n\n```typescript\nconst campaign = await notify.campaigns.create({\n  name: 'Welcome Series - August',\n  channel: 'email',\n  subject: 'Welcome to our platform!',\n  html_content: '<h1>Welcome!</h1><p>Thanks for joining us.</p>',\n  recipientType: 'all',\n  status: 'draft'\n});\n\nconsole.log(campaign.id);\nconsole.log(campaign.status);\n```\n\n```typescript\nawait notify.campaigns.create({\n  name: 'Flash Sale Alert',\n  channel: 'sms',\n  text_content: '🔥 24hr flash sale! Get 20% off with code FLASH20. Shop now: https://example.com/sale',\n  recipientType: 'tags',\n  recipientTags: ['vip', 'active_shopper'],\n  status: 'draft'\n});\n```\n\n```typescript\nawait notify.campaigns.create({\n  name: 'Cart Reminder Push',\n  channel: 'push',\n  push_title: 'You left something behind!',\n  push_body: 'Your cart is waiting — complete your purchase now.',\n  push_image_url: 'https://cdn.example.com/images/cart-reminder.png',\n  push_action_url: 'https://example.com/cart',\n  push_data: { cartId: 'abc123', source: 'campaign' },\n  recipientType: 'segment',\n  recipientSegment: 'abandoned_cart_users',\n  status: 'draft'\n});\n```\n\n```typescript\nawait notify.campaigns.create({\n  name: 'New Feature Announcement',\n  channel: 'in_app',\n  inapp_title: 'Introducing Dark Mode',\n  inapp_body: 'Switch to dark mode from your settings menu.',\n  inapp_image_url: 'https://cdn.example.com/images/dark-mode.png',\n  inapp_action_url: '/settings/appearance',\n  inapp_action_text: 'Try it now',\n  recipientType: 'all',\n  status: 'draft'\n});\n```\n\nUse `templateId` instead of inline content to send a pre-built template on any channel:\n\n```typescript\nawait notify.campaigns.create({\n  name: 'Monthly Newsletter',\n  channel: 'email',\n  templateId: '3f1e2a4b-5c6d-7e8f-9a0b-1c2d3e4f5a6b',\n  recipientType: 'all',\n  status: 'scheduled',\n  scheduledAt: '2026-09-01T09:00:00.000Z'\n});\n```\n\n**Recipient targeting**\n\n| `recipientType` | Additional fields |\n|------------------|--------------------|\n| `all` | — |\n| `tags` | `recipientTags: string[]` |\n| `segment` | `recipientSegment: string` |\n\n### Contacts\n\nCreate a contact for the app resolved from your API key. If a contact with the same email already exists for the app, it's updated instead of duplicated — so this also covers newsletter re-subscribes.\n\n```typescript\nconst contact = await notify.contacts.create({\n  email: 'jane@client.com',\n  firstName: 'Jane',\n  lastName: 'Doe',\n  company: 'Acme Corp',\n  subject: 'Pricing question',\n  message: 'Do you offer annual plans?',\n  source: 'contact_form'\n});\n\nconsole.log(contact.id);\nconsole.log(contact.subscribed);\n```\n\nSetting `source: 'contact_form'` tags the contact `contact_form` and, if the account has a `CONTACT_FORM_AUTOREPLY` template configured, triggers an automatic reply email.\n\nFor a newsletter signup, use `source: 'newsletter'` and set `subscribed`:\n\n```typescript\nawait notify.contacts.create({\n  email: 'reader@example.com',\n  source: 'newsletter',\n  subscribed: true,\n  tags: ['newsletter']\n});\n```\n\nTo unsubscribe, create the contact again with `subscribed: false`.\n\n## Configuration\n\n```typescript\nconst notify = new Notify({\n  apiKey: 'your_api_key',     // required\n  baseUrl: 'https://...',     // optional, defaults to production API\n  timeout: 30000,             // optional, request timeout in ms (default: 30000)\n  retries: 3                  // optional, number of retries (default: 3)\n});\n```\n\n## Channels\n\n| Channel | `to` field | Description |\n|---------|------------|-------------|\n| `email` | Email address | Send email notifications |\n| `sms` | Phone number (E.164) | Send SMS messages |\n| `whatsapp` | Phone number (E.164) | Send WhatsApp messages |\n| `push` | Device token | Send push notifications |\n| `in_app` | User ID | Send in-app notifications |\n\n## Priority Levels\n\n| Priority | Description |\n|----------|-------------|\n| `low` | Background notifications |\n| `normal` | Standard delivery (default) |\n| `high` | Priority delivery |\n| `urgent` | Immediate delivery |\n\n## Error Handling\n\n```typescript\nimport {\n  Notify,\n  NotifyError,\n  NotifyAuthenticationError,\n  NotifyValidationError,\n  NotifyRateLimitError,\n  NotifyNetworkError\n} from '@afrisinc/notify-sdk';\n\ntry {\n  await notify.send({ ... });\n} catch (error) {\n  if (error instanceof NotifyAuthenticationError) {\n    console.error('Invalid API key');\n  } else if (error instanceof NotifyValidationError) {\n    console.error('Validation failed:', error.message);\n  } else if (error instanceof NotifyRateLimitError) {\n    console.error('Rate limited. Retry after:', error.retryAfter);\n  } else if (error instanceof NotifyNetworkError) {\n    console.error('Network error:', error.message);\n  } else if (error instanceof NotifyError) {\n    console.error('Error:', error.code, error.message);\n  }\n}\n```\n\n## TypeScript\n\nFull TypeScript support with exported types:\n\n```typescript\nimport type {\n  NotifyConfig,\n  Channel,\n  Priority,\n  NotificationStatus,\n  SendParams,\n  SendResponse,\n  BulkParams,\n  BulkResponse,\n  Notification,\n  ListParams,\n  ListResponse\n} from '@afrisinc/notify-sdk';\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md"}