Send WhatsApp messages, templates, and rich media directly from your application. Integrate in minutes with comprehensive REST API and real-time delivery tracking.
REST API
v1.0.0
Bearer Token Auth
HTTPS Secure
Real-Time Queue
Fast Delivery
Understanding Chat Mitra API
Chat Mitra provides a simple, powerful REST API for sending WhatsApp messages at scale. Whether you're building customer support chatbots, marketing automation, or order notifications, our API handles it all with enterprise-grade reliability. This guide covers WhatsApp API integration basics for beginners to advanced developers.
What You Can Do
Send text messages, templates, and rich media (images, videos, documents, audio)
Send interactive messages with buttons and dropdown lists
Batch send to multiple customers in single API call
Track delivery status in real-time with detailed reporting
Use dynamic templates with customer-specific placeholders
Key Concepts
Conversations
A 24-hour messaging window between you and one customer. First message to a new customer initiates a conversation (costs 1 credit, approx. ₹0.20 based on region), then unlimited free messages within the 24-hour window. Why this matters: This ensures compliance with WhatsApp's user-initiated conversation rules, reducing spam risks. Think of it like a timed chat session—start one, then chat freely until it expires.
Message Types
Text, Templates, Images, Videos, Documents, Audio, Location, Contacts, Interactive (Buttons/Lists), Reactions, and Stickers. Each has specific validation rules. What this means: Choose based on your use case, like text for simple notifications or interactive for user responses.
Raw Messages
Raw messages (also known as free-form or session messages) include custom text, media, interactive elements, and more. They can only be sent within an active 24-hour customer service window, which starts when the customer initiates contact (e.g., sends the first message). These messages are free of charge within the window, as per Meta's policies—no per-message fees apply. Why use raw messages: They allow flexible, personalized communication during active conversations without additional costs.
Template Messages
Template messages are pre-approved formats with dynamic placeholders for personalization. They can be sent at any time, including to initiate new conversations or re-engage outside the 24-hour window. Templates are charged per delivered message based on category (marketing, utility, authentication) and recipient's country/region, as per Meta's pricing (effective July 2025). Utility templates are free when sent within an active window; marketing and authentication templates are charged regardless. Why use templates: They enable proactive outreach while complying with WhatsApp rules, like pre-filled forms for quick, scalable messaging.
Templates
Pre-approved WhatsApp message formats with dynamic placeholders. Create and manage in your dashboard. Templates are reusable, faster to send, and cost-effective. Why use templates: They bypass content review for each message, enabling faster sends and lower costs—like pre-filled forms for quick personalization.
Queue System
Messages are queued and processed asynchronously for guaranteed delivery. API returns immediately with job ID for tracking. Retry logic handles transient failures automatically. Why this matters: Ensures reliability even during high traffic, like a buffer in a busy restaurant kitchen.
Sign up at https://app.chatmitra.com/signup . You get instant access.
2
Get Your API Token
Navigate to Dashboard → API → API Key. Copy your Bearer Token and store it securely in your .env file.
3
Verify Your WhatsApp Number
Add your WhatsApp Business Phone number in Dashboard → Phone Numbers. This is your sender ID. Ensure your number is verified with Meta's WhatsApp Business API.
4
Install Dependencies
Install axios (Node.js) or requests (Python) to make API calls. Or use cURL for quick testing. These install HTTP clients for sending requests to the WhatsApp API integration endpoint.
5
Send Your First Message
Make your first API request. Copy a code example from the Send Messages section and customize it. Prerequisites: Have your token ready and a valid recipient number.
No Installation Needed for cURL
You can test the API immediately with cURL. No npm, pip, or dependencies required. Perfect for quick testing and integration validation.
Send Raw Messages
Send immediate text, media, and interactive messages via WhatsApp Business API. Perfect for real-time communication within the 24-hour conversation window.
POST /send_message
The primary endpoint for sending WhatsApp messages. Accepts text, templates, media, and interactive messages. Queues messages for reliable delivery.
Why use this endpoint: It's the core for all WhatsApp API integration, handling everything from simple texts to complex interactions in real-time.
Raw Messages Require Active 24-Hour Window
Raw messages (text, media, interactive) can only be sent when a 24-hour conversation window is active. This window opens when a customer sends you a message and lasts for 24 hours from their last message.
Inside 24-hour window: Send any raw message type freely
Window resets: Every incoming customer message restarts the 24-hour countdown
Failure scenario: Sending raw messages outside the window returns error code 131026
When to Use Raw Messages vs Templates
Use Raw Messages For:
Customer support conversations
Real-time chatbot responses
Immediate media sharing (receipts, photos)
Interactive button responses
Any message within 24h of customer contact
Use Templates For:
First contact with customers
Messages outside 24-hour window
Marketing broadcasts
Appointment reminders (proactive)
Order confirmations (if no recent interaction)
Chatmitra Pricing & Conversation Costs
Raw messages sent within the 24-hour window are charged as part of conversation-based pricing. Chatmitra uses Meta's official WhatsApp Business API pricing with competitive platform fees.
Conversation Categories:
User-Initiated: Customer messages first (24h window opens) - Lower rate
Business-Initiated: You message first using Templates - Higher rate
Free Entry Points: Some customer entry points offer free 72-hour windows
View country-specific rates. Chatmitra adds a small platform fee on top of Meta's base rates. Raw messages within 24h window are typically charged as "User-Initiated Conversations."
Raw Message Best Practices
Always check if 24-hour window is active before sending raw messages
Use templates for the first message, then switch to raw messages after customer replies
Keep text messages under 1000 characters for optimal delivery
Compress media files to recommended sizes for faster sending
Use interactive buttons to encourage customer responses (resets 24h window)
Implement fallback to templates if raw message fails due to expired window
Raw messages (text, media, interactive) can only be sent when a 24-hour conversation window is active
This window opens when a customer sends you a message and lasts for 24 hours from their last message.
Simple Text Message
Send a basic text message. No setup required, works instantly. What this demonstrates: A straightforward way to send WhatsApp messages via REST API without templates or media.
Request
json
{
"recipient_mobile_number": "919999999999",
"message": "Hello! Your order #12345 is ready for pickup 📦"
}
Preview
C
Customer
online
Hello! Your order #12345 is ready for pickup 📦
Type a message
Preview of message sent to Customer
Full code examples to send this request in multiple languages. All examples use the same payload, handle errors, and are ready to run (replace 'YOUR_TOKEN' with your actual token).
python
import requests
import os
# Load environment variables
token = os.getenv('CHATMITRA_API_TOKEN')
url = os.getenv('CHATMITRA_API_URL', 'https://backend.chatmitra.com/developer/api/send_message')
payload = {
"recipient_mobile_number": "919999999999",
"message": "Hello! Your order #12345 is ready for pickup 📦"
}
headers = {
'Authorization': f'Bearer {token}',
'Content-Type': 'application/json'
}
try:
response = requests.post(url, json=payload, headers=headers)
response.raise_for_status() # Raise error for bad status
print(response.json()) # Expected: {'status': 'success', 'message': 'Request queued', 'jobId': 'job_abc123xyz789'}
except requests.exceptions.RequestException as e:
print(f"Error: {e}") # Handle network or API errors
Your message is queued and will be delivered within 5-30 seconds. The jobId can be used to track delivery status. Note: Check dashboard for status using jobId, or implement webhooks for real-time updates (see API Reference for best practices).
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
class Program {
static async Task Main(string[] args) {
string token = Environment.GetEnvironmentVariable("CHATMITRA_API_TOKEN");
string url = Environment.GetEnvironmentVariable("CHATMITRA_API_URL") ?? "https://backend.chatmitra.com/developer/api/send_message";
string payload = @"
{
""recipient_mobile_number"": ""919999999999"",
""messages"": [
{
""kind"": ""raw"",
""payload"": {
""type"": ""image"",
""image"": {
""link"": ""https://cloudinary.com/product-image.jpg"",
""caption"": ""Check out our new product!""
}
}
}
]
}";
using (HttpClient client = new HttpClient()) {
client.DefaultRequestHeaders.Add("Authorization", $"Bearer {token}");
client.DefaultRequestHeaders.Add("ContentType", "application/json");
try {
HttpContent content = new StringContent(payload, Encoding.UTF8, "application/json");
HttpResponseMessage response = await client.PostAsync(url, content);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseBody);
} catch (HttpRequestException e) {
Console.WriteLine("Error: " + e.Message);
}
}
}
}
swift (ios)
import Foundation
let token = ProcessInfo.processInfo.environment["CHATMITRA_API_TOKEN"] ?? ""
var urlString = ProcessInfo.processInfo.environment["CHATMITRA_API_URL"] ?? "https://backend.chatmitra.com/developer/api/send_message"
guard let url = URL(string: urlString) else { return }
let payload: [String: Any] = [
"recipient_mobile_number": "919999999999",
"messages": [
[
"kind": "raw",
"payload": [
"type": "image",
"image": [
"link": "https://cloudinary.com/product-image.jpg",
"caption": "Check out our new product!"
]
]
]
]
]
do {
let jsonData = try JSONSerialization.data(withJSONObject: payload)
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("Bearer \(token)", forHTTPHeaderField: "Authorization")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpBody = jsonData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
if let error = error {
print("Error: \(error.localizedDescription)")
return
}
if let data = data, let responseString = String(data: data, encoding: .utf8) {
print(responseString)
}
}
task.resume()
} catch {
print("Error: \(error.localizedDescription)")
}
kotlin (android)
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.RequestBody.Companion.toRequestBody
import java.io.IOException
fun main() {
val token = System.getenv("CHATMITRA_API_TOKEN") ?: ""
val url = System.getenv("CHATMITRA_API_URL") ?: "https://backend.chatmitra.com/developer/api/send_message"
val payload = """
{
"recipient_mobile_number": "919999999999",
"messages": [
{
"kind": "raw",
"payload": {
"type": "image",
"image": {
"link": "https://cloudinary.com/product-image.jpg",
"caption": "Check out our new product!"
}
}
}
]
}
""".trimIndent()
val client = OkHttpClient()
val requestBody = payload.toRequestBody("application/json".toMediaType())
val request = Request.Builder()
.url(url)
.post(requestBody)
.addHeader("Authorization", "Bearer $token")
.addHeader("Content-Type", "application/json")
.build()
try {
client.newCall(request).execute().use { response ->
if (!response.isSuccessful) throw IOException("Unexpected code $response")
println(response.body!!.string())
}
} catch (e: IOException) {
println(e.message)
}
}
How to Get Public HTTPS Links
Upload your image to Cloudinary (free, easy), AWS S3, or your own server. Get the public HTTPS link and use it in the API request. No direct file upload needed. Prerequisites: Ensure the link is accessible without authentication.
Send store locations, delivery addresses, event venues, office locations, or meeting spots. Customer can tap to open in Google Maps directly. Tip: Use accurate coords for best user experience.
Interactive Message - Buttons
Send clickable buttons for better user engagement and response collection. Why this matters: Increases interaction rates, like adding choices to a survey.
Full code examples to send this interactive button message in multiple languages. All examples use the same payload, handle errors, and are ready to run.
Send dropdown lists for options selection (product categories, support topics, etc). Break down: First, define sections, then rows with IDs for responses.
Send images, videos, documents, and audio files via WhatsApp. All files must be hosted on public HTTPS URLs. Recommended: Use cloud storage services like Cloudinary, AWS S3, or your own server. Use permanent URLs as WhatsApp caches media for 30 days. Why this matters: Ensures media loads reliably without breaking links.
Supported File Types & Size Limits
Media Type
Formats
Max Size
Best Practices
Image
JPG, PNG, WEBP
5 MB
1-2 MB for fast loading
Video
MP4, 3GP
16 MB
H.264 codec, 5-16 MB
Audio
MP3, OGG, OPUS
16 MB
128 kbps bitrate
Document
PDF, DOC, DOCX, XLS, XLSX, PPT, PPTX, TXT
100 MB
PDF preferred
Sticker
WEBP (static/animated)
500 KB
Square format, 512x512 pixels, transparent background recommended
HTTPS Required for All Media URLs
Localhost URLs and private IP addresses (192.168.*, 10.*, 127.*) are blocked for security. Always use public HTTPS URLs. Size limits ensure fast delivery; exceeding them causes failures. See Errors tab for fixes.
24-Hour Window & Media Messages
Media messages follow the same 24-hour window rules as text messages. If you need to send media outside the 24-hour window, you must use Media Template Messages (pre-approved templates with media headers) instead of raw media messages.
WhatsApp Business API Template Messages
Pre-approved message templates for marketing campaigns, utility notifications, and authentication. Optimize customer engagement with Meta's official WhatsApp Business Platform.
POST /send_message
Send pre-approved template messages. Templates support dynamic parameters, media headers, and interactive buttons. All templates require Meta approval before use.
Understanding the 24-Hour Conversation Window
WhatsApp uses a conversation-based pricing model. When a customer sends you a message, a 24-hour window opens during which you can send any type of message (free-form or templates) without additional charges.
Inside 24-hour window: Send free-form text, media, or templates at no extra cost
Outside 24-hour window: Must use pre-approved template messages (charges apply)
Window resets: Each incoming customer message restarts the 24-hour timer
Marketing Templates
When to use: Promotions, announcements, and re-engagement campaigns.
Requires opt-in consent. Higher cost per message but drives revenue.
Utility Templates
When to use: Order updates, appointments, alerts, and account notifications.
Lower cost than marketing. Must relate to existing transaction or account.
Authentication Templates
When to use: OTPs, verification codes, and security alerts.
View official rates by country and template type. Chatmitra adds a small platform fee on top of Meta's base rates.
Template Best Practices
Always obtain customer opt-in before sending marketing templates
Keep utility templates transactional and time-sensitive
Include clear call-to-action buttons when appropriate
Test templates in sandbox before submitting for approval
Monitor template quality ratings to avoid blocks
Template Must Be Approved First
Templates require Meta approval (usually 24-48 hours). Create and manage templates in your Chatmitra Dashboard → Templates section. Rejected templates must be revised and resubmitted.
Promotional Broadcasts
Send mass promotional campaigns with rich media and dynamic discounts.
Send to VIP customers 24 hours before public launch for exclusivity.
Preview
C
Customer
online
Image Header
Hi {{1}}, discover our {{2}} with {{3}} new styles. {{4}} for first 100 customers!
Be the first to shop
Type a message
Preview of message sent to Customer
Order Confirmations
Send comprehensive order confirmation details immediately after purchase. Includes product details, pricing, delivery estimates, and tracking capabilities. Essential for e-commerce platforms like Shopify, WooCommerce, and Magento to reduce buyer anxiety and provide immediate purchase documentation.
Template Parameters
• <code>{{1}}</code> = Customer Full Name
• <code>{{2}}</code> = Product Name (with variant)
• <code>{{3}}</code> = Color/Size Specification
• <code>{{4}}</code> = Total Amount (Currency format)
Send within 2 minutes of order placement. Include order ID in header for easy reference. For Shopify/WooCommerce, trigger via webhook on order creation event.
WhatsApp Preview
C
Customer
online
✅ Order {{1}} Confirmed
Hi {{1}}, thank you for shopping with us! Your order for {{2}} (Color: {{3}}) has been successfully placed. Order Total: {{4}}. Estimated delivery to {{6}}: {{5}}. We'll send you tracking details once your order ships.
Questions? Reply to chat with our support team
Type a message
Preview of message sent to Customer
Shipping Updates
Notify customers when their order ships with complete logistics details. Includes courier name, tracking number, expected delivery date, and origin/destination information. Critical for e-commerce customer experience and reducing "where is my order" support tickets.
Trigger when courier API confirms pickup. Works with Shiprocket, Delhivery, and Blue Dart APIs.
Preview
C
Customer
online
🚚 Order {{1}} Shipped
Hi {{1}}, great news! Your order has been shipped via {{2}}. Tracking Number: {{3}}. Expected delivery by {{4}}. Your package is currently at {{5}} and heading to {{6}}. Track real-time updates below.
You can also track at bluedart.com
Type a message
Preview of message sent to Customer
Delivery Notifications
Real-time alerts when package is out for delivery with delivery partner details and time slots. Essential for high-value e-commerce deliveries to ensure customer availability and reduce failed delivery attempts.
Send at 8 AM on delivery day. Include delivery partner contact for coordination.
Preview
C
Customer
online
📦 Out for Delivery Today
Hi {{1}}, your order {{2}} is out for delivery on {{3}}. Delivery window: {{4}}. Your delivery partner {{5}} ({{6}}) will contact you shortly. Please ensure someone is available to receive the package.
OTP required for delivery verification
Type a message
Preview of message sent to Customer
Appointment Reminders
Automated reminders for scheduled appointments with doctor/service provider details, location, timing, and confirmation options. Reduces no-shows by 60% for clinics, salons, and consultation businesses.
Send 24 hours and 2 hours before appointment. Include Quick Reply for easy confirmation.
Preview
C
Customer
online
⏰ Appointment Tomorrow
Hi, this is a reminder for your appointment with {{1}} scheduled for {{2}} at {{3}}. Location: {{4}}. Duration: {{5}}. For queries, call {{6}}. Please reply to confirm or reschedule.
Please arrive 10 minutes early
Type a message
Preview of message sent to Customer
Payment Confirmations
Instant payment receipts with transaction details, invoice numbers, and payment method info. Critical for financial documentation and customer trust in e-commerce transactions.
Include transaction ID and invoice for accounting. Required for GST compliance in India.
Preview
C
Customer
online
✅ Payment Successful
Hi {{1}}, your payment of {{3}} has been received. Transaction ID: {{2}}. Date: {{4}}. Payment Method: {{5}}. Invoice: {{6}}. Your order is being processed and will ship within 24 hours.
This is an official receipt
Type a message
Preview of message sent to Customer
Account Updates
Security notifications for profile changes, password updates, address modifications, or payment method changes. Essential for fraud prevention and account security transparency.
Parameters
• <code>{{1}}</code> = Customer Name
• <code>{{2}}</code> = Update Type (Address/Password/Email)
Send immediately after any profile change. Include device info for fraud detection.
Preview
C
Customer
online
🔐 Account Details Updated
Hi {{1}}, your {{2}} was successfully updated on {{3}}. New details: {{4}}. Change made from: {{5}}. If you didn't make this change, please secure your account immediately.
Security is our priority
Type a message
Preview of message sent to Customer
Booking Confirmations
Hotel, flight, or event booking confirmations with complete stay details, dates, room types, and pricing. Includes cancellation policies and property information for hospitality businesses.
Send immediately after booking. Include check-in instructions and property contact.
Preview
C
Customer
online
🏨 Booking Confirmed
Hi {{1}}, your stay at {{2}} is confirmed for {{3}} ({{4}}). Room Type: {{5}}. Total Amount: {{6}}. Check-in: 2 PM | Check-out: 12 PM. Free cancellation until 24 hours before check-in.
We look forward to hosting you
Type a message
Preview of message sent to Customer
Reservation Reminders
Restaurant table reservation reminders with venue details, party size, seating preferences, and confirmation options. Reduces no-shows for fine dining and hospitality businesses.
Send 24 hours and 2 hours prior. Include dress code and parking info.
Preview
C
Customer
online
🍽️ Reservation Tomorrow
Hi {{1}}, reminder for your table at {{2}} on {{3}} at {{4}}. Party Size: {{5}}. Seating Preference: {{6}}. Please arrive within 15 minutes of reservation time. Reply to confirm or call to modify.
Dress code: Smart Casual
Type a message
Preview of message sent to Customer
Service Alerts
Platform maintenance notifications, downtime alerts, or service disruption warnings. Critical for SaaS businesses and e-commerce platforms to maintain transparency during technical operations.
Send 48 hours in advance for planned maintenance. Include status page link.
Preview
C
Customer
online
⚠️ Scheduled Maintenance
Hi {{1}}, our platform will undergo maintenance on {{2}} from {{3}} (Duration: {{4}}). Affected services: {{5}}. Please complete transactions before {{6}}. We apologize for inconvenience.
Status page: status.example.com
Type a message
Preview of message sent to Customer
Transaction Receipts
Detailed transaction receipts for billing and accounting purposes. Includes GST information, service descriptions, payment methods, and downloadable PDF links for business expense claims.
Include GSTIN and HSN codes for B2B transactions. PDF must be digitally signed.
Preview
C
Customer
online
🧾 Transaction Receipt
Hi {{1}}, your payment was successful. Transaction ID: {{2}}. Date: {{3}}. Amount: {{4}}. For: {{5}}. Payment Method: {{6}}. This serves as your official receipt for accounting purposes.
GST Invoice: GSTIN-29ABCDE1234F1Z5
Type a message
Preview of message sent to Customer
Appointment Cancellations
Professional cancellation notices with reasons, alternative time slots, and rescheduling options. Maintains customer trust during schedule changes for healthcare and service appointments.
Always provide alternative slot and reason. Offer refund if rescheduling doesn't work.
Preview
C
Customer
online
❌ Appointment Cancelled
Hi, your appointment with {{1}} scheduled for {{2}} at {{3}} has been cancelled. Reason: {{4}}. We apologize for inconvenience. New proposed slot: {{5}}. Call {{6}} to reschedule or confirm below.
Refund processed within 24 hours
Type a message
Preview of message sent to Customer
Payment Reminders
Invoice due date reminders with amount, late fee warnings, and secure payment links. Critical for subscription businesses, EMI collections, and B2B payment cycles to improve cash flow.
Send 3 days before, 1 day before, and on due date. Include late fee to create urgency.
Preview
C
Customer
online
💳 Payment Due Soon
Hi {{1}}, invoice {{2}} for {{3}} is due on {{4}} ({{5}} remaining). Avoid {{6}} by paying now. Secure payment link below. Multiple payment methods accepted including UPI, Cards, and Net Banking.
Auto-debit enabled on file
Type a message
Preview of message sent to Customer
Login Alerts
Real-time security notifications when account access is detected from new devices or locations. Includes device fingerprinting, geolocation, and timestamp for complete audit trails. Critical for detecting unauthorized access in banking, crypto, and high-security applications.
Send immediately on new device detection. Include IP address in backend logs for forensics.
Preview
C
Customer
online
🔔 New Login Detected
Hi {{1}}, we noticed a new login to your account on {{2}}. Device: {{3}}. Location: {{4}}. Browser: {{5}}. If this wasn't you, secure your account immediately by clicking below.
We send these alerts to keep your account safe
Type a message
Preview of message sent to Customer
Security Alerts
Critical security warnings for suspicious activities like multiple failed login attempts, password changes, or unauthorized access attempts. Triggers immediate account lockdown procedures and forces password resets to prevent account takeover attacks.
Threat Parameters
• <code>{{1}}</code> = User Name
• <code>{{2}}</code> = Threat Type (Failed attempts/Password change)
Auto-lock account after 3 failed attempts. Force password reset before unlock.
Preview
C
Customer
online
🚨 Security Alert
Hi {{1}}, we detected {{2}} on your account from {{3}} in {{4}}. Your account has been temporarily locked for {{5}}. If this wasn't you, secure your account immediately by clicking below.
Your security is our top priority
Type a message
Preview of message sent to Customer
Account Verification
Initial account verification during signup to confirm phone number ownership. Required for KYC compliance in fintech and to unlock full platform features. Includes both email and phone verification status for complete identity confirmation.
Required for financial services. Verify within 24 hours or account remains restricted.
Preview
C
Customer
online
✅ Verify Your Account
Hi {{1}}, verify your account to unlock full features. Email: {{2}}. Mobile: {{3}}. Your verification code is: {{4}}. Code expires in {{5}} hours. Never share this code with anyone.
Unverified accounts are limited to browsing only
Type a message
Preview of message sent to Customer
Password Reset
Secure password reset links with request metadata including timestamp, device, and location for user verification. Single-use tokens with short expiry prevent replay attacks and unauthorized password changes. Essential for account recovery flows.
Use cryptographically secure random tokens. Invalidate link after use or 15 minutes.
Preview
C
Customer
online
🔑 Password Reset Request
Hi {{1}}, we received a password reset request on {{2}} from {{3}} in {{4}}. Click below to reset your password. This link expires in {{5}} minutes. If you didn't request this, ignore this message or secure your account.
Never share reset links with anyone
Type a message
Preview of message sent to Customer
Two-Factor Authentication
Secondary verification codes for high-value transactions, sensitive settings changes, or admin panel access. Adds extra security layer beyond passwords for financial transactions above threshold limits or critical account modifications.
Mandate 2FA for transactions above ₹10,000. Use TOTP for additional security layer.
Preview
C
Customer
online
🔐 Hi {{1}}, your 2FA code is: {{2}}. Valid for {{3}} minutes. Required for {{4}}. This adds an extra layer of security to your account. Never share this code with anyone.
Enable 2FA in security settings for all transactions
Type a message
Preview of message sent to Customer
Device Authorization
Approve or deny access from new devices with detailed device fingerprinting. Prevents account takeover by requiring explicit authorization for unrecognized devices, even with correct passwords. Critical for protecting accounts from credential stuffing attacks.
Block login until authorized. Send deny option separately for immediate account lock.
Preview
C
Customer
online
📱 Authorize New Device
Hi {{1}}, someone is trying to access your account from {{2}} using {{3}} in {{4}} at {{5}}. Was this you? Click below to approve or deny this access.
Deny if you don't recognize this device
Type a message
Preview of message sent to Customer
Suspicious Activity Alerts
Advanced threat detection alerts for brute force attacks, impossible travel scenarios, or unusual transaction patterns. Automatically triggers account lockdown and forces password reset to prevent unauthorized access from compromised credentials.
Use ML models to detect impossible travel (login from Delhi then Kolkata within 1 hour).
Preview
C
Customer
online
⚠️ Unusual Activity Detected
🚨 Hi {{1}}, we detected {{2}} on your account at {{3}} from {{4}} in {{5}}. This looks suspicious and we've temporarily secured your account. Click below to review and secure your account immediately.
Account locked until verification complete
Type a message
Preview of message sent to Customer
Account Recovery
Secure account restoration process for locked or compromised accounts. Includes detailed request metadata (device, location, IP) to help users verify legitimacy and prevent unauthorized access attempts.
Include IP and location to help users identify suspicious requests. Link expires in 1 hour.
Preview
C
Customer
online
🆘 Account Recovery Request
Hi {{1}}, we received a request to recover your account ({{2}}) on {{3}}. Device: {{4}}. Location: {{5}}. IP Address: {{6}}. If this was you, click below to restore access. If not, ignore this message or contact support immediately.
Link expires in 1 hour for security
Type a message
Preview of message sent to Customer
Email Verification
Verify email addresses during registration or profile updates. Essential for account activation, password resets, and ensuring deliverability of important transactional emails.
Send immediately after registration. 15-minute expiry balances security and UX.
Preview
C
Customer
online
📧 Verify Your Email
Hi {{1}}, verify {{2}} to complete {{5}}. Your OTP is: {{3}}. Valid for {{4}}. Requested on {{6}}. Enter this code on the verification page or click below to copy.
Didn't request this? Ignore this message
Type a message
Preview of message sent to Customer
Phone Verification
Verify mobile numbers for WhatsApp Business API registration, two-factor authentication setup, or account security updates. Ensures the user has access to the registered device.
Required for WhatsApp Business API. Use 10-minute expiry for security.
Preview
C
Customer
online
📱 Verify Your Number
Hi {{1}}, confirm {{2}} for {{5}} registration with {{6}}. Your verification code is: {{3}}. Enter this code to verify ownership. Code expires in {{4}}. Do not share this with anyone.
This code is auto-generated
Type a message
Preview of message sent to Customer
PIN Reset
Secure transaction PIN or UPI PIN reset process for banking and payment applications. Includes card masking, request metadata, and urgent security warnings for financial services.
Use 5-minute expiry for PIN resets. Always mask card numbers (**** XXXX).
Preview
C
Customer
online
🔐 Transaction PIN Reset
Hi {{1}}, reset request for card ending {{2}} initiated on {{3}} via {{4}} from {{5}}. Click below to set new PIN. Link expires in {{6}}. If you didn't request this, block your card immediately.
Never share your PIN with anyone
Type a message
Preview of message sent to Customer
OTP Verification
Secure one-time password delivery for login verification, transaction confirmation, or account changes. Features copy-code button for easy paste and clear security warnings. Essential for two-factor authentication and high-value transaction verification in banking and e-commerce apps.
Never log OTPs in your system. Auto-expire after 5-10 minutes. Rate limit to 3 attempts per hour.
WhatsApp Preview
C
Customer
online
🔐 Your OTP is: {{1}}. Valid for {{2}} minutes only. Use this code to complete {{3}}. Never share this code with anyone, including customer support.
Didn't request this? Secure your account immediately
Type a message
Preview of message sent to Customer
AI Integration Guide for WhatsApp
Everything you need to know about connecting ChatGPT and AI assistants to your WhatsApp Business API. Follow these guidelines to create helpful, human-like conversations that your customers will love.
AI-Powered WhatsApp Messaging: The Complete Guide
Learn how to connect ChatGPT and AI assistants to your WhatsApp Business API for smarter customer conversations.
Transform Your WhatsApp Conversations with AI
Imagine having a smart assistant that never sleeps, instantly answers customer questions, and knows your business inside out—all through WhatsApp. That's exactly what AI integration with Chatmitra delivers. Whether you're running an online store, managing appointments, or handling support tickets, AI can handle the heavy lifting while you focus on growing your business.
24/7 Availability
Your customers get instant replies, even at 3 AM
80% Automation
Handle routine queries without human intervention
Human-Like Chat
Natural conversations that feel personal, not robotic
What Does AI Integration Actually Mean?
Think of it as giving your WhatsApp Business account a brain. Instead of manually typing every response or setting up rigid auto-replies, you connect Chatmitra to intelligent systems like ChatGPT, Claude, or Google Gemini. These AI models understand context, remember previous messages, and respond just like a trained human representative would.
For example, when a customer asks "Where's my order?" the AI instantly checks your database, finds their tracking number, and replies with the current status—complete with a friendly tone and helpful details. No coding required on your part, no delays, and no "Please wait while we connect you to an agent" messages.
How Does It Work Behind the Scenes?
1
Customer Sends a Message
Someone messages your WhatsApp Business number with a question or request.
2
Chatmitra Receives & Forwards to AI
Our system captures the message and sends it to your connected AI assistant along with conversation history.
3
AI Generates a Smart Response
The AI analyzes the intent, checks your business rules, and crafts a helpful, natural reply.
4
Reply Sent Instantly via WhatsApp
The response flows back through Chatmitra and appears in the customer's WhatsApp within seconds.
The 24-Hour Rule: What You Must Know
WhatsApp has a important policy: you can only send free-form AI replies within 24 hours of the customer's last message. After that, you must use pre-approved templates. Don't worry— we'll show you exactly how to handle this seamlessly so your AI never gets cut off mid-conversation.
AI Integration Best Practices: Doing It Right
Proven strategies to make your AI WhatsApp assistant helpful, natural, and effective.
Write Like a Human, Not a Robot
Break up long messages: Instead of one giant paragraph, send 2-3 shorter bubbles. It's easier to read on mobile.
Use WhatsApp formatting: Make text *bold* for emphasis or _italic_ for tone. It makes messages feel personal.
Add personality: "Hey there! 👋" feels warmer than "Hello. How may I assist you today?"
Offer quick buttons: Give users 2-3 tap options like "Track Order" or "Speak to Human" to speed up chats.
Remember the Conversation
Save chat history: The AI should remember that John ordered a blue shirt yesterday when he asks about returns today.
Watch the clock: If 24 hours pass, switch to a template message like "Hi! Still need help? Reply YES to continue."
Know when to stop: If the AI has sent 3 messages without a reply, wait. Don't spam.
Keep It Safe & Honest
Be transparent: Add a small note like "🤖 AI Assistant" so customers know they're chatting with AI.
Protect private info: Don't send credit card numbers or passwords to the AI. Filter them out first.
Easy escape route: Always offer "Reply AGENT to talk to a human" so frustrated customers can reach people.
Speed & Reliability
Show you're typing: Send a "typing..." indicator if the AI is taking more than 2 seconds to respond.
Have a backup plan: If the AI is down, automatically send "We're connecting you with our team" instead of silence.
Cache common answers: Store responses to frequent questions like "What are your hours?" to reply instantly.
Common AI Integration Mistakes That Hurt Your Business
Avoid these pitfalls that lead to blocked numbers, frustrated customers, and compliance issues.
Critical Errors That Can Get You Banned
Don't Spam Messages
The Problem: Sending 5 AI messages in a row when the customer hasn't replied looks like spam to WhatsApp.
Fix It: Send max 2 messages, then wait for the customer to respond. Patience prevents penalties.
Don't Ignore the 24-Hour Limit
The Problem: Trying to send AI replies after a day of silence results in failed messages (Error 131026).
Fix It: Check the time stamp. If it's been 24 hours, send a template first: "Still need help? Reply YES."
Don't Make Up Facts
The Problem: AI might invent a "20% discount" that doesn't exist, costing you money or credibility.
Fix It: Connect AI to your real database. If it doesn't know, it should say "Let me check that for you."
Don't Pretend to Be Human
The Problem: Customers feel betrayed when they realize "Sarah" was actually a bot. It destroys trust.
Fix It: Be upfront. "Hi, I'm your AI assistant!" is better than fake names and photos.
Don't Share Sensitive Data
The Problem: Sending credit card numbers to AI services violates privacy laws and puts customers at risk.
Fix It: Automatically detect and remove card numbers, passwords, and personal IDs before AI sees them.
Don't Leave Errors Unhandled
The Problem: If the AI breaks, customers get no reply and think you're ignoring them.
Fix It: Set up alerts. If AI fails twice, automatically send "We're connecting you to our team."
Warning Signs You're Doing It Wrong
Customers repeatedly asking "Are you a robot?" → You're not being transparent enough
High "unsubscribe" or "block" rates → You're messaging too frequently or outside windows
Messages failing with error 131026 → You're not checking the 24-hour window status
Customers complaining about wrong information → AI is hallucinating without fact-checking
Troubleshooting AI Integration Errors
How to prevent and solve common technical issues when connecting AI to WhatsApp.
Build It Right From Day One
The "Circuit Breaker" Safety Net
If your AI fails 3 times in 5 minutes, stop trying and switch to human mode. This prevents endless error loops.
if (failures > 3) { sendTemplate("human_help"); alertTeam("AI down"); }
Always Check the Time
Before sending any AI message, verify the 24-hour window is still open. If not, use a template.
if (hoursSinceLastMsg > 24) { sendTemplate("reengage"); return; }
Quick Fixes for Common Problems
Error 131026: "Window Closed"
You tried to send an AI message after 24 hours.
→ Send a template with "Reply to continue" button first.
Error 429: "Too Many Messages"
You're sending faster than 20 messages per minute.
→ Add a 3-second delay between sends. Use a queue.
AI Making Things Up
The bot invents prices or policies that don't exist.
→ Use "Retrieval Augmented Generation" - only let AI use your FAQ database.
Infinite Loop
Bot keeps replying to its own messages.
→ Check: if message.from === your_bot_number, don't reply.
Monitor These Metrics to Stay Healthy
Response Time
Avg seconds to reply
Keep under 3s
Success Rate
Messages delivered
Aim for 98%+
Escalation Rate
Users asking for humans
Keep under 15%
Error Count
Failed AI responses
Alert if >5/hour
Real-World AI Solutions for Your Industry
Practical examples of how businesses use Chatmitra AI to solve real problems and increase revenue.
Online Stores
Recover lost sales automatically
The Challenge:
70% of carts are abandoned. Customers ask "Where's my order?" 50 times a day. Returns are confusing.
Same questions asked 100 times daily. Long wait times. Expensive support team.
The AI Solution:
Answers FAQs instantly using your knowledge base
Detects angry customers, routes to humans fast
Gathers info before handoff (order #, issue)
Creates support tickets automatically
Results: 80% instant resolution, 2min response time
Your 30-Day AI Implementation Plan
1
Week 1: Set Up the Basics
Connect Chatmitra to your AI (OpenAI, Claude, etc.). Start with just 10 common FAQs. Test with your team first. Don't go live yet—just make sure messages flow correctly.
2
Week 2: Add Memory & Context
Make the AI remember conversations. Set up the 24-hour window checker. Add "Talk to human" button. Train it on your product catalog or service details.
3
Week 3: Connect Your Systems
Link to your CRM, order database, or booking system so AI can check real data. Set up error handling (what happens when AI doesn't know something).
4
Week 4: Go Live & Monitor
Launch to 10% of customers. Watch the metrics daily. Adjust the AI's tone based on feedback. Scale up once you're seeing 90%+ success rates.
Why This Pays for Itself
₹15
Average cost per AI conversation
₹150
Average cost per human support call
90%
Savings on routine inquiries
If you handle 100 customer chats per day, AI saves you approximately ₹13,500 daily while providing instant service.
Common Errors & Solutions
400: Invalid Phone Number Format
json
{
"status": "error",
"message": "Phone must be 10-15 digits with country code"
}
Causes:
• Missing country code (e.g., 9999999999 instead of 919999999999)
Multi-language examples for authentication in requests.
Keep Your Token Secure
Store tokens in environment variables, never in code. If exposed, regenerate immediately in dashboard.
Request Body Parameters
Parameter
Type
Required
Description
recipient_mobile_number
string
Yes
Customer phone with country code (10-15 digits)
message
string
Optional
Text message body (max 4096 chars)
messages
array
Optional
Array of message objects for templates/batch. Note: For batch, use to send multiple messages in one call.
customer_name
string
Optional
Customer name for personalization
altTexts
object
Optional
Fallback values for template placeholders, e.g., {"$name": "Guest"}
*Either message or messages is required. Cannot use both in same request.
Validation Rules & Limits
Text Messages
• Maximum length: 4,096 characters. Example: 'Hello' (5 chars) is fine; a 5000-char string will fail.
• Supports emojis (max 10 per message)
• No emoji-only messages allowed
• No HTML or markdown formatting
• No mixed language (Devanagari + Latin)
Templates
• Template name: 1-60 chars, lowercase + underscore only
• Body parameters: Max 10 per component
• Parameter text: Max 1,024 chars each
• Must be approved by Meta before sending
• Dynamic placeholders with fallback support
Interactive Messages
• Buttons: Max 3 per message, max 20 chars per button title
• Lists: Max 10 rows, max 20 chars per row title
• Button IDs: Max 256 characters
• Quick reply payloads: Max 256 characters
Media Files
• Images: Max 5 MB (JPG, PNG, WEBP)
• Videos: Max 16 MB (MP4, 3GP)
• Audio: Max 16 MB (MP3, OGG, OPUS)
• Documents: Max 100 MB (PDF, Office formats)
• Stickers: Max 500 KB (WEBP only)
Location Messages
• Latitude: -90 to 90
• Longitude: -180 to 180
• Name and address: Optional but recommended
Phone Number Format Guide
✓ Correct Format
• 919999999999 - India (country code 91 + 10 digits)
• 12025550123 - USA (country code 1 + 10 digits)
• 447911123456 - UK (country code 44)
• Digits only, no spaces, dashes, or + signs
• Length varies by country (e.g., 12 digits for India including 91, up to 15 total)
✗ Wrong Format (Will Fail)
• 9999999999 - Missing country code
• +91 9999999999 - Contains + and space
• 091999999999 - Leading zero (not allowed)
• 91-9999-9999-99 - Contains dashes
Auto-Clean Phone Numbers in Code
Equivalent code examples in other languages to clean phone numbers. All handle the same logic: remove non-digits, handle leading zero, add country code if needed (assuming India; customize as per use case).
node.js
function cleanPhoneNumber(phone) {
// Remove all non-digits
let clean = phone.replace(/D/g, '');
// Remove leading 0 (for India)
if (clean.startsWith('0')) {
clean = clean.substring(1);
}
// Add country code if missing (assumes India) - Customize country code based on user location
if (!clean.startsWith('91') && clean.length === 10) {
clean = '91' + clean;
}
return clean;
}
// Usage
cleanPhoneNumber('+91 9999-9999-99'); // Returns: 919999999999 ✓
cleanPhoneNumber('09999999999'); // Returns: 919999999999 ✓
python
import re
def clean_phone_number(phone):
# Remove all non-digits
clean = re.sub(r'D', '', phone)
# Remove leading 0 (for India)
if clean.startswith('0'):
clean = clean[1:]
# Add country code if missing (assumes India) - Customize based on user location
if not clean.startswith('91') and len(clean) == 10:
clean = '91' + clean
return clean
# Usage
print(clean_phone_number('+91 9999-9999-99')) # 919999999999
print(clean_phone_number('09999999999')) # 919999999999
php
<?php
function cleanPhoneNumber($phone) {
// Remove all non-digits
$clean = preg_replace('/D/', '', $phone);
// Remove leading 0 (for India)
if (strpos($clean, '0') === 0) {
$clean = substr($clean, 1);
}
// Add country code if missing (assumes India) - Customize based on user location
if (strpos($clean, '91') !== 0 && strlen($clean) === 10) {
$clean = '91' . $clean;
}
return $clean;
}
// Usage
echo cleanPhoneNumber('+91 9999-9999-99'); // 919999999999
echo cleanPhoneNumber('09999999999'); // 919999999999
?>
java
public class PhoneCleaner {
public static String cleanPhoneNumber(String phone) {
// Remove all non-digits
String clean = phone.replaceAll("\D", "");
// Remove leading 0 (for India)
if (clean.startsWith("0")) {
clean = clean.substring(1);
}
// Add country code if missing (assumes India) - Customize based on user location
if (!clean.startsWith("91") && clean.length() == 10) {
clean = "91" + clean;
}
return clean;
}
public static void main(String[] args) {
System.out.println(cleanPhoneNumber("+91 9999-9999-99")); // 919999999999
System.out.println(cleanPhoneNumber("09999999999")); // 919999999999
}
}
go
package main
import (
"fmt"
"regexp"
"strings"
)
func cleanPhoneNumber(phone string) string {
// Remove all non-digits
re := regexp.MustCompile(`D`)
clean := re.ReplaceAllString(phone, "")
// Remove leading 0 (for India)
if strings.HasPrefix(clean, "0") {
clean = clean[1:]
}
// Add country code if missing (assumes India) - Customize based on user location
if !strings.HasPrefix(clean, "91") && len(clean) == 10 {
clean = "91" + clean
}
return clean
}
func main() {
fmt.Println(cleanPhoneNumber("+91 9999-9999-99")) // 919999999999
fmt.Println(cleanPhoneNumber("09999999999")) // 919999999999
}
ruby
def clean_phone_number(phone)
# Remove all non-digits
clean = phone.gsub(/D/, '')
# Remove leading 0 (for India)
clean = clean[1..-1] if clean.start_with?('0')
# Add country code if missing (assumes India) - Customize based on user location
clean = '91' + clean if !clean.start_with?('91') && clean.length == 10
clean
end
# Usage
puts clean_phone_number('+91 9999-9999-99') # 919999999999
puts clean_phone_number('09999999999') # 919999999999
c# (.net)
using System;
using System.Text.RegularExpressions;
class Program {
static string CleanPhoneNumber(string phone) {
// Remove all non-digits
string clean = Regex.Replace(phone, @"D", "");
// Remove leading 0 (for India)
if (clean.StartsWith("0")) {
clean = clean.Substring(1);
}
// Add country code if missing (assumes India) - Customize based on user location
if (!clean.StartsWith("91") && clean.Length == 10) {
clean = "91" + clean;
}
return clean;
}
static void Main() {
Console.WriteLine(CleanPhoneNumber("+91 9999-9999-99")); // 919999999999
Console.WriteLine(CleanPhoneNumber("09999999999")); // 919999999999
}
}
swift (ios)
func cleanPhoneNumber(_ phone: String) -> String {
// Remove all non-digits
let clean = phone.replacingOccurrences(of: "\D", with: "", options: .regularExpression)
// Remove leading 0 (for India)
var mutableClean = clean
if mutableClean.hasPrefix("0") {
mutableClean.removeFirst()
}
// Add country code if missing (assumes India) - Customize based on user location
if !mutableClean.hasPrefix("91") && mutableClean.count == 10 {
mutableClean = "91" + mutableClean
}
return mutableClean
}
// Usage
print(cleanPhoneNumber("+91 9999-9999-99")) // 919999999999
print(cleanPhoneNumber("09999999999")) // 919999999999
kotlin (android)
fun cleanPhoneNumber(phone: String): String {
// Remove all non-digits
var clean = phone.replace(Regex("\D"), "")
// Remove leading 0 (for India)
if (clean.startsWith("0")) {
clean = clean.drop(1)
}
// Add country code if missing (assumes India) - Customize based on user location
if (!clean.startsWith("91") && clean.length == 10) {
clean = "91" + clean
}
return clean
}
// Usage
println(cleanPhoneNumber("+91 9999-9999-99")) // 919999999999
println(cleanPhoneNumber("09999999999")) // 919999999999
Always validate and clean phone numbers before sending. Remove spaces, dashes, and special characters. Tip: Use the auto-clean function from Send Messages tab.
2. Use Templates for Repeat Messages
Templates are faster, cheaper, and have higher delivery rates. Use for order confirmations, status updates, etc.
3. Manage Credits Wisely
First message to a customer costs 1 credit. Replies within 24 hours are free. Plan messaging strategy accordingly.
4. Optimize Media Size
Compress images and videos to 1-5 MB for faster delivery. Use HTTPS CDN for media hosting.
5. Handle Errors Gracefully
Implement error logging and retry logic with exponential backoff. Log jobId for tracking.
Ready to Get Started?
Create your Chat Mitra account and send your first message in minutes.