{"_id":"@abdoseadaa/mail-tel","_rev":"3-85abcbdb8a514760c131364d81d7af0a","name":"@abdoseadaa/mail-tel","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@abdoseadaa/mail-tel","version":"1.0.0","keywords":["mail-tel","telegram","alert","bot","notification"],"license":"ISC","_id":"@abdoseadaa/mail-tel@1.0.0","maintainers":[{"name":"abdoseadaa","email":"abdom.seada@gmail.com"}],"dist":{"shasum":"485bb417287572187c70fb851f642f712fee55c6","tarball":"https://registry.npmjs.org/@abdoseadaa/mail-tel/-/mail-tel-1.0.0.tgz","fileCount":41,"integrity":"sha512-iyC1ZqqqhVA11FLqK6mxf8xtdDPlpP/RbxsN7xLmyUsQvr1l8WkbHibvV4oG0yNrngXvdLcLQKaWmpuYRIyAsw==","signatures":[{"sig":"MEQCIB6a6+BV/P/xNPugM8pYjfurHpcpbdQtn95X8ZYEwsylAiAyl2/Z1y+THJbq4iO85GIrtplURXiYsMdoo+izHMqz7Q==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":32299},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=18"},"gitHead":"09a7178cedb1df020240b15ba71a461918a4c480","scripts":{"build":"tsc","clean":"rimraf dist"},"_npmUser":{"name":"abdoseadaa","email":"abdom.seada@gmail.com"},"_npmVersion":"10.8.2","description":"Client library for mail-tel API — send Telegram alerts (text, media, HTML) with one config and simple send methods.","directories":{},"_nodeVersion":"20.19.5","_hasShrinkwrap":false,"devDependencies":{"rimraf":"^5.0.5","typescript":"^5.5.3","@types/node":"^20.19.33"},"_npmOperationalInternal":{"tmp":"tmp/mail-tel_1.0.0_1772060314895_0.15868015249245748","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@abdoseadaa/mail-tel","version":"1.0.1","keywords":["mail-tel","telegram","alert","bot","notification"],"license":"ISC","_id":"@abdoseadaa/mail-tel@1.0.1","maintainers":[{"name":"abdoseadaa","email":"abdom.seada@gmail.com"}],"dist":{"shasum":"61b9ee4ab672fd61f5d826f9e6d69b10e6683985","tarball":"https://registry.npmjs.org/@abdoseadaa/mail-tel/-/mail-tel-1.0.1.tgz","fileCount":41,"integrity":"sha512-yWvJRbjVx4sl9INA5dkSVHMsHxtH+GQN+QC4YLuHRbJqyCDfohR14XHQz+/TgXineGa20/asSHG1JMgtpZtZMg==","signatures":[{"sig":"MEYCIQDrMgf5fMjSmtqZfeUWXgpkg02LnbMDJoP2ivaYIuoazQIhANa7gDrWUhLY/DuTzIJDfZkjcGVN2H9DWsyGWze3O6Hq","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":32299},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=18"},"gitHead":"3b7bc3ed89c6cc882b2a4e00dbdb234cd803381a","scripts":{"build":"tsc","clean":"rimraf dist"},"_npmUser":{"name":"abdoseadaa","email":"abdom.seada@gmail.com"},"_npmVersion":"10.8.2","description":"Client library for mail-tel API — send Telegram alerts (text, media, HTML) with one config and simple send methods.","directories":{},"_nodeVersion":"20.19.5","_hasShrinkwrap":false,"devDependencies":{"rimraf":"^5.0.5","typescript":"^5.5.3","@types/node":"^20.19.33"},"_npmOperationalInternal":{"tmp":"tmp/mail-tel_1.0.1_1772069263953_0.12051274696099812","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@abdoseadaa/mail-tel","version":"1.0.2","description":"Client library for mail-tel API — send Telegram alerts (text, media, HTML) with one config and simple send methods.","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc","clean":"rimraf dist"},"keywords":["mail-tel","telegram","alert","bot","notification"],"license":"ISC","engines":{"node":">=18"},"devDependencies":{"@types/node":"^20.19.33","rimraf":"^5.0.5","typescript":"^5.5.3"},"_id":"@abdoseadaa/mail-tel@1.0.2","gitHead":"3b7bc3ed89c6cc882b2a4e00dbdb234cd803381a","_nodeVersion":"20.19.5","_npmVersion":"10.8.2","dist":{"integrity":"sha512-dbwC/4JrRTXNe2dbY/QsZN4fHukoeHxsx7NSXQp8JQH9SBgBvXOwunWpsxZ7mx/MijsFk1VdYH86mnwz+RHipQ==","shasum":"a23a71cf73a868e85a2250ccfb68106e7fb50e90","tarball":"https://registry.npmjs.org/@abdoseadaa/mail-tel/-/mail-tel-1.0.2.tgz","fileCount":41,"unpackedSize":32299,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIF8oMHqXHEOwMe75JG0shks/XgzFxX9yxgKv5RiHh3bwAiEA7vxyIEIIf4mLu1R0OXMfJgFKHJvxsPrhrgGTBzJdm2g="}]},"_npmUser":{"name":"abdoseadaa","email":"abdom.seada@gmail.com"},"directories":{},"maintainers":[{"name":"abdoseadaa","email":"abdom.seada@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/mail-tel_1.0.2_1772069295631_0.19600283280996922"},"_hasShrinkwrap":false}},"time":{"created":"2026-02-25T22:58:34.783Z","modified":"2026-02-26T01:28:15.979Z","1.0.0":"2026-02-25T22:58:35.035Z","1.0.1":"2026-02-26T01:27:44.112Z","1.0.2":"2026-02-26T01:28:15.872Z"},"license":"ISC","keywords":["mail-tel","telegram","alert","bot","notification"],"description":"Client library for mail-tel API — send Telegram alerts (text, media, HTML) with one config and simple send methods.","maintainers":[{"name":"abdoseadaa","email":"abdom.seada@gmail.com"}],"readme":"# @abdoseadaa/mail-tel\n\nClient library for [mail-tel](https://github.com/gabster/mail-tel) API. Send Telegram alerts (text, media, HTML) with one config and simple send methods.\n\n```bash\nnpm install @abdoseadaa/mail-tel\n```\n\n---\n\n## Function\n\n### `configBot(params)`\n\nCreates a bot client. All send methods use the same API base and optional bot id.\n\n```typescript\nimport { configBot } from \"@abdoseadaa/mail-tel\";\n\nconst bot = configBot({\n  id: \"default\",   // required — Telegram bot id (e.g. \"default\", \"alerts\")\n  api: \"https://mail.tel.api.gabster.ai\",\n});\n```\n\n---\n\n### `bot.send.text(params)`\n\nSends plain or HTML text to one or more chats.\n\n```typescript\nawait bot.send.text({\n  to: [chatId1, chatId2],\n  message: \"Hello, how are you?\",\n});\n```\n\n---\n\n### `bot.send.mediaUrl(params)`\n\nSends a media group by URL (photos/videos). Telegram shows them as one album.\n\n```typescript\nawait bot.send.mediaUrl({\n  to: [chatId1, groupId1],\n  media: [\n    { type: \"photo\", url: \"https://example.com/1.jpg\" },\n    { type: \"photo\", url: \"https://example.com/2.jpg\" },\n    { type: \"video\", url: \"https://example.com/v.mp4\" },\n  ],\n  message: \"Caption (first item only)\",\n});\n```\n\n---\n\n### `bot.send.photo(params)`\n\nSends photo(s) via form-data (single file or album, up to 10). Use when you have buffers or blobs, not URLs.\n\n```typescript\nawait bot.send.photo({\n  to: [chatId1, groupId1],\n  files: [buffer1, buffer2],\n  message: \"Optional caption\",\n});\n```\n\n---\n\n### `bot.send.video(params)`\n\nSends video(s) via form-data (single file or album, up to 10).\n\n```typescript\nawait bot.send.video({\n  to: [chatId1],\n  files: [videoBuffer],\n  message: \"Optional caption\",\n});\n```\n\n---\n\n### `bot.send.html(params)`\n\nSends HTML content (Telegram subset: `<b>`, `<i>`, `<code>`, `<a>`, etc.).\n\n```typescript\nawait bot.send.html({\n  to: [chatId1],\n  html: \"<b>Subject:</b> Hello<br/><p>Body</p>\",\n});\n```\n\n---\n\n### `bot.health()`\n\nCalls GET /health (liveness). Returns `{ status, data }` with `data: { status?, timestamp? }`.\n\n```typescript\nconst result = await bot.health();\n```\n\n### `bot.config()`\n\nCalls GET /config. Returns multi-bot config (defaultBot + bots with masked tokens).\n\n```typescript\nconst result = await bot.config();\n```\n\n### `bot.send.test(params?)`\n\nSends a test message. Optional custom message and destinations.\n\n```typescript\nawait bot.send.test();\nawait bot.send.test({ to: [chatId1], message: \"Custom test\" });\n```\n\n---\n\n## Types\n\n### `ConfigBotParams`\n\n```typescript\ninterface ConfigBotParams {\n  id: string;   // required — bot identifier on the server (e.g. \"default\", \"alerts\")\n  api: string;  // base URL of the mail-tel API (no trailing slash)\n}\n```\n\n### `SendTextParams`\n\n```typescript\ninterface SendTextParams {\n  to?: string | string[];\n  message: string;\n}\n```\n\n### `SendMediaUrlParams`\n\n```typescript\ninterface SendMediaUrlParams {\n  to?: string | string[];\n  media: Array<{ type: \"photo\" | \"video\"; url: string }>;\n  message?: string;\n}\n```\n\n### `SendPhotoParams` / `SendVideoParams`\n\n```typescript\ninterface SendPhotoParams {\n  to?: string | string[];\n  files: Buffer[] | Blob[] | Array<{ buffer: Buffer; filename?: string }>;\n  message?: string;\n}\n```\n\n### `MailTelResponse<T>`\n\nUnified shape for all responses:\n\n```typescript\ninterface MailTelResponse<T = unknown> {\n  status: number;\n  data: T | null;\n  message?: string;\n  errors?: Array<{ message: string; code?: string }>;\n}\n```\n\n---\n\n## Examples\n\n**Basic text**\n\n```typescript\nconst bot = configBot({ api: \"https://mail.tel.api.gabster.ai\" });\nconst result = await bot.send.text({\n  to: [\"-1001234567890\"],\n  message: \"Hello!\",\n});\nif (result.status === 200 && result.data) {\n  console.log(result.data.sentTo);\n}\n```\n\n**Media by URL**\n\n```typescript\nconst result = await bot.send.mediaUrl({\n  to: [chatId1, chatId2],\n  media: [\n    { type: \"photo\", url: \"https://example.com/1.jpg\" },\n    { type: \"video\", url: \"https://example.com/v.mp4\" },\n  ],\n  message: \"Caption\",\n});\n```\n\n**Handle errors**\n\n```typescript\nconst result = await bot.send.text({ message: \"Hi\" });\nif (result.status >= 400) {\n  console.error(result.message ?? result.errors);\n}\n```\n\n**Photo from buffer (Node)**\n\n```typescript\nimport { readFileSync } from \"fs\";\nconst buffer = readFileSync(\"./photo.jpg\");\nawait bot.send.photo({\n  to: [chatId],\n  files: [buffer],\n  message: \"From file\",\n});\n```\n\n---\n\n## Dev Dependencies\n\n| Package     | Version  |\n| ----------- | -------- |\n| @types/node | ^20.19.33 |\n| rimraf      | ^5.0.5   |\n| typescript  | ^5.5.3   |\n\n---\n\n## Version History\n\n| Version | Notes          |\n| ------- | -------------- |\n| 1.0.0   | Initial release |\n","readmeFilename":"README.md"}