Skip to main content

Channels

The Channels API allows you to configure and manage messaging channels for your organization.

Overview​

Channels are integrations with external messaging platforms (WhatsApp, Telegram, SMS, etc.). Each channel connects Linktor to a specific provider account and handles message routing between your organization and customers.

Endpoints​

MethodEndpointDescription
GET/channelsList all channels
POST/channelsCreate a new channel
POST/channels/testTest channel configuration without creating it
POST/channels/test-whatsappTest WhatsApp official configuration
POST/channels/test-telegramTest Telegram configuration
POST/channels/test-twilioTest SMS/Twilio configuration
POST/channels/test-facebookTest Facebook configuration
POST/channels/test-instagramTest Instagram configuration
GET/channels/:idGet a specific channel
PUT/channels/:idUpdate a channel
DELETE/channels/:idDelete a channel
PUT/channels/:id/statusSet backwards-compatible active/inactive status
PUT/channels/:id/enabledEnable or disable a channel
POST/channels/:id/connectConnect a channel
POST/channels/:id/disconnectDisconnect a channel
POST/channels/:id/pairRequest WhatsApp unofficial pair code
GET/channels/:id/coexistence-statusGet WhatsApp official coexistence status
POST/channels/:id/subscribe-echoesSubscribe WhatsApp official message echoes

List Channels​

Retrieve all channels for your organization.

GET /channels

Query Parameters​

ParameterTypeDefaultDescription
pageinteger1Page number
perPageinteger20Items per page (max: 100)
typestring-Filter by channel type
statusstring-Filter by status: active, inactive, error
searchstring-Search by channel name

Example Request​

curl "https://api.linktor.io/v1/channels?status=active" \
-H "Authorization: Bearer YOUR_API_KEY"

Response​

{
"data": [
{
"id": "ch_abc123",
"type": "channel",
"attributes": {
"name": "WhatsApp Business",
"channelType": "whatsapp",
"status": "active",
"config": {
"phoneNumber": "+5511888888888",
"businessName": "Acme Corp"
},
"stats": {
"messagesReceived24h": 150,
"messagesSent24h": 120,
"activeConversations": 45
},
"webhookUrl": "https://api.linktor.io/webhooks/ch_abc123",
"createdAt": "2024-01-01T00:00:00Z",
"updatedAt": "2024-01-15T10:00:00Z"
}
},
{
"id": "ch_def456",
"type": "channel",
"attributes": {
"name": "Support Telegram",
"channelType": "telegram",
"status": "active",
"config": {
"botUsername": "@acme_support_bot"
},
"stats": {
"messagesReceived24h": 80,
"messagesSent24h": 75,
"activeConversations": 20
},
"webhookUrl": "https://api.linktor.io/webhooks/ch_def456",
"createdAt": "2024-01-05T00:00:00Z",
"updatedAt": "2024-01-15T09:00:00Z"
}
}
],
"meta": {
"pagination": {
"page": 1,
"perPage": 20,
"totalPages": 1,
"totalCount": 2
}
}
}

Get Channel​

Retrieve a specific channel by ID.

GET /channels/:id

Path Parameters​

ParameterTypeDescription
idstringChannel ID

Example Request​

curl https://api.linktor.io/v1/channels/ch_abc123 \
-H "Authorization: Bearer YOUR_API_KEY"

Response​

{
"data": {
"id": "ch_abc123",
"type": "channel",
"attributes": {
"name": "WhatsApp Business",
"channelType": "whatsapp",
"status": "active",
"config": {
"phoneNumber": "+5511888888888",
"phoneNumberId": "123456789",
"businessAccountId": "987654321",
"businessName": "Acme Corp",
"verifyToken": "********"
},
"capabilities": {
"text": true,
"image": true,
"document": true,
"audio": true,
"video": true,
"location": true,
"buttons": true,
"quickReplies": true,
"templates": true,
"deliveryReceipts": true,
"readReceipts": true,
"typingIndicators": true
},
"defaultBot": {
"id": "bot_xyz",
"name": "Support Bot"
},
"webhookUrl": "https://api.linktor.io/webhooks/ch_abc123",
"webhookSecret": "********",
"stats": {
"messagesReceived24h": 150,
"messagesSent24h": 120,
"messagesReceivedTotal": 15000,
"messagesSentTotal": 12000,
"activeConversations": 45,
"totalConversations": 2500
},
"health": {
"status": "healthy",
"lastChecked": "2024-01-15T10:00:00Z",
"lastMessageReceived": "2024-01-15T09:55:00Z",
"lastMessageSent": "2024-01-15T09:58:00Z"
},
"createdAt": "2024-01-01T00:00:00Z",
"updatedAt": "2024-01-15T10:00:00Z"
}
}
}

Error Codes​

HTTP StatusError CodeDescription
404CHANNEL_NOT_FOUNDChannel does not exist

Create Channel​

Create a new messaging channel.

POST /channels

Request Body​

FieldTypeRequiredDescription
namestringYesDisplay name for the channel
typestringYesChannel type (see below)
configobjectYesChannel-specific configuration
defaultBotIdstringNoBot to handle conversations
metadataobjectNoCustom metadata

Channel Types and Configuration​

WhatsApp​

{
"name": "WhatsApp Business",
"type": "whatsapp",
"config": {
"phoneNumberId": "YOUR_PHONE_NUMBER_ID",
"accessToken": "YOUR_ACCESS_TOKEN",
"businessAccountId": "YOUR_BUSINESS_ACCOUNT_ID",
"verifyToken": "YOUR_VERIFY_TOKEN"
}
}

Telegram​

{
"name": "Telegram Bot",
"type": "telegram",
"config": {
"botToken": "YOUR_BOT_TOKEN"
}
}

SMS (Twilio)​

{
"name": "SMS Support",
"type": "sms",
"config": {
"provider": "twilio",
"accountSid": "YOUR_ACCOUNT_SID",
"authToken": "YOUR_AUTH_TOKEN",
"phoneNumber": "+15551234567"
}
}

Email​

{
"name": "Support Email",
"type": "email",
"config": {
"provider": "smtp",
"smtpHost": "smtp.example.com",
"smtpPort": 587,
"smtpUser": "support@example.com",
"smtpPassword": "YOUR_PASSWORD",
"imapHost": "imap.example.com",
"imapPort": 993,
"imapUser": "support@example.com",
"imapPassword": "YOUR_PASSWORD",
"fromName": "Acme Support",
"fromEmail": "support@example.com"
}
}

WebChat​

{
"name": "Website Chat",
"type": "webchat",
"config": {
"allowedOrigins": ["https://www.example.com", "https://app.example.com"],
"theme": {
"primaryColor": "#0066cc",
"headerText": "Chat with us",
"welcomeMessage": "Hi! How can we help?"
},
"requireEmail": false,
"showBranding": true
}
}

Facebook Messenger​

{
"name": "Facebook Page",
"type": "facebook",
"config": {
"pageId": "YOUR_PAGE_ID",
"pageAccessToken": "YOUR_PAGE_ACCESS_TOKEN",
"appSecret": "YOUR_APP_SECRET"
}
}

Instagram​

{
"name": "Instagram Business",
"type": "instagram",
"config": {
"accountId": "YOUR_INSTAGRAM_ACCOUNT_ID",
"accessToken": "YOUR_ACCESS_TOKEN"
}
}

Voice (Twilio)​

{
"name": "Voice Support",
"type": "voice",
"config": {
"provider": "twilio",
"accountSid": "YOUR_ACCOUNT_SID",
"authToken": "YOUR_AUTH_TOKEN",
"phoneNumber": "+15551234567",
"speechToText": true,
"textToSpeech": true,
"recordCalls": true
}
}

Example Request​

curl -X POST https://api.linktor.io/v1/channels \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "WhatsApp Business",
"type": "whatsapp",
"config": {
"phoneNumberId": "123456789",
"accessToken": "EAABcd...",
"businessAccountId": "987654321",
"verifyToken": "my_verify_token"
},
"defaultBotId": "bot_abc123"
}'

Response​

{
"data": {
"id": "ch_new789",
"type": "channel",
"attributes": {
"name": "WhatsApp Business",
"channelType": "whatsapp",
"status": "inactive",
"config": {
"phoneNumber": "+5511888888888",
"phoneNumberId": "123456789",
"businessAccountId": "987654321"
},
"webhookUrl": "https://api.linktor.io/webhooks/ch_new789",
"webhookSecret": "whsec_abc123...",
"createdAt": "2024-01-15T11:00:00Z"
}
},
"meta": {
"setupInstructions": "Configure your WhatsApp webhook to: https://api.linktor.io/webhooks/ch_new789 with verify token: my_verify_token"
}
}

Error Codes​

HTTP StatusError CodeDescription
400VALIDATION_ERRORInvalid configuration
400INVALID_CHANNEL_TYPEUnsupported channel type
409CHANNEL_ALREADY_EXISTSChannel with same identifier exists

Update Channel​

Update an existing channel.

PUT /channels/:id

Path Parameters​

ParameterTypeDescription
idstringChannel ID

Request Body​

FieldTypeDescription
namestringDisplay name
configobjectConfiguration updates
identifierstringChannel identifier
configobjectConfiguration updates
credentialsobjectSensitive credential updates

Example Request​

curl -X PUT https://api.linktor.io/v1/channels/ch_abc123 \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "WhatsApp Business - Main"
}'

Response​

{
"data": {
"id": "ch_abc123",
"type": "channel",
"attributes": {
"name": "WhatsApp Business - Main",
"channelType": "whatsapp",
"connection_status": "connected",
"updatedAt": "2024-01-15T12:00:00Z"
}
}
}

Delete Channel​

Delete a channel. This will close all active conversations on this channel.

DELETE /channels/:id

Path Parameters​

ParameterTypeDescription
idstringChannel ID

Query Parameters​

ParameterTypeDefaultDescription
forcebooleanfalseDelete even if active conversations exist

Example Request​

curl -X DELETE "https://api.linktor.io/v1/channels/ch_abc123?force=true" \
-H "Authorization: Bearer YOUR_API_KEY"

Response​

HTTP/1.1 204 No Content

Error Codes​

HTTP StatusError CodeDescription
400ACTIVE_CONVERSATIONS_EXISTChannel has active conversations
404CHANNEL_NOT_FOUNDChannel does not exist

Test Channel Configuration​

Validate credentials and configuration before creating or updating a channel.

POST /channels/test

Specialized aliases are also available: /channels/test-whatsapp, /channels/test-telegram, /channels/test-twilio, /channels/test-facebook, and /channels/test-instagram.

Example Request​

curl -X POST https://api.linktor.io/v1/channels/test \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "telegram",
"credentials": {
"bot_token": "YOUR_BOT_TOKEN"
}
}'

Response​

{
"data": {
"status": "ok",
"type": "telegram",
"valid": true,
"message": "configuration accepted"
}
}

Connect Channel​

Connect a channel to start receiving messages.

POST /channels/:id/connect

Disconnect Channel​

Disconnect a channel to stop receiving messages.

POST /channels/:id/disconnect

Enable Or Disable Channel​

Enable or disable a channel at system level without changing its connection session.

PUT /channels/:id/enabled
{
"enabled": true
}

WhatsApp Pair Code​

Request a pair code for WhatsApp unofficial authentication.

POST /channels/:id/pair
{
"phone_number": "+5511999999999"
}

WhatsApp Coexistence​

WhatsApp official channels expose coexistence helpers:

GET /channels/:id/coexistence-status
POST /channels/:id/subscribe-echoes

Channel Statuses​

StatusDescription
connectedChannel connection is established
connectingChannel is connecting
disconnectedChannel is disconnected
errorChannel has connection issues
activeBackwards-compatible active status
inactiveBackwards-compatible inactive status

Supported Channel Types​

TypeDescription
whatsappWhatsApp Business API
whatsapp_officialWhatsApp Official / Meta Cloud API
whatsapp_unofficialWhatsApp unofficial session-based channel
telegramTelegram Bot API
smsSMS via Twilio, Vonage, etc.
emailEmail via SMTP/IMAP
voiceVoice calls via Twilio, etc.
webchatWebsite chat widget
facebookFacebook Messenger
instagramInstagram Direct Messages
rcsRCS Business Messaging

Webhooks​

Channel events can be received via webhooks:

  • channel.created - New channel created
  • channel.updated - Channel configuration changed
  • channel.activated - Channel activated
  • channel.deactivated - Channel deactivated
  • channel.error - Channel encountered an error
  • channel.deleted - Channel deleted

See Webhooks for configuration details.