WhatsApp Price Bot
An innovative solution for real-time customer engagement with interactive messaging and Google Spreadsheet integration.
Timeline
3 weeks
Role
Full Stack Developer
Team
Solo
Status
CompletedTechnology Stack
Key Challenges
- Real-time data synchronization with Google Sheets
- Managing WhatsApp Business API rate limits
- Implementing whitelist security feature
- Handling concurrent customer requests
Key Learnings
- WhatsApp Business API integration
- Google Sheets API automation
- Real-time messaging systems
- Customer engagement optimization
Overview
The WhatsApp Price Bot is an innovative solution engineered for real-time customer engagement. It comes equipped with interactive messaging capabilities that not only inform but also engage your audience. A unique whitelist option adds an extra layer of exclusivity, allowing only selected numbers to receive messages.
What sets this bot apart is its ability to fetch real-time data directly from a Google Spreadsheet. This ensures that your customers are always in the loop with the most current and relevant information. It's more than just a bot; it's a comprehensive tool for enhancing customer interaction and satisfaction.
Key Features
🔐 Whitelist Security
- Exclusive access control for authorized numbers
- Prevents spam and unauthorized access
- Easy whitelist management interface
- Secure customer communication channel
📊 Real-time Google Sheets Integration
- Automatic data synchronization from Google Spreadsheets
- Live price updates without manual intervention
- Dynamic content delivery based on sheet data
- Support for multiple sheets and data formats
💬 Interactive Messaging
- Two-way communication with customers
- Automated responses to common queries
- Rich message formatting (text, images, buttons)
- Quick reply templates for faster engagement
⚡ Performance Optimized
- Fast response times under 2 seconds
- Handles multiple concurrent requests
- Automatic retry mechanism for failed messages
- Rate limit management for API compliance
Technical Implementation
Architecture
// Bot initialization with WhatsApp API
const bot = new WhatsAppBot({
apiKey: process.env.WHATSAPP_API_KEY,
webhookUrl: process.env.WEBHOOK_URL,
whitelist: loadWhitelist(),
});
// Google Sheets integration
const sheets = new GoogleSheetsAPI({
spreadsheetId: process.env.SPREADSHEET_ID,
credentials: process.env.GOOGLE_CREDENTIALS,
});
// Message handler
bot.onMessage(async (message) => {
if (!isWhitelisted(message.from)) {
return bot.send(message.from, 'Unauthorized access');
}
const priceData = await sheets.getLatestPrices();
return bot.send(message.from, formatPriceMessage(priceData));
});Google Sheets Setup
The bot connects to a Google Spreadsheet with the following structure:
| Product Name | Price | Last Updated | Status | | ------------ | ----- | ------------ | ------ | | Product A | $99 | 2024-01-31 | Active | | Product B | $149 | 2024-01-31 | Active |
Whitelist Management
// Add number to whitelist
POST /api/whitelist
{
"phoneNumber": "+1234567890",
"name": "Customer Name"
}
// Remove from whitelist
DELETE /api/whitelist/:phoneNumber
// List all whitelisted numbers
GET /api/whitelistUse Cases
E-commerce Price Updates
- Send automated price updates to premium customers
- Notify about flash sales and special offers
- Share product availability information
- Handle customer inquiries about pricing
Service Booking
- Real-time availability from Google Sheets
- Instant booking confirmations
- Appointment reminders
- Service price quotes
Inventory Management
- Stock level notifications
- Low inventory alerts
- New arrival announcements
- Bulk order processing
Performance Metrics
- Response Time: < 2 seconds average
- Message Delivery Rate: 99.8%
- Concurrent Users: Supports 100+ simultaneous conversations
- Uptime: 99.9% availability
- Data Sync: Real-time updates every 30 seconds
Security Features
- End-to-end encryption for all messages
- Whitelist-based access control
- API key authentication
- Rate limiting to prevent abuse
- Secure webhook validation
- No storage of customer messages
Future Enhancements
- Multi-language support
- AI-powered chatbot responses
- Advanced analytics dashboard
- Payment integration
- Image recognition for product queries
- Voice message support
Lessons Learned
Building this WhatsApp bot taught me valuable lessons about real-time communication systems and API integration. The key challenges were managing rate limits while maintaining fast response times and ensuring data consistency between Google Sheets and the bot.
The whitelist feature proved essential for businesses that wanted to provide exclusive information to premium customers. The Google Sheets integration made it incredibly easy for non-technical users to update prices and information without touching any code.
Conclusion
The WhatsApp Price Bot successfully bridges the gap between businesses and customers by providing instant, automated, and personalized communication. It demonstrates how combining different APIs and services can create a powerful tool for customer engagement and satisfaction.
The project showcases the practical application of modern messaging APIs, real-time data synchronization, and secure communication channels in building scalable customer engagement solutions.
