Supported Channels
NativeMessage supports:- WhatsApp Business API (template and session messages)
- Viber Business (promotional and transactional)
- Telegram Bot API
Channel Setup
Create an OTT channel linked to a provider:curl -X POST https://api-message.nativehub.live/api/v1/ott/channels \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"provider_id": "prov_abc123",
"channel_type": "whatsapp",
"config": {
"phone_number_id": "123456789",
"business_account_id": "987654321"
}
}'
const response = await fetch('https://api-message.nativehub.live/api/v1/ott/channels', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
provider_id: 'prov_abc123',
channel_type: 'whatsapp',
config: {
phone_number_id: '123456789',
business_account_id: '987654321'
}
})
});
const channel = await response.json();
import requests
response = requests.post(
'https://api-message.nativehub.live/api/v1/ott/channels',
headers={
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
},
json={
'provider_id': 'prov_abc123',
'channel_type': 'whatsapp',
'config': {
'phone_number_id': '123456789',
'business_account_id': '987654321'
}
}
)
channel = response.json()
Template Management
Create Template
curl -X POST https://api-message.nativehub.live/api/v1/ott/templates \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"channel_id": "chan_abc123",
"name": "order_confirmation",
"language": "en",
"category": "transactional",
"body": "Your order {{1}} is confirmed. Total: ${{2}}"
}'
const response = await fetch('https://api-message.nativehub.live/api/v1/ott/templates', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
channel_id: 'chan_abc123',
name: 'order_confirmation',
language: 'en',
category: 'transactional',
body: 'Your order {{1}} is confirmed. Total: ${{2}}'
})
});
const template = await response.json();
response = requests.post(
'https://api-message.nativehub.live/api/v1/ott/templates',
headers={
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
},
json={
'channel_id': 'chan_abc123',
'name': 'order_confirmation',
'language': 'en',
'category': 'transactional',
'body': 'Your order {{1}} is confirmed. Total: ${{2}}'
}
)
template = response.json()
WhatsApp templates require Meta approval before use. Approval typically takes 24-48 hours.
Template Status
Templates have these states:pending— Awaiting approvalapproved— Ready to userejected— Failed approval
Sending OTT Messages
Template-Based Message
curl -X POST https://api-message.nativehub.live/api/v1/ott/messages \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"channel_id": "chan_abc123",
"destination": "+1234567890",
"template_id": "tmpl_xyz789",
"parameters": ["ORD-12345", "49.99"]
}'
const response = await fetch('https://api-message.nativehub.live/api/v1/ott/messages', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
channel_id: 'chan_abc123',
destination: '+1234567890',
template_id: 'tmpl_xyz789',
parameters: ['ORD-12345', '49.99']
})
});
const message = await response.json();
response = requests.post(
'https://api-message.nativehub.live/api/v1/ott/messages',
headers={
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
},
json={
'channel_id': 'chan_abc123',
'destination': '+1234567890',
'template_id': 'tmpl_xyz789',
'parameters': ['ORD-12345', '49.99']
}
)
message = response.json()
Session Message (Freeform)
Session messages can be sent within 24 hours of user reply (WhatsApp):curl -X POST https://api-message.nativehub.live/api/v1/ott/messages \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"channel_id": "chan_abc123",
"destination": "+1234567890",
"content": {
"type": "text",
"text": "Thank you for your inquiry!"
}
}'
await fetch('https://api-message.nativehub.live/api/v1/ott/messages', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
channel_id: 'chan_abc123',
destination: '+1234567890',
content: {
type: 'text',
text: 'Thank you for your inquiry!'
}
})
});
requests.post(
'https://api-message.nativehub.live/api/v1/ott/messages',
headers={
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
},
json={
'channel_id': 'chan_abc123',
'destination': '+1234567890',
'content': {
'type': 'text',
'text': 'Thank you for your inquiry!'
}
}
)
Session windows vary by platform:
- WhatsApp: 24 hours from last user message
- Viber: No session window
- Telegram: No session window
Retry Failed Messages
curl -X POST https://api-message.nativehub.live/api/v1/ott/messages/msg_abc123/retry \
-H "Authorization: Bearer YOUR_TOKEN"
await fetch('https://api-message.nativehub.live/api/v1/ott/messages/msg_abc123/retry', {
method: 'POST',
headers: { 'Authorization': 'Bearer YOUR_TOKEN' }
});
requests.post(
'https://api-message.nativehub.live/api/v1/ott/messages/msg_abc123/retry',
headers={'Authorization': 'Bearer YOUR_TOKEN'}
)