{"_rev":"3-667341fb7d95f7bb94d904aadd85bd23","time":{"created":"2026-04-06T16:35:23.116Z","modified":"2026-04-06T16:35:23.510Z","1.0.0":"2026-04-06T15:57:03.000Z","0.0.1":"2026-04-06T16:35:23.334Z"},"_id":"@emmanuelapabiekun/termii","name":"@emmanuelapabiekun/termii","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"@emmanuelapabiekun/termii","version":"0.0.1","description":"A lightweight, type-safe SDK for Termii API","main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","author":{"name":"Emmanuel Apabiekun"},"license":"MIT","keywords":["termii","sms","otp","whatsapp","email","campaign","phonebook","sender-id","voice","ussd","esim","analytics","webhooks","sdk","api","client","library","typescript","javascript","node","npm","package","module","commonjs","esm","dts","types","build","dev","lint","format","termii-api","termii-sdk","termii-client","termii-library","termii-typescript","termii-javascript","termii-node","termii-npm","termii-package","termii-module","termii-commonjs","termii-esm","termii-dts","termii-types","termii-build","termii-dev","termii-lint","termii-format"],"scripts":{"build":"tsup src/index.ts --format cjs,esm --dts","dev":"tsup src/index.ts --format cjs,esm --watch --dts","lint":"biome lint .","format":"biome format --write ."},"dependencies":{"zod":"^4.3.6"},"devDependencies":{"@types/node":"^22.13.1","tsup":"^8.3.6","typescript":"^5.7.3"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"repository":{"type":"git","url":"git+https://github.com/ekunemmanuel/termii.git"},"gitHead":"f051a8ff7597f3791fdac2f0de8945e6bdde71c6","_id":"@emmanuelapabiekun/termii@0.0.1","bugs":{"url":"https://github.com/ekunemmanuel/termii/issues"},"homepage":"https://github.com/ekunemmanuel/termii#readme","_nodeVersion":"24.12.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-hPjbDE0BhUyMN92iyb0Wb/Jz3iK8y9C6X4AqtX8HS16aetzuJlusl4wxi4rU061SxDbLrHNI77AX5wsFAxzPYg==","shasum":"779d7d66576f0f8d9a84bb41e1b529729d033e53","tarball":"https://registry.npmjs.org/@emmanuelapabiekun/termii/-/termii-0.0.1.tgz","fileCount":6,"unpackedSize":168595,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDXFMQZ07d+OvCt9VLLWW5dyI6hY+X7oAnukoi9Lms5VgIhANAHxDajP+xjpZdCHwFy2n2ezkdgRo127QOA871EzmVA"}]},"_npmUser":{"name":"emmanuelapabiekun","email":"emmanuelapabiekun@gmail.com"},"directories":{},"maintainers":[{"name":"emmanuelapabiekun","email":"emmanuelapabiekun@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/termii_0.0.1_1775493323182_0.6880085986375448"},"_hasShrinkwrap":false}},"maintainers":[{"name":"emmanuelapabiekun","email":"emmanuelapabiekun@gmail.com"}],"description":"A lightweight, type-safe SDK for Termii API","homepage":"https://github.com/ekunemmanuel/termii#readme","keywords":["termii","sms","otp","whatsapp","email","campaign","phonebook","sender-id","voice","ussd","esim","analytics","webhooks","sdk","api","client","library","typescript","javascript","node","npm","package","module","commonjs","esm","dts","types","build","dev","lint","format","termii-api","termii-sdk","termii-client","termii-library","termii-typescript","termii-javascript","termii-node","termii-npm","termii-package","termii-module","termii-commonjs","termii-esm","termii-dts","termii-types","termii-build","termii-dev","termii-lint","termii-format"],"repository":{"type":"git","url":"git+https://github.com/ekunemmanuel/termii.git"},"author":{"name":"Emmanuel Apabiekun"},"bugs":{"url":"https://github.com/ekunemmanuel/termii/issues"},"license":"MIT","readme":"# Termii TypeScript SDK\n\nA powerful, fully type-safe TypeScript SDK for the [Termii V3 API](https://developers.termii.com/), optimized for Node.js and Bun.\n\n## Features\n\n- **Full Parity**: Supports SMS, Voice, Token (OTP), Insights, WhatsApp, Email, Campaigns, and eSIM.\n- **Strictly Typed**: Powered by Zod for runtime validation and precise IDE autocompletion.\n- **eSIM Lifecycle**: Comprehensive management of Sotel eSIMs including provisioning, top-ups, and usage tracking.\n- **Secure Webhooks**: Built-in HMAC-SHA512 signature verification and event parsing.\n- **Smart Routing**: Automated handling of single and bulk SMS endpoints.\n- **Pagination Support**: Built-in utilities for handling Spring-style paginated API responses.\n\n## Installation\n\nInstall the package via your preferred package manager:\n\n```bash\nnpm install @emmanuelapabiekun/termii\n# or\nbun add @emmanuelapabiekun/termii\n# or\nyarn add @emmanuelapabiekun/termii\n```\n\n## Getting Started\n\nInitialize the SDK by providing your API key and configuration options.\n\n```typescript\nimport { Termii } from 'termii';\n\nconst termii = new Termii(\n  'YOUR_API_KEY',\n  'YOUR_SECRET_KEY', // Optional: Required for Webhook verification\n  'https://v3.api.termii.com', // Optional: Custom Base URL\n  true // Optional: Enable debug logging\n);\n```\n\n## Resource Modules\n\nThe SDK is organized into specialized modules accessible via the main `Termii` instance.\n\n### SMS Messaging\nSend single or bulk SMS messages across different channels.\n\n```typescript\nconst response = await termii.sms.send({\n  to: \"2348000000000\",\n  from: \"Termii\",\n  sms: \"Hello from the TypeScript SDK\",\n  type: \"plain\",\n  channel: \"generic\"\n});\n```\n\n### Token (OTP)\nGenerate and verify multi-channel One-Time Passwords (SMS, Voice, Email, WhatsApp).\n\n```typescript\n// Send an OTP\nconst otp = await termii.token.send({\n  to: \"2348000000000\",\n  from: \"Termii\",\n  message_type: \"NUMERIC\",\n  pin_attempts: 3,\n  pin_time_to_live: 5,\n  pin_length: 6,\n  pin_placeholder: \"< 1234 >\",\n  message_text: \"Your confirmation code is < 1234 >\",\n  pin_type: \"NUMERIC\"\n});\n\n// Verify an OTP\nconst verification = await termii.token.verify({\n  pin_id: otp.pinId,\n  pin: \"123456\"\n});\n```\n\n### eSIM Management (via Sotel)\nComplete management of the eSIM lifecycle.\n\n```typescript\n// 1. Authenticate to secure a session token\nawait termii.esim.authenticate();\n\n// 2. Search for available data plans\nconst plans = await termii.esim.fetchPlans({ \n  country: \"Nigeria\", \n  type: \"LOCAL\" \n});\n\n// 3. Provision an eSIM for a customer\nconst sim = await termii.esim.create(plans.data.content[0].productId, \"NGA\");\n\n// 4. Monitor data usage\nconst usage = await termii.esim.getUsage(sim.data.sim.iccid);\nconsole.log(`Usage: ${usage.data.data_used_gigabyte}GB of ${usage.data.data_total_gigabyte}GB`);\n```\n\n### WhatsApp Business\nSend interactive and template-based WhatsApp messages.\n\n```typescript\nawait termii.whatsapp.sendTemplate({\n  phone_number: \"2348000000000\",\n  template_id: \"order_confirmation\",\n  device_id: \"YOUR_DEVICE_ID\",\n  data: {\n    customer_name: \"John Doe\",\n    order_id: \"ABC-123\"\n  }\n});\n```\n\n## Webhook Verification\n\nThe SDK provides a secure way to verify and parse incoming webhooks using HMAC-SHA512.\n\n```typescript\nimport express from 'express';\n\nconst app = express();\napp.use(express.json());\n\napp.post('/webhooks/termii', (req, res) => {\n  const signature = req.headers['x-termii-signature'] as string;\n  \n  try {\n    // Verifies the signature and returns a strictly typed event object\n    const event = termii.webhooks.construct(req.body, signature);\n    \n    if (event.type === 'inbound') {\n      console.log(`Received message from ${event.sender}: ${event.message}`);\n    }\n    \n    res.status(200).send('OK');\n  } catch (err) {\n    res.status(401).send('Unauthorized: Invalid Signature');\n  }\n});\n```\n\n## Insights and Analytics\n\nMonitor your wallet balance and query message history.\n\n```typescript\nconst balance = await termii.insights.balance();\nconsole.log(`Balance: ${balance.balance} ${balance.currency}`);\n```\n\n## Documentation and Support\n\nEvery class and method in the SDK is documented with JSDoc. You can hover over any method in your IDE to see its purpose, parameters, and return types.\n\n## Error Handling\n\nThe SDK exposes custom error classes for robust error management:\n\n- `TermiiHttpError`: Thrown when the API returns a non-2xx status code.\n- `TermiiValidationError`: Thrown when the API response fails schema validation.\n\n```typescript\ntry {\n  await termii.insights.balance();\n} catch (error) {\n  if (error instanceof TermiiHttpError) {\n    console.error(`Status: ${error.status}, Message: ${error.message}`);\n  }\n}\n```\n\n## License\n\nMIT\n\n","readmeFilename":"README.md"}