Free setup on annual plans

Sign up today!

Channels

API Reference: Channels endpoints

A channel is one way customers reach AnswerPal: an e-mail mailbox, a website chat, a phone number, a WhatsApp or SMS number, or a Teams mailbox. These endpoints manage channels and everything that belongs to one: routing and topic policy, WhatsApp and SMS connectors and templates, e-mail import and connection tests, mailbox folders and the texts of the chat window.

Endpoints

Channels

  • GET /api/Channels
    Access: Bearer JWT (any user role)
    List the channels of the customer.
  • POST /api/Channels
    Access: Bearer JWT (Configurator or Administrator)
    Create a channel. Answers 201 Created with the channel.
  • GET /api/Channels/{id}
    Access: Bearer JWT (any user role)
    Return one channel.
  • PUT /api/Channels/{id}
    Access: Bearer JWT (Configurator or Administrator)
    Update a channel. Answers 204 No Content.
  • DELETE /api/Channels/{id}
    Access: Bearer JWT (Configurator or Administrator)
    Delete a channel. For e-mail channels the mailbox subscriptions are stopped as well. Answers 204 No Content.

Routing and topic policy

  • GET /api/Channels/{id}/routing
    Access: Bearer JWT (any user role)
    How messages on this channel get a topic: the routing definition of the channel type, the topics that apply and the URL rules.
  • GET /api/Channels/{id}/topic-policy
    Access: Bearer JWT (Configurator or Administrator)
    Which topics this channel uses: the mode, the included and excluded topics, and per topic why it is available or not.
  • PUT /api/Channels/{id}/topic-policy
    Access: Bearer JWT (Configurator or Administrator)
    Set the topic policy of the channel. Returns the new policy.

WhatsApp and SMS connectors and templates

  • GET /api/Channels/connectors/retained
    Access: Bearer JWT (Configurator or Administrator)
    List the WhatsApp and SMS connectors that may still hold a number at the provider. Query onlyOrphaned=true limits the list to connectors of deleted channels.
  • POST /api/Channels/connectors/{connectorId}/provision
    Access: Bearer JWT (Configurator or Administrator)
    Retry setting up a connector’s sender at the provider. Returns the result as status and message.
  • POST /api/Channels/connectors/{connectorId}/release
    Access: Bearer JWT (Configurator or Administrator)
    Release a connector’s sender at the provider. Needs { "confirm": true }.
  • GET /api/Channels/{id}/whatsapp-templates
    Access: Bearer JWT (any user role)
    List the message templates of a WhatsApp channel and whether each can be sent.
  • POST /api/Channels/{id}/whatsapp-templates/sync
    Access: Bearer JWT (Configurator or Administrator)
    Fetch the templates of a WhatsApp channel from the provider again. Returns how many were imported, updated and removed.

E-mail import and connection test

  • POST /api/Channels/import-emails
    Access: Bearer JWT (Agent, Supervisor, Configurator or Administrator)
    Queue an e-mail import for all e-mail channels of the customer. Optional query maxCount. Answers 202 Accepted with a jobId.
  • POST /api/Channels/{channelId}/import-emails
    Access: Bearer JWT (Agent, Supervisor, Configurator or Administrator)
    Queue an e-mail import for one e-mail or Teams channel. Optional query maxCount. Answers 202 Accepted with a jobId.
  • POST /api/Channels/test-connection
    Access: Bearer JWT (Configurator or Administrator)
    Test the incoming (IMAP or Microsoft 365) and outgoing (SMTP) mail connection with the settings in the body, for a new or an existing channel. Nothing is saved.

Mailbox folders

  • GET /api/ChannelFolders/byChannel/{channelId}
    Access: Bearer JWT
    List the folders linked to an e-mail channel.
  • GET /api/ChannelFolders/fromMailbox/{channelId}
    Access: Bearer JWT
    Read the folders that exist in the channel’s mailbox, to choose which ones to link.
  • POST /api/ChannelFolders
    Access: Bearer JWT
    Link a mailbox folder to a channel. Answers 201 Created.
  • GET /api/ChannelFolders/{id}
    Access: Bearer JWT
    Return one linked folder.
  • PUT /api/ChannelFolders/{id}
    Access: Bearer JWT
    Update a linked folder. Answers 204 No Content.
  • DELETE /api/ChannelFolders/{id}
    Access: Bearer JWT
    Unlink a folder. Answers 204 No Content.

Chat window texts

  • GET /api/Channels/{channelToken}/translations-by-token/{lang}
    Access: Tokenized link (no bearer token)
    Return the texts of the chat window for a language. Used by the chat embed on a website: the channel token in the path is the access, no bearer token is needed.
  • GET /api/ChannelTranslations/byChannel/{channelId}
    Access: Bearer JWT
    List the text sets of a channel, one per language.
  • POST /api/ChannelTranslations
    Access: Bearer JWT
    Create the text set for one language of a channel. Answers 201 Created.
  • GET /api/ChannelTranslations/{id}
    Access: Bearer JWT
    Return one text set.
  • PUT /api/ChannelTranslations/{id}
    Access: Bearer JWT
    Update a text set. Answers 204 No Content.
  • DELETE /api/ChannelTranslations/{id}
    Access: Bearer JWT
    Delete a text set. Answers 204 No Content.

Channel fields

Create and update take the same body. The update replaces the channel: send all fields, not only the changed ones.

All channel types

  • channelType (string, required)
    Exactly one of Email, Chat, Phone, WhatsApp, SMS, Teams.
  • name (string, required, max 100)
  • isActive (boolean, default true)
  • connectionDetails (string, max 500)
    Not allowed for WhatsApp and SMS.
  • isDefaultTranslationChannel (boolean)
    Its chat texts are the fallback for the customer’s other channels.

Email and Teams

  • emailAddress (string, required, valid, max 255)
  • autoRetrieveEmails (boolean, default true)
    Import new mail automatically. Always false for other channel types.
  • forcedReplyLanguage (string or null, max 10)
    Write automatic e-mail replies in this language (for example fr or Fra, stored as a 3-letter code) instead of the language of the message. Only kept for e-mail channels; an empty string clears it.
  • emailProviderType, overrideEmailSettings
    Use other mail settings than the customer’s defaults.
  • overrideGraphTenantID, overrideGraphClientID, overrideGraphAuthorityURL, overrideGraphScope
  • overrideImapServer, overrideImapPort, overrideImapUsername, overrideImapUseSsl, overrideSmtpServer, overrideSmtpPort, overrideSmtpUsername, overrideSmtpUseSsl
  • Secrets (write only): overrideGraphClientSecret, overrideImapPassword, overrideSmtpPassword. Blank keeps the stored value; remove one with clearOverrideGraphClientSecret, clearOverrideImapPassword or clearOverrideSmtpPassword. When you point a channel to another server while a password is stored, send the password again.

Chat

  • hostnames (string or null)
    The websites where the chat runs.

Phone

  • phoneNumber (string, required)
    A valid phone number.
  • phoneDefaultLanguage (string or null, max 10)
    The language a call starts in (stored as a 3-letter code). null keeps the stored value on update, an empty string clears it; without it the called number decides. Callers can still switch language.

WhatsApp and SMS

  • provider (string)
    Twilio. Required on create.
  • senderAddress (string)
    The sender number in E.164 format, for example +32470123456. Required on create. On update send provider and senderAddress together or leave both out.
  • disabledMessagingFeatures (array of strings)
    Features switched off for this channel: AutoReply, Outbound, and for WhatsApp also Media and Templates. Empty means everything is on.

Connecting a WhatsApp number through Embedded Signup has its own endpoints.

Only in responses

  • channelID, customerID (integer)
  • token (GUID)
    The public channel token used by the chat embed.
  • hasOverrideGraphClientSecret, hasOverrideImapPassword, hasOverrideSmtpPassword (boolean)
  • provisioningStatus, connectorID, senderAddressLocked, senderAddressRetained, connectorReleasePending, connectorReleaseError, connectorIsSandbox, senderBindingKind, connectorChannelType
    State of the WhatsApp or SMS connector.
POST /api/Channels
Authorization: Bearer <token>
Content-Type: application/json

{
  "channelType": "Email",
  "name": "Support mailbox",
  "emailAddress": "support@example.com",
  "isActive": true,
  "autoRetrieveEmails": true,
  "forcedReplyLanguage": null
}
POST /api/Channels
Authorization: Bearer <token>
Content-Type: application/json

{
  "channelType": "SMS",
  "name": "SMS reminders",
  "provider": "Twilio",
  "senderAddress": "+32460123456",
  "disabledMessagingFeatures": ["AutoReply"]
}
PUT /api/Channels/12/topic-policy
Authorization: Bearer <token>
Content-Type: application/json

{
  "mode": "AllApplicableExcept",
  "includeTopicIds": [],
  "excludeTopicIds": [31, 44]
}
POST /api/Channels/test-connection

200 OK
{
  "providerType": "ImapSmtp",
  "imap": { "applicable": true, "success": true, "server": "imap.example.com", "port": 993, "useSsl": true, "error": null, "durationMs": 412 },
  "smtp": { "applicable": true, "success": false, "server": "smtp.example.com", "port": 587, "useSsl": true, "error": "Authentication failed", "durationMs": 380 }
}

Routing and topic policy

Topics decide how a message is handled. The topic channel links on the Topics page set where a topic is relevant by default; the topic policy of a channel adds or removes topics for that one channel.

Topic policy

  • mode (string, required)
    AllApplicableExcept: every applicable topic except excludeTopicIds. NoneExcept: only includeTopicIds.
  • includeTopicIds, excludeTopicIds (arrays of topic IDs)
  • Response only: channelID, channelName, channelType, and the lists availableTopics, excludedTopics and notApplicableTopics. Each topic has topicID, topicName, source, reason, isDefaultRelevant, isIncluded and isExcluded.

An invalid policy (for example a topic of another customer) gives 400 Bad Request.

Routing

  • channelID, channelName, channelType, scopeMode (GlobalPlusScoped or ScopedOnly)
  • definition
    What the channel type supports: assignmentMode (AiClassify, UrlRules or ManualOrSingleTopic), defaultScopeMode, displayName, supportsAutoClassification, supportsUrlRules, supportsReply, supportsReplySend, supportsRequiredFields.
  • topics
    Per topic: topicID, topicName, source, replyEnabled, replySendEnabled, isDefault.
  • rules
    URL rules of chat channels: ruleID, topicID, topicName, appliesToAllTopics, pattern, matchType, pathScope, source.

WhatsApp and SMS connectors

A WhatsApp or SMS channel sends through a connector that holds its number at the provider. A connector can stay behind after its channel changed or was deleted; it then still holds the number until it is released.

Retained connector

  • connectorID, channelID, channelName, channelType, channelDeleted, provider, senderAddress, provisioningStatus, releasePending, lastReleaseError, isSandbox

Release body

  • confirm (boolean, required true)
    Without it the answer is 400 with code ConfirmationRequired.
  • confirmSandboxWebhookRemoved (boolean)
    For a sandbox sender: confirms that its webhook was removed at the provider.

Provision answers 200 with status, message, senderReservationReleased, reRegisterAvailable and retainedSmsHolderBlocks, or 409 with a code (SenderConflict, ConcurrencyConflict, ReleaseInProgress, NotProvisionable). An unknown connector gives 404 with code ConnectorNotFound.

WhatsApp templates

  • channelMessageTemplateID, channelID, provider, contentSid, friendlyName, language, category, approvalStatus, contentType, variables (object), bodyPreview, isActive, statusReason, lastSyncedAt
  • isSendable
    True when the template is active, approved and belongs to the account of the channel’s active connector.

For a channel that is not WhatsApp both template endpoints give 400. The sync answers imported, updated, removed, total and truncated; when the provider call fails it gives 409 with code TemplateSyncFailed.

E-mail import and folders

The import endpoints only queue a job and answer at once with { "message": "...", "jobId": "..." }. When the Microsoft 365 client secret has expired, they answer 409 with error GraphClientSecretExpired. The connection test takes the channel body plus an optional channelID: with an ID the stored channel is used and the body overrides it. Each protocol in the result has applicable, success, server, port, useSsl, error and durationMs.

Linked folder

  • channelID (integer, required on create)
  • folderName (string, required, max 255)
  • externalFolderID (string, required, max 255)
    The folder’s ID in the mailbox, from fromMailbox.
  • isActive, autoRetrieveEmails (boolean, default true)
  • folderDirection (string)
    Incoming, Outgoing or Both (default).
  • Response only: folderID.

Linking the same folder twice gives 409 with code DuplicateChannelFolder. The mailbox listing returns id, displayName, fullName, depth and isInbox per folder.

Chat window texts

A text set holds the labels of the chat window in one language. lang is a 3-letter code such as Nld, Fra or Eng; Unk is the fallback set. The public route looks for the requested language on the channel, then the channel’s Unk set, then the same two on the customer’s default translation channel.

  • channelID (integer, required on create), lang (string, required on create, max 3)
    One set per channel and language; a second gives 409.
  • Texts (string)
    chatTitle, defaultGreeting, sendButtonText, escalatePrompt, yesText, noText, availabilityCheck, validEmail, youText, submitButtonText, succesfulSubmission, agentJoin.
  • Response only: channelTranslationID.

A text set of another customer’s channel gives 401 Unauthorized.

GET /api/Channels/0f8fad5b-d9cb-469f-a165-70867728950e/translations-by-token/nl

200 OK
{
  "chatTitle": "Hoe kunnen we helpen?",
  "defaultGreeting": "Hallo! Stel gerust je vraag.",
  "sendButtonText": "Verstuur",
  "escalatePrompt": "Wil je met een medewerker praten?",
  "yesText": "Ja",
  "noText": "Nee",
  "availabilityCheck": "We kijken of er iemand beschikbaar is...",
  "validEmail": "Vul een geldig e-mailadres in.",
  "youText": "Jij",
  "submitButtonText": "Verzenden",
  "succesfulSubmission": "Bedankt, we nemen contact op.",
  "agentJoin": "Een medewerker neemt het gesprek over."
}

Access and status codes

  • Access
    Every user role can read channels and routing. Creating, changing and deleting channels, the topic policy, connectors, template sync and the connection test need Configurator or Administrator. Imports need Agent, Supervisor, Configurator or Administrator. Folders and text sets work for every signed-in user of the customer. The access line of each endpoint above is the reference.
  • 400 Bad Request
    Validation errors, an unknown language code, a WhatsApp-only call on another channel type, or a changed server without its password. Configuration errors have code InvalidChannelConfiguration.
  • 404 Not Found
    The channel, folder or text set does not exist for this customer.
  • 409 Conflict
    With a code: DuplicateChannelIdentifier (the address or number is already used by another channel), SenderAddressRetained, ConnectorBindingLocked, ConnectorAssignmentConflict, NumberBoundSenderConflict, PhoneChannelCompletionInProgress (a phone channel still has unfinished calls), DuplicateChannelFolder, TemplateSyncFailed, GraphClientSecretExpired.
  • 503 Service Unavailable
    A phone channel change could not be coordinated with running calls in time, or template sync is not available.

FAQ

Call GET /api/Channels with a token; it returns every channel of the customer in the token.

Send the channel settings to POST /api/Channels/test-connection. It tests incoming and outgoing mail and saves nothing.

Automatically for channels and folders with autoRetrieveEmails, and on demand with the two import endpoints, which queue a background job.

From the text sets of the channel. The chat embed reads them with the public channel token, in the visitor's language with a fallback.

Need more help?

Table of Contents

AnswerPal: AI-powered customer service solutions to elevate your support and communication effortlessly.

Contact

For all support, sales, and partnership inquiries, email us at info@answerpal.eu

AnswerPal
Bisschoppenhoflaan 380
2100 Antwerp
Belgium

+32.36416685

BE 0862.692.858