Building an AI-Powered WhatsApp Market Alert System with n8n
Overview
Automate daily financial market summaries delivered directly to WhatsApp using n8n’s powerful workflow automation. This workflow scrapes multiple Indian financial news sources, generates AI-powered summaries, and broadcasts them to subscribers—all without writing complex backend code.
What This Workflow Does
This n8n workflow creates a fully automated daily market alert system that:
-
Scrapes financial news from multiple trusted sources
-
Processes and cleans data using AI
-
Generates concise, WhatsApp-friendly market summaries
-
Broadcasts personalized alerts to active subscribers
-
Logs delivery metrics for analytics
Architecture Overview
Manual Trigger → Scrape News → Process Data → AI Summary →
Get Subscribers → Format Messages → Batch Send → Log Results
Key Components Breakdown
1.
Multi-Source News Scraping
The workflow pulls data from three major Indian financial news sources:
-
Moneycontrol - Business & stocks news
-
ET Markets - Economic Times markets section
-
LiveMint - Stock market news
Implementation: Uses dynamic CSS selectors for each source to extract headlines, links, and summaries.
{
name: 'Moneycontrol',
url: 'https://www.moneycontrol.com/news/business/stocks/',
containerSelector: 'ul',
titleSelector: 'h2 a',
limit: 15,
type: 'business'
}
2.
Data Processing & Cleaning
Raw HTML is cleaned and normalized:
-
Removes scripts, styles, and comments
-
Strips unnecessary whitespace
-
Validates data completeness
-
Timestamps each source
3.
AI-Powered Summarization
Uses OpenRouter Chat Model (Mistral-7B) to generate structured summaries with:
-
Top Headlines - 2-3 key market-moving stories -
Market Movers - Top gainers/losers with percentages -
Technical Outlook - NIFTY 50 & Sensex analysis -
Key Events - Earnings, economic data, policy meetings
Prompt Engineering: The AI agent receives detailed instructions to format output specifically for WhatsApp (under 1000 characters, emoji-rich, professional yet engaging).
4.
Subscriber Management
Integrates with Google Sheets to:
-
Fetch active subscriber list
-
Filter by status and valid phone numbers
-
Support dynamic subscriber management (no code deploys needed)
5.
WhatsApp Broadcasting via Twilio
-
Formats messages with WhatsApp markdown
-
Includes unsubscribe option
-
Batch processes subscribers (10 at a time) to avoid rate limits
-
Handles failures gracefully
6.
Analytics & Logging
Tracks:
-
Total broadcasts sent
-
Success/failure rates
-
Subscriber engagement
-
Historical summaries for analysis
Technical Highlights
Smart Batch Processing
batchSize: 10
// Prevents API rate limiting while ensuring delivery
Error Handling
-
Validates scraped data length
-
Logs failed deliveries with phone numbers
-
Continues execution even if individual sources fail
Phone Number Formatting
to: "+91" + $json.phone
// Automatically formats Indian phone numbers
Use Cases Beyond Finance
This workflow pattern can be adapted for:
-
Daily News Digests - Any niche topic
-
E-commerce Price Alerts - Track competitor pricing
-
Social Media Monitoring - Brand mentions & sentiment
-
Weather/Traffic Updates - Location-based alerts
-
Content Publishing - Automated newsletter distribution
Required Services
-
n8n (self-hosted or cloud)
-
OpenRouter (AI model access)
-
Twilio (WhatsApp Business API)
-
Google Sheets (subscriber management)
Key Advantages
No Backend Required - Everything runs in n8n
Visual Workflow Builder - Easy to modify and debug
Scalable - Handles batching and rate limits automatically
Cost-Effective - Pay only for API usage (OpenRouter + Twilio)
Maintainable - Update sources/prompts without code changes
Performance Considerations
-
Scraping Duration: ~5-10 seconds per source
-
AI Processing: ~10-15 seconds for summary generation
-
WhatsApp Delivery: ~2-3 seconds per message
-
Total Runtime: ~3-5 minutes for 50 subscribers
Security Best Practices
-
API credentials stored in n8n’s credential manager
-
Phone numbers dynamically loaded (not hardcoded)
-
Rate limiting prevents abuse
-
Unsubscribe mechanism included
-
GDPR-compliant subscriber management
Future Enhancements
-
Personalization: Tailor summaries based on user preferences
-
Interactive Responses: Handle replies (STOP, HELP, etc.)
-
Multi-Language Support: Use AI translation for regional languages
-
Sentiment Analysis: Include market sentiment scores
-
Chart Generation: Attach visual charts to messages
Conclusion
This n8n workflow demonstrates how powerful automation can be achieved with minimal code. By combining web scraping, AI summarization, and messaging APIs, you can build production-ready notification systems that scale.