HomeDocumentation

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.

1

Create Your Account

Sign up for a free A2P Network account. You'll be automatically assigned to an organization and can start configuring channels immediately.

2

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.

3

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.

Keep your API key secret. Never expose it in client-side code or public repositories.
4

Send Your First Message

Use the API to send a message. Replace the placeholders with your actual values:

Send a Telegram Message
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.

Telegram Bot Setup
Telegram integration supports bidirectional messaging—send messages and receive replies through webhooks.

1. Create a Telegram Bot

  1. Open Telegram and search for @BotFather
  2. Send /newbot and follow the prompts
  3. Choose a name and username for your bot
  4. Copy the bot token (looks like 123456789:ABCdefGHIjklMNOpqrsTUVwxyz)

2. Add Bot to A2P Network

  1. Go to Channels in your dashboard
  2. Click Add Channel and select Telegram
  3. Enter a name for the channel (e.g., “Support Bot”)
  4. Paste your bot token
  5. 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.

List Conversations
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
POST
/messages
Send a message through any configured channel

Request Body

FieldTypeDescription
channelTypestring“telegram”, “sms”, “email”, or “whatsapp”
channelIdstringChannel identifier (e.g., bot token for Telegram)
recipientstringRecipient ID (chat ID, phone, email)
contentstringMessage content
Example Request
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!"
  }'
Success Response (200)
{
  "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"
}
GET
/messages
Retrieve message history with optional filters

Query Parameters

ParameterTypeDescription
limitnumberMax results (default: 50)
directionstring“inbound” or “outbound”
channelTypestringFilter by channel type
Example Request
curl -H "X-API-Key: YOUR_API_KEY" \
  "https://a2p.network/api/messages?limit=10&direction=inbound"
GET
/channels
List all configured channels for your account
Example Request
curl -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.

API Key Authentication

Creating an API Key

  1. Log in to your A2P Network dashboard
  2. Navigate to Settings → API Keys
  3. Click Generate New API Key
  4. Give it a descriptive name (e.g., “Production CRM”)
  5. 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/channels

Security Best Practices

  • • Never expose API keys in client-side JavaScript
  • • Use environment variables to store keys
  • • Rotate keys periodically
  • • Revoke compromised keys immediately
Error Responses
StatusDescription
401 UnauthorizedMissing or invalid API key
403 ForbiddenValid key but insufficient permissions
429 Too Many RequestsRate limit exceeded

Webhooks

Receive inbound messages and delivery status updates in real-time via webhooks. Webhooks are automatically configured when you add a channel.

How Webhooks Work

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

1
User sends message to your Telegram bot
2
Telegram sends webhook to A2P Network
3
Message stored and appears in your dashboard
4
You can reply via API or dashboard
Fetching Inbound Messages
Poll for new messages or integrate with your application
Get Recent Inbound Messages
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.

Node.js / JavaScript
messaging.js
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!');
Python
messaging.py
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!')
CRM Integration (Conceptual)
Connect A2P Network to CRMs like HubSpot or Salesforce

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.

Ready to Get Started?

Create your account and send your first message in minutes.