Documentation
Learn how to integrate A2P Network into your applications. From setting up channels to sending your first message.
Quick Start
Get up and running with A2P Network in under 5 minutes. This guide walks you through account setup, channel configuration, and sending your first message.
Set Up a Channel
Navigate to Channels in your dashboard and add your first messaging channel. Currently, Telegram is fully supported.
Telegram Setup
Create a bot via @BotFather, get your bot token, and add it to your channels. See the section for details.
Generate an API Key
Go to Settings → API Keys and generate a new API key. This key authenticates your API requests. Store it securely—it's only shown once.
Send Your First Message
Use the API to send a message. Replace the placeholders with your actual values:
curl -X POST https://a2p.network/api/messages \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY" \
-d '{
"channelType": "telegram",
"channelId": "YOUR_BOT_TOKEN",
"recipient": "TELEGRAM_CHAT_ID",
"content": "Hello from A2P Network!"
}'The recipient is the Telegram chat ID of the user you're messaging. Users must message your bot first to initiate a conversation.
Channel Setup
Configure messaging channels to connect your applications with your audience. Each channel has specific setup requirements.
1. Create a Telegram Bot
- Open Telegram and search for @BotFather
- Send
/newbotand follow the prompts - Choose a name and username for your bot
- Copy the bot token (looks like
123456789:ABCdefGHIjklMNOpqrsTUVwxyz)
2. Add Bot to A2P Network
- Go to Channels in your dashboard
- Click Add Channel and select Telegram
- Enter a name for the channel (e.g., “Support Bot”)
- Paste your bot token
- Save—we'll automatically configure the webhook
3. Get Chat IDs
To send messages, you need the recipient's chat ID. Users must message your bot first—then their chat ID appears in your conversations list.
curl -H "X-API-Key: YOUR_API_KEY" \
"https://a2p.network/api/telegram/conversations?botToken=YOUR_BOT_TOKEN"Telegram is Fully Operational
Send messages, receive replies, and view conversations in real-time.
API Reference
The A2P Network API uses REST conventions with JSON request and response bodies. All requests require authentication via API key.
Base URL
https://a2p.network/api/messagesRequest Body
| Field | Type | Description |
|---|---|---|
channelType | string | “telegram”, “sms”, “email”, or “whatsapp” |
channelId | string | Channel identifier (e.g., bot token for Telegram) |
recipient | string | Recipient ID (chat ID, phone, email) |
content | string | Message content |
curl -X POST https://a2p.network/api/messages \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY" \
-d '{
"channelType": "telegram",
"channelId": "123456789:ABCdef...",
"recipient": "987654321",
"content": "Your order has shipped!"
}'{
"id": "507f1f77bcf86cd799439011",
"channelId": "123456789:ABCdef...",
"channelType": "telegram",
"direction": "outbound",
"recipient": "987654321",
"content": "Your order has shipped!",
"status": "sent",
"createdAt": "2025-01-15T10:30:00.000Z"
}/messagesQuery Parameters
| Parameter | Type | Description |
|---|---|---|
limit | number | Max results (default: 50) |
direction | string | “inbound” or “outbound” |
channelType | string | Filter by channel type |
curl -H "X-API-Key: YOUR_API_KEY" \
"https://a2p.network/api/messages?limit=10&direction=inbound"/channelscurl -H "X-API-Key: YOUR_API_KEY" \
"https://a2p.network/api/channels"OpenAPI Specification
View the complete API specification at /api/docs/openapi.json
Authentication
A2P Network uses API keys to authenticate requests. Include your API key in the X-API-Key header with every request.
Creating an API Key
- Log in to your A2P Network dashboard
- Navigate to Settings → API Keys
- Click Generate New API Key
- Give it a descriptive name (e.g., “Production CRM”)
- Copy the key immediately—it's only shown once
Using Your API Key
Include the X-API-Key header in all API requests:
curl -H "X-API-Key: a2p_your_api_key_here" \
https://a2p.network/api/channelsSecurity Best Practices
- • Never expose API keys in client-side JavaScript
- • Use environment variables to store keys
- • Rotate keys periodically
- • Revoke compromised keys immediately
| Status | Description |
|---|---|
401 Unauthorized | Missing or invalid API key |
403 Forbidden | Valid key but insufficient permissions |
429 Too Many Requests | Rate limit exceeded |
Webhooks
Receive inbound messages and delivery status updates in real-time via webhooks. Webhooks are automatically configured when you add a channel.
When someone sends a message to your Telegram bot, A2P Network receives it via webhook and stores it in your message history. You can view these messages in the dashboard or fetch them via API.
Telegram Webhook Flow
curl -H "X-API-Key: YOUR_API_KEY" \
"https://a2p.network/api/messages?direction=inbound&limit=10"The dashboard automatically polls for new messages every 30 seconds. For your own integrations, implement polling at an appropriate interval.
Integrations
Integrate A2P Network with popular platforms and tools. Use our REST API to connect with any system that can make HTTP requests.
const API_KEY = process.env.A2P_API_KEY;
const API_BASE = 'https://a2p.network/api';
async function sendTelegramMessage(chatId, message) {
const response = await fetch(`${API_BASE}/messages`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': API_KEY
},
body: JSON.stringify({
channelType: 'telegram',
channelId: process.env.TELEGRAM_BOT_TOKEN,
recipient: chatId,
content: message
})
});
return response.json();
}
// Usage
await sendTelegramMessage('123456789', 'Hello from my app!');import os
import requests
API_KEY = os.environ['A2P_API_KEY']
API_BASE = 'https://a2p.network/api'
def send_telegram_message(chat_id: str, message: str):
response = requests.post(
f'{API_BASE}/messages',
headers={
'Content-Type': 'application/json',
'X-API-Key': API_KEY
},
json={
'channelType': 'telegram',
'channelId': os.environ['TELEGRAM_BOT_TOKEN'],
'recipient': chat_id,
'content': message
}
)
return response.json()
# Usage
send_telegram_message('123456789', 'Hello from my app!')Use webhooks or workflow automation to trigger messages based on CRM events:
- New lead → Send welcome message via Telegram
- Deal closed → Send confirmation notification
- Support ticket → Notify customer of status change
- Appointment scheduled → Send reminder
Tip: Most CRMs support outgoing webhooks or custom integrations. Configure them to call the A2P Network API when specific events occur.