TryVox

Messaging API

Send WhatsApp and SMS messages, manage conversations, and run campaigns.

Messaging API

The Messaging API handles channel-based messaging — currently WhatsApp, with SMS surfacing through the same primitives. You connect a channel (a WhatsApp Business phone number, a sender ID), then send messages, manage two-way conversations, register templates, run campaigns, and consume webhook events for delivery and inbound messages.

How it fits together

                ┌─────────────────────┐
                │  Channel (WABA #)   │
                │  /messaging/channels│
                └──────────┬──────────┘
                           │ owns

        ┌──────────────────┴──────────────────┐
        │                                     │
        ▼                                     ▼
┌─────────────────┐                  ┌─────────────────┐
│  Templates      │                  │  Conversations  │
│  /templates     │                  │  /conversations │
└─────────────────┘                  └────────┬────────┘
                                              │ contain

                                     ┌─────────────────┐
                                     │  Messages       │
                                     │  /messages      │
                                     └─────────────────┘

A conversation is auto-created on first message between your channel and a recipient. You don't manage conversations directly — the API surfaces them so you can list, read, and mark-as-read.

Endpoints

All endpoints are mounted under /v1/messaging/.... The API is tenant-scoped via the API key — you don't pass a tenant or auth ID in the URL.

Channels — set up the WhatsApp number

MethodPathPurpose
POST/v1/messaging/channelsConnect a WhatsApp Business number
GET/v1/messaging/channelsList channels
GET/v1/messaging/channels/{id}Get a channel
PUT/v1/messaging/channels/{id}Update display name, access token, status
DELETE/v1/messaging/channels/{id}Remove a channel
POST/v1/messaging/channels/{id}/subscribe-webhooksRe-subscribe Meta webhooks for the channel
POST/v1/messaging/channels/embedded-signupEmbedded Signup OAuth flow (browser-driven)

Messages and conversations

MethodPathPurpose
POST/v1/messaging/messagesSend a message
GET/v1/messaging/conversationsList conversations
GET/v1/messaging/conversations/{id}Get a conversation
GET/v1/messaging/conversations/{id}/messagesGet messages in a conversation
POST/v1/messaging/conversations/{id}/readMark a conversation as read

Templates

MethodPathPurpose
GET/v1/messaging/channels/{channel_id}/templatesList templates for a channel
POST/v1/messaging/channels/{channel_id}/templatesRegister a new template
POST/v1/messaging/channels/{channel_id}/templates/syncPull templates from Meta into TryVox
GET/v1/messaging/templatesList templates across all channels

Campaigns

MethodPathPurpose
POST/v1/messaging/campaignsCreate a template-driven broadcast
GET/v1/messaging/campaignsList campaigns
GET/v1/messaging/campaigns/{id}Get one
POST/v1/messaging/campaigns/{id}/startStart sending
POST/v1/messaging/campaigns/{id}/pausePause
POST/v1/messaging/campaigns/{id}/resumeResume
POST/v1/messaging/campaigns/{id}/cancelCancel
GET/v1/messaging/campaigns/{id}/recipientsPer-recipient delivery status
DELETE/v1/messaging/campaigns/{id}Delete

Contacts

MethodPathPurpose
POST/v1/messaging/contactsCreate a contact
GET/v1/messaging/contactsList
GET/v1/messaging/contacts/{id}Get
PUT/v1/messaging/contacts/{id}Update
DELETE/v1/messaging/contacts/{id}Delete
POST/v1/messaging/contacts/importBulk import via CSV

Inbound webhooks

WhatsApp webhooks from Meta land at /v1/webhooks/whatsapp (a public endpoint). TryVox verifies them and fans out to your subscribed webhooks (configured in Notifications → Webhooks) and to the in-dashboard inbox.

Real-time events

GET /v1/messaging/ws opens a WebSocket that streams in-tenant message and conversation events for dashboard-style UIs. Authentication uses a short-lived ticket — see the WebSocket section in your dashboard for issuing one.

Quick start

# 1. Connect your WhatsApp number (one-time)
CHANNEL=$(curl -s -X POST https://api.tryvox.io/v1/messaging/channels \
  -u $TRYVOX_AUTH_ID:$TRYVOX_AUTH_TOKEN \
  -H "Content-Type: application/json" \
  -d '{
    "phone_number": "+919876543210",
    "phone_number_id": "1234567890",
    "waba_id": "9876543210",
    "display_name": "Tryvox Support",
    "access_token": "EAAG...your-meta-token..."
  }')
CHANNEL_ID=$(echo "$CHANNEL" | jq -r .id)

# 2. Send a templated message (templates are required for first contact on WhatsApp)
curl -X POST https://api.tryvox.io/v1/messaging/messages \
  -u $TRYVOX_AUTH_ID:$TRYVOX_AUTH_TOKEN \
  -H "Content-Type: application/json" \
  -d "{
    \"channel_id\": \"$CHANNEL_ID\",
    \"to\": \"+14155551234\",
    \"message_type\": \"template\",
    \"template_name\": \"hello_world\",
    \"template_params\": {\"language\": \"en_US\", \"components\": []}
  }"

Authentication and gating

  • All endpoints require HTTP Basic auth.
  • Outbound SMS to +91 numbers is gated by Indian DLT registration. The validator runs before the message leaves TryVox and rejects with 403 DLT_NOT_REGISTERED if not registered.
  • WhatsApp messages outside the 24-hour customer service window must use a registered template. The API enforces this.

Pages

On this page