{"id":49507508,"url":"https://github.com/ctrixcode/discord-webhook-library","last_synced_at":"2026-05-01T17:36:21.035Z","repository":{"id":309656390,"uuid":"1037062020","full_name":"ctrixcode/discord-webhook-library","owner":"ctrixcode","description":"A powerful and easy-to-use library for creating and sending richly formatted messages to Discord webhooks, with built-in validation and rate-limiting.","archived":false,"fork":false,"pushed_at":"2025-10-11T16:02:22.000Z","size":794,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":0,"default_branch":"launchpad","last_synced_at":"2026-02-17T08:42:48.260Z","etag":null,"topics":["api","discord","hacktoberfest","hacktoberfest-accepted","hacktoberfest25","library","message","webhook"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/discord-webhook-library","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ctrixcode.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-13T02:28:35.000Z","updated_at":"2025-11-04T17:11:40.000Z","dependencies_parsed_at":"2025-08-13T05:36:13.323Z","dependency_job_id":"493d0c03-f36d-4a7f-aa18-1878e501af69","html_url":"https://github.com/ctrixcode/discord-webhook-library","commit_stats":null,"previous_names":["ctrixcode/discord-webhook-library"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ctrixcode/discord-webhook-library","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctrixcode%2Fdiscord-webhook-library","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctrixcode%2Fdiscord-webhook-library/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctrixcode%2Fdiscord-webhook-library/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctrixcode%2Fdiscord-webhook-library/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ctrixcode","download_url":"https://codeload.github.com/ctrixcode/discord-webhook-library/tar.gz/refs/heads/launchpad","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctrixcode%2Fdiscord-webhook-library/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32507091,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","discord","hacktoberfest","hacktoberfest-accepted","hacktoberfest25","library","message","webhook"],"created_at":"2026-05-01T17:36:19.030Z","updated_at":"2026-05-01T17:36:20.335Z","avatar_url":"https://github.com/ctrixcode.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚀 Discord Webhook Library\n\nA powerful, modern Node.js library for creating and sending richly formatted messages to Discord webhooks.\n\n---\n\n## 📝 Overview\n\nDiscord Webhook Library makes it easy to construct and send complex Discord webhook messages, including embeds, files, and advanced features. Its intuitive API lets you build messages using a fluent builder or simple options objects, with robust validation and error handling.\n\n---\n\n## 🆕 What's New in 0.9.2\n\n- **Multi-webhook support:** Send messages to multiple webhooks in one go.\n\n---\n\n## ✨ Features\n\n- **Custom Error Classes:** (`WebhookError`, `ValidationError`, `RequestError`, `FileSystemError`) for clear, actionable errors.\n- **Flexible Message Creation:** Use a builder pattern or options object.\n- **User Identity:** Set `username` and `avatar_url` per message.\n- **Rich Content:** Send plain text, embeds, and files.\n- **Embeds:** Full support for all Discord embed fields:\n  - `title`, `description`, `color`, `author`, `fields`, `thumbnail`, `image`, `footer`, `timestamp`\n- **Zod Validation:** Ensures payloads meet Discord API limits.\n- **Axios-based HTTP Client:** Reliable requests with built-in rate-limiting.\n- **File Attachments:** Send files with or without messages.\n- **Pre-styled Helper Embeds:** Quickly send info, success, warning, and error messages.\n- **Thread Support:** Specify `thread_name` for forum channels.\n- **Message Flags:** Set advanced message properties.\n- **Batch Sending:** Queue and send multiple messages at once.\n- **Payload Inspection:** View generated JSON before sending.\n- **Edit \u0026 Delete Messages:** Update or remove sent messages.\n- **Text-to-Speech:** Use Discord’s `tts` feature.\n- **Expanded Test Coverage:** Comprehensive tests for all scenarios.\n\n---\n\n## 📦 Installation\n\n```bash\npnpm add discord-webhook-library axios form-data\n# or\nnpm install discord-webhook-library axios form-data\n# or\nyarn add discord-webhook-library axios form-data\n```\n\n---\n\n## 🏁 Quickstart\n\n```typescript\nimport { Webhook, Message, Embed, Field } from 'discord-webhook-library';\n\nconst hook = new Webhook('YOUR_WEBHOOK_URL');\n\n// Basic message\nhook.addMessage(new Message({\n  content: 'Hello from the Discord Webhook Library!',\n  username: 'My Bot',\n  avatar_url: 'https://i.imgur.com/AfFp7pu.png',\n}));\n\n// Rich embed\nconst embed = new Embed()\n  .setTitle('New Feature!')\n  .setDescription('Major update released!')\n  .setColor(0x0099ff)\n  .setTimestamp(new Date())\n  .setAuthor({ name: 'Gemini Dev', icon_url: 'https://i.imgur.com/AfFp7pu.png' })\n  .setFooter({ text: 'Powered by Gemini', icon_url: 'https://i.imgur.com/AfFp7pu.png' })\n  .setImage('https://i.imgur.com/AfFp7pu.png')\n  .setThumbnail('https://i.imgur.com/AfFp7pu.png')\n  .addField(new Field('Version', '0.9.0', true))\n  .addField(new Field('Status', 'Stable', true));\n\nhook.addMessage(new Message({\n  content: 'Check out this cool embed!',\n  embeds: [embed],\n}));\n\n// Send all queued messages\nawait hook.send();\n```\n\n---\n\n## 🧑‍💻 Advanced Usage\n\n### Send a File\n\n```typescript\nawait hook.sendFile('./my_file.txt');\n```\n\n### Send a File with a Message\n\n```typescript\nconst fileMsg = new Message({ content: 'Here is a file with a message!' });\nawait hook.sendFile('./my_file.txt', fileMsg);\n```\n\n### Pre-styled Helper Embeds\n\n```typescript\nawait hook.info('System Update', 'Server restarts in 5 minutes.');\nawait hook.success('Deployment Successful!');\nawait hook.warning('Low Disk Space', 'Only 10% left.');\nawait hook.error('Critical Error', 'DB connection failed.');\n```\n\n### Message with Only an Embed\n\n```typescript\nconst embedOnlyMsg = new Message({\n  embeds: [\n    new Embed()\n      .setTitle('Embed Only Message')\n      .setDescription('This message has no content, only an embed.')\n      .setColor(0xffa500),\n  ],\n});\nhook.addMessage(embedOnlyMsg);\n```\n\n### Batch Sending\n\n```typescript\nhook.addMessage(new Message({ content: 'First batch message.' }));\nhook.addMessage(new Message({ content: 'Second batch message.' }));\nawait hook.send();\n```\n\n### Edit an Existing Message\n\n```typescript\nconst MESSAGE_LINK_TO_EDIT = 'https://discord.com/channels/YOUR_GUILD_ID/YOUR_CHANNEL_ID/YOUR_MESSAGE_ID';\nconst editedMsg = new Message({\n  content: 'This message has been updated!',\n  editTarget: MESSAGE_LINK_TO_EDIT,\n});\nhook.addMessage(editedMsg);\nawait hook.send();\n```\n\n### Delete an Existing Message\n\n```typescript\nawait hook.delete('YOUR_MESSAGE_ID');\n```\n\n### Inspect Payloads\n\n```typescript\nconsole.log(hook.getPayloads());\n```\n\n### Clear the Queue\n\n```typescript\nhook.clearMessages();\nconsole.log('Queue cleared. Messages in queue:', hook.getPayloads().length);\n```\n\n---\n\n## 🛡️ Browser Compatibility \u0026 Backend Proxy\n\n\u003e **Node.js only!**  \n\u003e Direct browser use is not recommended due to CORS and security risks.  \n\u003e Use this library on your backend server as a proxy.\n\n- **CORS:** Browsers block direct requests to Discord’s API.\n- **Security:** Never expose your webhook URL in client-side code.\n\nFor browser apps, send requests to your backend, which uses this library to send messages to Discord.\n\n---\n\n## 🛠️ Development \u0026 Contributing\n\nThis project uses [Husky](https://typicode.github.io/husky/) for Git hooks:\n\n- **`pre-commit` hook:** Runs `eslint` and `prettier` on staged files.\n- **`pre-push` hook:** Auto-bumps patch version on `main` branch.\n\n\u003e ⚠️ Every push to `main` creates a new version commit and tag.  \n\u003e For production, consider a dedicated release pipeline.\n\n---\n\n## 📚 Resources\n\n- [Discord Webhook Docs](https://discord.com/developers/docs/resources/webhook)\n\n---\n\n## 📝 License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fctrixcode%2Fdiscord-webhook-library","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fctrixcode%2Fdiscord-webhook-library","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fctrixcode%2Fdiscord-webhook-library/lists"}