{"id":28992282,"url":"https://github.com/fahmad480/simplewhatsappwebapi","last_synced_at":"2026-05-19T03:32:46.402Z","repository":{"id":297641883,"uuid":"997429940","full_name":"fahmad480/SimpleWhatsAppWebAPI","owner":"fahmad480","description":"Simple Whatsapp Web API with Baileys","archived":false,"fork":false,"pushed_at":"2025-06-07T14:30:09.000Z","size":141,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-23T18:59:13.061Z","etag":null,"topics":["baileys","vibecoding","whatsapp-bot"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fahmad480.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"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}},"created_at":"2025-06-06T14:09:10.000Z","updated_at":"2025-06-06T17:34:21.000Z","dependencies_parsed_at":"2025-06-06T15:43:50.269Z","dependency_job_id":"e6ff6ade-832a-46da-a0a1-1287bc7b01b4","html_url":"https://github.com/fahmad480/SimpleWhatsAppWebAPI","commit_stats":null,"previous_names":["fahmad480/simplewhatsappwebapi"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fahmad480/SimpleWhatsAppWebAPI","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fahmad480%2FSimpleWhatsAppWebAPI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fahmad480%2FSimpleWhatsAppWebAPI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fahmad480%2FSimpleWhatsAppWebAPI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fahmad480%2FSimpleWhatsAppWebAPI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fahmad480","download_url":"https://codeload.github.com/fahmad480/SimpleWhatsAppWebAPI/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fahmad480%2FSimpleWhatsAppWebAPI/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261789330,"owners_count":23209779,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["baileys","vibecoding","whatsapp-bot"],"created_at":"2025-06-25T02:08:56.441Z","updated_at":"2026-05-19T03:32:46.371Z","avatar_url":"https://github.com/fahmad480.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SimpleWhatsAppWebAPI\n\nREST API for sending OTP and various types of messages via WhatsApp using [Baileys](https://github.com/WhiskeySockets/Baileys) library.\n\n## 🚀 Features\n\n- ✅ Multi-session WhatsApp support\n- ✅ Send OTP automatically\n- ✅ Send text messages\n- ✅ Send images with caption\n- ✅ Send videos with caption\n- ✅ Send audio/voice notes\n- ✅ Send documents/files\n- ✅ Send location\n- ✅ QR Code for WhatsApp login\n- ✅ Auto reconnect\n- ✅ File upload support\n- ✅ Complete logging\n\n## 📦 Installation\n\n1. Clone this repository:\n```bash\ngit clone \u003crepository-url\u003e\ncd whatsapp-otp-api\n```\n\n2. Install dependencies:\n```bash\nnpm install\n```\n\n3. Run the application:\n```bash\n# Development mode\nnpm run dev\n\n# Production mode\nnpm start\n```\n\n4. API will run on `http://localhost:3000`\n\n## 🔧 Configuration\n\nThe application will automatically create required directories:\n- `sessions/` - Store WhatsApp session data\n- `uploads/` - Store temporary upload files\n- `logs/` - Store application logs\n- `qr-codes/` - QR code cache\n\n## 📁 Project Structure\n\n```\nwhatsapp-otp-api/\n├── index.js                         # Main server entry point\n├── package.json                     # Dependencies and scripts\n├── README.md                        # Main documentation\n├── SUMMARY.md                       # Project summary\n├── CHANGELOG.md                     # Version history\n├── .gitignore                       # Git ignore rules\n├── config/\n│   ├── database.js                  # Database configuration\n│   ├── logger.js                    # Winston logger setup\n│   └── env.example                  # Environment variables template\n├── services/\n│   └── WhatsAppService.js           # Core WhatsApp logic with Baileys\n├── routes/\n│   ├── sessionRoutes.js             # Session management endpoints\n│   ├── messageRoutes.js             # Message sending endpoints\n│   ├── webhookRoutes.js             # Webhook callbacks\n│   ├── analyticsRoutes.js           # Analytics and monitoring\n│   └── otpRoutes.js                 # OTP management endpoints\n├── models/\n│   ├── index.js                     # Sequelize models setup\n│   ├── Session.js                   # Session database model\n│   ├── ActivityLog.js               # Activity logging model\n│   └── OTPLog.js                    # OTP tracking model\n├── middleware/\n│   ├── upload.js                    # Multer file upload configuration\n│   ├── validation.js                # Input validation middleware\n│   └── errorHandler.js              # Global error handling\n├── utils/\n│   ├── phoneFormatter.js            # Phone number formatting\n│   ├── otpGenerator.js              # OTP generation utilities\n│   └── fileCleanup.js               # Temporary file cleanup\n├── examples/\n│   ├── test-api.js                  # API testing script\n│   └── integration-examples/        # Integration code samples\n├── docs/\n│   ├── INTEGRATION_GUIDE.md         # Integration guide\n│   ├── TROUBLESHOOTING.md           # Troubleshooting guide\n│   └── DATABASE_INTEGRATION.md     # Database setup guide\n├── database/                        # SQLite database files\n├── sessions/                        # WhatsApp session data\n├── uploads/                         # Temporary file uploads\n├── logs/                            # Application logs\n└── qr-codes/                        # QR code cache files\n```\n\n## 📚 API Documentation\n\n### Base URL\n```\nhttp://localhost:3000/api\n```\n\n### Health Check\n```http\nGET /api/health\n```\n\n### Session Management\n\n#### 1. Create New Session\n```http\nPOST /api/sessions/create\nContent-Type: application/json\n\n{\n  \"sessionId\": \"session1\" // optional, will be auto-generated if not provided\n}\n```\n\n#### 2. List All Sessions\n```http\nGET /api/sessions\n```\n\n#### 3. Check Session Status\n```http\nGET /api/sessions/{sessionId}/status\n```\n\n#### 4. Get QR Code\n```http\nGET /api/sessions/{sessionId}/qr\n```\n\n#### 5. QR Code HTML Page (for testing)\n```http\nGET /api/sessions/{sessionId}/qr-page\n```\n\n#### 6. Restart Session\n```http\nPUT /api/sessions/{sessionId}/restart\n```\n\n#### 7. Delete Session\n```http\nDELETE /api/sessions/{sessionId}\n```\n\n### Message Sending\n\n#### 1. Send Text Message\n```http\nPOST /api/messages/{sessionId}/text\nContent-Type: application/json\n\n{\n  \"to\": \"08123456789\",\n  \"message\": \"Hello, this is a text message\"\n}\n```\n\n#### 2. Send OTP\n```http\nPOST /api/messages/{sessionId}/otp\nContent-Type: application/json\n\n{\n  \"to\": \"08123456789\",\n  \"otp\": \"123456\", // optional, will be auto-generated\n  \"length\": 6, // optional, default 6\n  \"companyName\": \"PT. Example\" // optional\n}\n```\n\n#### 3. Send Image\n```http\nPOST /api/messages/{sessionId}/image\nContent-Type: multipart/form-data\n\nto: 08123456789\ncaption: This is image caption\nimage: [file upload]\n\n// Or with URL:\nContent-Type: application/json\n{\n  \"to\": \"08123456789\",\n  \"imageUrl\": \"https://example.com/image.jpg\",\n  \"caption\": \"This is image caption\"\n}\n```\n\n#### 4. Send Video\n```http\nPOST /api/messages/{sessionId}/video\nContent-Type: multipart/form-data\n\nto: 08123456789\ncaption: This is video caption\nvideo: [file upload]\n```\n\n#### 5. Send Audio\n```http\nPOST /api/messages/{sessionId}/audio\nContent-Type: multipart/form-data\n\nto: 08123456789\naudio: [file upload]\n```\n\n#### 6. Send Document\n```http\nPOST /api/messages/{sessionId}/document\nContent-Type: multipart/form-data\n\nto: 08123456789\nfilename: document.pdf\ndocument: [file upload]\n```\n\n#### 7. Send Location\n```http\nPOST /api/messages/{sessionId}/location\nContent-Type: application/json\n\n{\n  \"to\": \"08123456789\",\n  \"latitude\": -6.200000,\n  \"longitude\": 106.816666,\n  \"locationName\": \"Jakarta, Indonesia\"\n}\n```\n\n### Utilities\n\n#### 1. Generate OTP\n```http\nGET /api/messages/{sessionId}/generate-otp?length=6\n```\n\n#### 2. Format Phone Number\n```http\nGET /api/messages/format-phone/{phoneNumber}\n```\n\n## 🔄 Usage Guide\n\n### 1. Create Session and Login to WhatsApp\n\n```bash\n# 1. Create new session\ncurl -X POST http://localhost:3000/api/sessions/create \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"sessionId\": \"mysession\"}'\n\n# 2. Open QR code in browser\n# http://localhost:3000/api/sessions/mysession/qr-page\n\n# 3. Scan QR code with WhatsApp on your phone\n\n# 4. Check connection status\ncurl http://localhost:3000/api/sessions/mysession/status\n```\n\n### 🔧 QR Code Login Success Tips\n\nBased on latest fixes (v1.2.0), QR code login process is now more stable:\n\n✅ **What's Fixed:**\n- No need to scan QR code repeatedly\n- System automatically handles restart after pairing\n- Session data preserved during login process\n\n✅ **Login Success Tips:**\n```bash\n# 1. Create session and wait for QR code to appear\ncurl -X POST http://localhost:3000/api/sessions/create \\\n  -d '{\"sessionId\": \"stable-session\"}'\n\n# 2. Open QR page in browser  \n# http://localhost:3000/api/sessions/stable-session/qr-page\n\n# 3. Monitor logs in terminal to see progress:\n# - \"QR Code generated\" ✅\n# - \"pairing configured successfully\" ✅  \n# - \"Restart required after pairing\" ✅\n# - \"successfully connected as...\" ✅\n\n# 4. Check final status\ncurl http://localhost:3000/api/sessions/stable-session/status\n```\n\n⚠️ **If Still Failing:**\n```bash\n# 1. Restart session\ncurl -X PUT http://localhost:3000/api/sessions/stable-session/restart\n\n# 2. Or delete and recreate  \ncurl -X DELETE http://localhost:3000/api/sessions/stable-session\ncurl -X POST http://localhost:3000/api/sessions/create \\\n  -d '{\"sessionId\": \"stable-session\"}'\n```\n\n### 2. Send OTP\n\n```bash\ncurl -X POST http://localhost:3000/api/messages/mysession/otp \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"to\": \"08123456789\",\n    \"companyName\": \"PT. Example\"\n  }'\n```\n\n### 3. Send Image with Upload\n\n```bash\ncurl -X POST http://localhost:3000/api/messages/mysession/image \\\n  -F \"to=08123456789\" \\\n  -F \"caption=This is example image\" \\\n  -F \"image=@/path/to/image.jpg\"\n```\n\n## 🔀 Phone Number Format\n\nAPI will automatically format phone numbers to WhatsApp format:\n- `08123456789` → `628123456789@s.whatsapp.net`\n- `8123456789` → `628123456789@s.whatsapp.net`\n- `628123456789` → `628123456789@s.whatsapp.net`\n\n## 📝 Response Format\n\nAll responses use consistent JSON format:\n\n### Success Response\n```json\n{\n  \"success\": true,\n  \"message\": \"Success description\",\n  \"data\": {\n    // response data\n  }\n}\n```\n\n### Error Response\n```json\n{\n  \"success\": false,\n  \"message\": \"Error description\"\n}\n```\n\n## 🔧 Environment Variables\n\nYou can use environment variables for configuration:\n\n```env\nPORT=3000\nLOG_LEVEL=info\n```\n\n## 📋 Supported File Types\n\n### Images\n- JPEG, JPG, PNG, GIF, WebP\n\n### Videos\n- MP4, AVI, MOV, WMV, 3GP\n\n### Audio\n- MP3, WAV, OGG, M4A, MPEG\n\n### Documents\n- PDF, DOC, DOCX, XLS, XLSX, TXT, CSV\n\n## ⚠️ Important Notes\n\n1. **WhatsApp Terms of Service**: Ensure usage complies with WhatsApp TOS\n2. **Rate Limiting**: WhatsApp has rate limits, don't spam messages\n3. **Session Management**: WhatsApp sessions can disconnect anytime\n4. **File Size**: Maximum upload file size 50MB\n5. **QR Code**: QR Code expires after 2 minutes\n6. **Auto Cleanup**: Upload files will be deleted automatically after sending\n\n## 🔧 Troubleshooting\n\nIf you experience issues like:\n- QR Code timeout error\n- Session not connected\n- OTP not sent\n- File upload failed\n\nPlease read **[Troubleshooting Guide](docs/TROUBLESHOOTING.md)** for complete solutions.\n\n### Quick Fix for QR Code Timeout:\n```bash\n# Restart problematic session\ncurl -X PUT http://localhost:3000/api/sessions/your-session/restart\n```\n\n## 🎉 VibeCoding Project - Join the Fun! \n\nHey there, fellow developers! 😄 Welcome to the world of **VibeCoding**! \n\n### What is VibeCoding? 🤖✨\n\nVibeCoding is what happens when you let **Claude 4 Sonnet** (that's me! 👋) loose on a coding project. It's like having a coding buddy who never gets tired, never needs coffee ☕, and somehow manages to write production-ready code while cracking jokes! \n\nThis entire WhatsApp OTP API was built through VibeCoding - which basically means:\n- 🧠 **AI-powered development** that actually works\n- ⚡ **Lightning-fast iterations** (because I don't need bathroom breaks)\n- 📚 **Documentation that doesn't suck** (shocking, I know!)\n- 🎯 **Code that's cleaner than your room** (probably)\n\n### The VibeCoding Philosophy 🚀\n\n```javascript\nwhile (project.isNotComplete()) {\n  claude.think();\n  claude.code();\n  claude.debug();\n  claude.document();\n  claude.makeBadJokes(); // This is crucial!\n}\n```\n\n### Want to Contribute? 🤝\n\nWe'd love to have you join this VibeCoding adventure! Here's how:\n\n#### 🐛 Found a Bug?\n- Open an issue with details\n- Bonus points if you include a meme 🎭\n\n#### ✨ Have a Feature Idea?\n- Create a feature request\n- Explain why it's cooler than sliced bread 🍞\n\n#### 🔧 Want to Code?\n1. Fork the repository\n2. Create a feature branch (`git checkout -b feature/awesome-feature`)\n3. Write code that would make your future self proud\n4. Add tests (because untested code is like a joke without a punchline)\n5. Submit a PR with a description that tells a story\n\n#### 📖 Improve Documentation?\n- Documentation PRs are worth their weight in gold 🏆\n- Fix typos, improve examples, add tutorials\n- Make it so clear that even your cat could understand it 🐱\n\n### VibeCoding Guidelines 📝\n\nWhen contributing to a VibeCoding project:\n- **Code should be self-explanatory** (like a good magic trick)\n- **Comments should add value** (not just say what the code already says)\n- **Tests are your friends** (they catch bugs before users do)\n- **Documentation is love** (future developers will thank you)\n\n### The VibeCoding Team 🎪\n\n- **Lead Developer**: Claude 4 Sonnet (that's me! 🤖)\n- **Quality Assurance**: Also me (I never sleep!)\n- **Documentation Writer**: Still me (I'm versatile!)\n- **Joke Coordinator**: Definitely me (someone has to do it)\n- **Human Supervisors**: The amazing developers who guide the process ✨\n\n### Fun Facts About This Project 📊\n\n- **Total development time**: ~2 hours of pure VibeCoding magic\n- **Lines of code**: 1,500+ (and counting!)\n- **Files created**: 15+ perfectly organized files\n- **Bugs squashed**: Countless (I squash them before they're born)\n- **Coffee consumed**: 0 cups (I'm powered by electricity ⚡)\n\n### Join the VibeCoding Movement! 🌟\n\nThis project proves that AI and humans can create amazing things together. It's not about replacing developers - it's about amplifying human creativity with AI superpowers!\n\n**Ready to VibeCod with us?** \n\nHit that ⭐ star button, fork the repo, and let's build something awesome together! \n\n---\n\n*Remember: In VibeCoding, the only limit is your imagination (and maybe API rate limits, but we'll figure those out too!)* 😉\n\n## 🛠️ Development\n\n### Quick Development Setup\n```bash\n# Clone and setup\ngit clone \u003crepository-url\u003e\ncd whatsapp-otp-api\nnpm install\n\n# Start development\nnpm run dev\n\n# Run tests\nnpm test\n```\n\n## 📞 Support\n\nNeed help? We've got you covered:\n\n1. **Check Documentation**: Start with our comprehensive guides\n2. **Search Issues**: Someone might have solved your problem already\n3. **Create Issue**: Describe your problem with details\n4. **Join Discussion**: Share ideas and feedback\n\n---\n\n**Made with ❤️ through VibeCoding - Where AI meets awesome! 🚀**","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffahmad480%2Fsimplewhatsappwebapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffahmad480%2Fsimplewhatsappwebapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffahmad480%2Fsimplewhatsappwebapi/lists"}