@dzns/whatapp-server
v0.0.4
Published
Whatsapp Server By Dznes
Downloads
18
Readme
WhatsApp Client SDK
A custom Node.js SDK for interacting with the WhatsApp Cloud API, including media upload, message handling, and more.
🚀 Getting Started
1. Clone the repository
git clone https://github.com/dznes/whatsapp-client.git
cd whatsapp-client2. Install dependencies
npm install🧩 Project Structure
src/
├── clients/
│ ├── message.ts # Generic request client with request/response logging
│ └── media.ts # Handles media uploads to WhatsApp Cloud API
├── utils/
│ └── validation.ts # (Planned) Zod runtime validators
.env # Environment config
README.md # Project documentation📌 TODOs
[ ] Add runtime validations using
zodor similar:Validate token and environment in
BaseClientconstructorValidate body input shape for all request methods
[ ] Enhance
MediaClient:[ ] Detect MIME type and set appropriate
Content-Typeheaders for each media file- [ ] Format
bodyintoFormDatafor/mediaendpoints using file streams
- [ ] Format
[ ] Add retry logic with exponential backoff (especially for 429 rate-limit errors)
- [ ] Add logging configuration:
Allow toggling verbose mode (debug logs vs. silent prod)
- [x] Create unit tests for
BaseClientandMediaClientusing Jest or Vitest - [x] Type-safe configuration loading from
.env
- [x] Create unit tests for
🔒 Authentication
Set your token in an `.env` file:WHATSAPP_TOKEN=your_facebook_access_token_hereOr pass it directly to the client constructor:
const client = new BaseClient("your_token_here");📄 License
MIT
