Developer Documentation
WhatsApp Hub - Complete Integration Guide
WhatsApp Hub Developer Platform
WhatsApp Hub provides a complete API and integration platform for WhatsApp Business messaging.
Core Features
- Message Management API - Send/receive WhatsApp messages
- Template Management - Create and manage message templates
- Webhook Integration - Real-time message notifications
- oEmbed Support - Embed WhatsApp content on other sites
- Contact Management - Manage customer contacts and conversations
- Analytics - Message delivery and read statistics
API Base URL
https://maarketings.com/api/v1/
Authentication
All API requests require authentication using your account API key:
Authorization: Bearer YOUR_API_KEY
Quick Stats
API Endpoints: 15+
Supported Methods: REST, WebSocket
Rate Limit: 1000 req/hour
Response Format: JSON
oEmbed Integration
What is oEmbed?
oEmbed is an open format for allowing embedded representation of URLs on web sites. It allows a website to display embedded content from another website.
WhatsApp Hub oEmbed Endpoint
https://maarketings.com/oembed/?url=https://maarketings.com/conversation/[ID]
Use Cases
- Social Media Embeds - Embed WhatsApp conversations and templates
- Blog Integration - Embed example conversations in blog posts
- Documentation - Show WhatsApp integration examples
- Support Pages - Display sample customer interactions
- Marketing Materials - Showcase WhatsApp features
Request Example
GET /oembed/
?url=https://maarketings.com/conversation/demo
&maxwidth=500
&maxheight=400
Response Format
{
"type": "rich",
"version": "1.0",
"title": "WhatsApp Conversation",
"html": "<iframe src='...'></iframe>",
"width": 500,
"height": 400
}
Testing
Use Meta's oEmbed Debugger to test our implementation:
Open oEmbed DebuggerTest URL: https://maarketings.com/conversation/demo/
WhatsApp Business API
Endpoints
POST/api/v1/messages/sendGET/api/v1/messages/historyPUT/api/v1/messages/
POST/api/v1/templates/createGET/api/v1/templates/listPUT/api/v1/templates/DELETE/api/v1/templates/
POST/api/v1/contacts/createGET/api/v1/contacts/listGET/api/v1/contacts/
Example: Send Message
curl -X POST https://maarketings.com/api/v1/messages/send \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"to": "+9999999999",
"message": "Hello! Welcome to WhatsApp Hub",
"type": "text"
}'
Webhook Integration
Overview
WhatsApp Hub sends real-time notifications about message events to your webhook URL. This allows you to react immediately to incoming messages, delivery confirmations, and other events.
Event Types
- message.received - New incoming message
- message.delivered - Message delivered to contact
- message.read - Message read by contact
- message.failed - Message delivery failed
- contact.updated - Contact information updated
- template.approved - Template approved by Meta
- template.rejected - Template rejected by Meta
Webhook Payload Example
{
"event": "message.received",
"timestamp": 1644591234,
"data": {
"message_id": "wamid.123456789",
"from": "+9999999999",
"type": "text",
"text": "Hello from WhatsApp",
"timestamp": 1644591234
}
}
Setting Up Webhooks
- Get your unique webhook URL from your WhatsApp Hub account settings
- Configure it in Meta WhatsApp Business Manager
- WhatsApp Hub will receive notifications automatically
- Process them in your application
Integration Examples
1. Embed a Conversation (oEmbed)
Display a WhatsApp conversation on your website:
<iframe src='https://maarketings.com/embed/conversation/ABC123/'></iframe>
2. Send a Template Message
Send a pre-approved WhatsApp template to a customer:
curl -X POST https://maarketings.com/api/v1/messages/send \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"to": "+9999999999",
"template": "order_confirmation",
"variables": {
"order_id": "ORD-12345",
"amount": "$99.99"
}
}'
3. Handle Incoming Messages
Process incoming messages from your webhook:
@app.route('/webhook', methods=['POST'])
def handle_webhook():
data = request.json
if data['event'] == 'message.received':
message = data['data']
phone_number = message['from']
text = message['text']
# Process the message
# Send a response, etc.
return {'status': 'ok'}
4. List All Templates
Retrieve all message templates:
curl -X GET https://maarketings.com/api/v1/templates/list \
-H "Authorization: Bearer YOUR_TOKEN"
Need Help?
For questions about our API and integration:
- Email: developers@maarketings.com
- Documentation: Home Page
- Report Issues: Use the contact form on our website
API Status
✅ All systems operational
Last updated: Just now