DM Champ Docs

Channel Connection API

This guide explains how to connect messaging channels to an account over the API: the order of the calls, what the account holder has to do, and the behaviour worth knowing before you build. Every field, request body and response shape is in the API Reference, linked from each row below.

All paths are relative to https://api.dmchamp.com/v1. Make sure API access is on the plan and you have a key (API Access), and authenticate every request (Authentication). Errors use the standard envelope described in Errors & Pagination.

The connect-then-poll pattern

Most channels cannot be connected with one API call. Connecting WhatsApp, Instagram or Messenger means the account holder logs in to their own provider account and approves access. There is no headless path for that approval: a real person opens a URL in a browser, or scans a QR code with their phone.

So the flow is almost always:

  1. Start the connection with a POST. The response gives you a URL to open, or a QR code to show.
  2. Hand that to the end user. Open the URL in their browser, or show the QR for them to scan.
  3. Poll the status endpoint every few seconds until it reaches a connected state (or a failure).

The easy route: connect_url. Meta, WhatsApp Web, Telegram and Instagram (personal) also return a connect_url: a hosted page that runs the whole flow for the account holder (Page picker, refreshing QR, code entry) and reports success on its own. Give that link to the account holder instead of building the UI and the poll loop yourself. It works for about 30 minutes (connect_url_expires_at); if it lapses, start a new connection. TikTok has no connect_url.

Endpoints

Task Method + path Reference
List every channel connection on the account GET /channels Open in API Reference
Instagram + Messenger start POST /channels/meta/connect Open in API Reference
Poll status GET /channels/meta/status Open in API Reference
List the Pages GET /channels/meta/pages Open in API Reference
Select the Page POST /channels/meta/select-page Open in API Reference
List the Page’s posts GET /channels/meta/posts Open in API Reference
Disconnect DELETE /channels/meta Open in API Reference
WhatsApp Business start POST /channels/whatsapp/connect Open in API Reference
Poll status GET /channels/whatsapp/connect/{phoneNumber}/status Open in API Reference
Disconnect DELETE /channels/whatsapp/{phoneNumber} Open in API Reference
WhatsApp Web start pairing POST /channels/whatsapp-web/connections Open in API Reference
Fetch the QR GET /channels/whatsapp-web/connections/{phoneNumber}/qr Open in API Reference
Poll status GET /channels/whatsapp-web/connections/{phoneNumber}/status Open in API Reference
Disconnect DELETE /channels/whatsapp-web/connections/{phoneNumber} Open in API Reference
Get the permanent reconnect link GET /channels/whatsapp-web/connections/{phoneNumber}/reconnect-link Open in API Reference
Create or rotate the reconnect link POST /channels/whatsapp-web/connections/{phoneNumber}/reconnect-link Open in API Reference
Turn off the reconnect link DELETE /channels/whatsapp-web/connections/{phoneNumber}/reconnect-link Open in API Reference
Telegram start POST /channels/telegram/connect Open in API Reference
Submit the login code POST /channels/telegram/connect/{phoneNumber}/verify-code Open in API Reference
Submit the two-factor password POST /channels/telegram/connect/{phoneNumber}/verify-password Open in API Reference
Check status GET /channels/telegram/connect/{phoneNumber}/status Open in API Reference
Disconnect DELETE /channels/telegram/{phoneNumber} Open in API Reference
Instagram (personal) start POST /channels/instagram-private/connect Open in API Reference
Submit the two-factor code POST /channels/instagram-private/connect/{id}/verify-2fa Open in API Reference
Submit the checkpoint code POST /channels/instagram-private/connect/{id}/verify-challenge Open in API Reference
Check status GET /channels/instagram-private/connect/{id}/status Open in API Reference
Disconnect DELETE /channels/instagram-private/{id} Open in API Reference
Sync followers now POST /channels/instagram-private/{id}/sync-followers Open in API Reference
LINE connect POST /channels/line Open in API Reference
Re-verify after webhook setup POST /channels/line/{botUserId}/verify-webhook Open in API Reference
Check status GET /channels/line/{botUserId}/status Open in API Reference
Disconnect DELETE /channels/line/{botUserId} Open in API Reference
Viber connect POST /channels/viber Open in API Reference
Check status GET /channels/viber/{botId}/status Open in API Reference
Re-register the webhook POST /channels/viber/{botId}/verify-webhook Open in API Reference
Disconnect DELETE /channels/viber/{botId} Open in API Reference
TikTok start POST /channels/tiktok/connect Open in API Reference
Check status GET /channels/tiktok/{openId}/status Open in API Reference
Disconnect DELETE /channels/tiktok/{openId} Open in API Reference
GoHighLevel start POST /channels/ghl/connect Open in API Reference
List connected locations GET /channels/ghl/status Open in API Reference
Disconnect a location DELETE /channels/ghl/{locationId} Open in API Reference
Phone numbers search GET /phone-numbers/available Open in API Reference
Buy a number POST /phone-numbers Open in API Reference
List numbers GET /phone-numbers Open in API Reference
Poll a number’s status GET /phone-numbers/{phoneNumber}/status Open in API Reference
Update a number (daily cap, keyword_only_new_contacts and more) PATCH /phone-numbers/{phoneNumber} Open in API Reference
Move the warm-up day POST /phone-numbers/{phoneNumber}/ramp-day Open in API Reference
Release a number DELETE /phone-numbers/{phoneNumber} Open in API Reference
Add a number you already own POST /phone-numbers/byo Open in API Reference
Set the primary number POST /phone-numbers/{phoneNumber}/set-primary Open in API Reference
Remove a number’s record only DELETE /phone-numbers/{phoneNumber}/record Open in API Reference
Legacy campaign routing POST /channels/campaign Open in API Reference
Clear legacy routing DELETE /channels/campaign/{channel} Open in API Reference
Your own Meta app read GET /account-config/meta-app Open in API Reference
Save PUT /account-config/meta-app Open in API Reference
Remove DELETE /account-config/meta-app Open in API Reference
Instagram Login push a token PUT /channels/instagram-login/token Open in API Reference
Remove the token DELETE /channels/instagram-login/token Open in API Reference

Instagram + Messenger (Meta)

Instagram and Messenger connect together in one flow, because both run on a Facebook Page. The account holder authorizes through Facebook, you fetch the Pages they manage, and you pick which Page to connect.

  1. POST /channels/meta/connect (no body, no credentials) returns oauth_url, connect_url and expires_at.
  2. Open oauth_url in the account holder’s browser, or simply give them connect_url.
  3. Poll GET /channels/meta/status until status is pages_loaded. The response already includes the pages array, so GET /channels/meta/pages is only a convenience.
  4. POST /channels/meta/select-page with the chosen page_id. The Instagram account linked to that Page is connected automatically; send an instagram object only to override which one. The status then reports connected.
curl -X POST "https://api.dmchamp.com/v1/channels/meta/connect?apiKey=YOUR_API_KEY"
# then, after the person has approved and picked:
curl -X POST "https://api.dmchamp.com/v1/channels/meta/select-page?apiKey=YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "page_id": "1234567890" }'

Good to know

  • The attempt expires at expires_at (about 30 minutes). Treat state_token as a short-lived secret and do not log it.
  • Status walks pending → token_received (authorized, Pages still loading) → pages_loaded → connected. Stop polling on failed or expired and start again. failed with reason: "no_pages" means the person authorized but shared no Facebook Page: they did not tick a Page on the Facebook screen, or, with your own Meta app, its Login for Business configuration does not include Pages.
  • Listing posts (GET /channels/meta/posts?platform=instagram, or platform=facebook) is what you build a post picker from when an Entry Point should react to comments on one post. Any other platform is a 400. nextCursor is null on the last page. If nothing can be listed you still get 200 with connected: false, an empty posts array and a reason: none means no Page is connected yet, no_instagram_account means the Page has no linked Instagram business account (Facebook posts still list), token_expired means reconnect.
  • DELETE /channels/meta stops inbound routing for both Instagram and Messenger. It is idempotent.

Reading Instagram status in GET /channels. instagram.connected is true when Instagram is connected either way: through an Instagram login (including a token your own Meta app pushed) or through a Facebook Page. instagram.connection_lane says which one serves it (instagram_login or page), with instagram_account_id and instagram_username for that account. When an Instagram login connection exists it always wins, so an old Facebook Page connection never makes Instagram look disconnected. messaging_ok and webhook_status describe the serving connection only, and they answer two different questions. messaging_ok is Meta’s message-access check, run on both kinds of connection when you connect and again every day: false means Meta refused message access and messaging_health_reason says why (instagram_dm_access_disabled: turn on Allow access to messages under Connected tools in the Instagram app; instagram_not_linked_professional: the Page has no Professional Instagram account; token_invalid: reconnect). It is null when the check has not run yet or Meta gave no clear answer. It does not count messages: webhook_status: "no_webhooks" is the one that means no Instagram DM has reached the app since the connection was made (the Instagram not delivering warning on the card). After you fix the cause, messaging_ok turns true at the next daily check or when you reconnect. Messenger is reported on its own under messenger.

WhatsApp Business

Connects an official WhatsApp Business number. The number must already be on the account before you call connect (buy one or add your own, see Phone numbers). The account holder authorizes in their browser, then you poll until the number reports ONLINE.

curl -X POST "https://api.dmchamp.com/v1/channels/whatsapp/connect?apiKey=YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "phone_number": "+14155551234" }'

Open the returned oauth_url in the account holder’s browser. Registration finishes in the background; poll GET /channels/whatsapp/connect/{phoneNumber}/status until status is ONLINE.

Good to know

  • Status values: PENDING (keep polling), ONLINE (ready to send), RATE_LIMITED (wait before retrying), REGISTRATION_FAILED, DELETED.
  • live: true means the status was checked with the provider just now; false means it is the last cached state.
  • business_name and description on the connect call only change what the consent screen shows. They are not stored.
  • Disconnecting (DELETE /channels/whatsapp/{phoneNumber}) keeps the number on the account, so you can reconnect it later.

WhatsApp Web

Links a regular WhatsApp number by QR code, like linking a device in the WhatsApp app (WhatsApp > Linked Devices > Link a Device).

curl -X POST "https://api.dmchamp.com/v1/channels/whatsapp-web/connections?apiKey=YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "phone_number": "+15551230000" }'

The response has connect_url (the recommended path when a person can open a link: it shows the QR, refreshes it as it rotates and switches to a success message once linked) plus the exact poll_qr_path and poll_status_path to use if you render the QR yourself.

Good to know

  • GET .../qr returns qr_data_url (a ready image for an <img src>) and qr_code (the raw payload). The QR is short-lived. Right after starting you may get 404 “QR code not available yet”: wait a moment and retry. A 410 “QR code expired” means start the connection again.
  • Status values: qr_pending, connecting (scanned, finishing setup), connected or open (success), and the terminal failures not_initialized and disconnected.
  • import_existing_chats only works together with import_contacts: true. Imported contacts keep automated replies paused unless you set pause_ai_for_imported_contacts: false. force_new discards any existing session.
  • Reconnect link. For a number that drops later, the reconnect link is a permanent page whoever holds the phone can open to re-pair it, without logging in. Rotating it revokes the old URL at once.
  • Disconnecting always cleans up local state, so it is idempotent even if the session was already gone.

Telegram

Availability: Telegram is open to every account. The endpoints can still return 403 with "This channel is not included in your current plan. Upgrade to unlock it." when the plan does not include it.

Connects a personal Telegram account by phone number plus a one-time login code, and a two-factor password if the account has one.

curl -X POST "https://api.dmchamp.com/v1/channels/telegram/connect?apiKey=YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "phone_number": "+14155550100" }'
# the account receives a code in Telegram, then:
curl -X POST "https://api.dmchamp.com/v1/channels/telegram/connect/%2B14155550100/verify-code?apiKey=YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "code": "12345" }'

Good to know

  • In the default code mode the start call returns status: "code_required". With mode: "qr" it returns qr_required plus login_token and qr_url to show for scanning. The hosted connect_url handles both modes, including the two-step password.
  • After verify-code, connected means done; password_required means call verify-password (only then).
  • Status values: connected, code_required, password_required, initializing, disconnected, not_initialized, error.
  • Disconnect is idempotent.

Sending limits and warm-up day (Telegram)

A connected Telegram account warms up over about two months: the daily message cap starts at 50 and rises by 8 per warm-up day (500 from day 58), and the daily new-contact cap climbs to 50 by day 61. Both calls below take the channel row id from GET /channels as {phoneNumber}. For Telegram it looks like telegram_+14155550100; encode the plus as %2B.

  • Your own daily message cap: PATCH /phone-numbers/{phoneNumber} with daily_message_limit_manual_override, 100 to 1,500 on any warm-up day, or 0 to go back to the warm-up cap. It applies at once, and the warm-up keeps raising the limit past it: whichever of the two is higher applies (the new-contact cap still follows the warm-up) and wakes conversations that were paused at the old limit. On a WhatsApp Web number the same field only applies from 750 up, and only from warm-up day 58 (409 before that).
  • Move the warm-up day: POST /phone-numbers/{phoneNumber}/ramp-day with target_ramp_day 1 to 60. Only do this for an account that genuinely has real history on the channel: moving a fresh account forward skips the safety schedule and raises the chance of a restriction. The same day as now is a 400, and so is a WhatsApp Web number (its warm-up day moves from the Channels page).
curl -X POST "https://api.dmchamp.com/v1/phone-numbers/telegram_%2B14155550100/ramp-day?apiKey=YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "target_ramp_day": 58 }'

Reconnecting the same Telegram account, even under a new phone number, restores its warm-up day from the account’s sending history, so a reconnect does not start the warm-up over. Both calls are also available to the in-app helper and the MCP server as update_phone_number and set_phone_number_warm_up_day.


Instagram (personal account)

Limited-availability beta, enabled per account. This connects a personal Instagram account with its username and password (not the official Business API). An account not enabled for the beta gets a permission error.

The simplest path is to give the account holder the hosted connect_url: they enter their Instagram login (and any 2FA or checkpoint code) there, the credentials go straight to Instagram and are not stored, and your integration never handles the password.

If you drive it yourself: POST /channels/instagram-private/connect with username and password. If the response says two_factor_required or challenge_required, submit the code to verify-2fa or verify-challenge, then poll the status until connected. {id} is the normalized Instagram username returned as account_id / username; use it on every later call.

Good to know

  • verify-2fa can answer connected, two_factor_required (wrong code, try again) or challenge_required (Instagram also wants a checkpoint code).
  • Status values: connected, two_factor_required, challenge_required, initializing, disconnected, not_initialized, error. live: true means read live from the connection worker.
  • Disconnect is idempotent.

Sync followers now. POST /channels/instagram-private/{id}/sync-followers runs the follower sync that otherwise runs on its own in the background, for an on-demand “Refresh followers” button. It records new followers and, when an Agent has an enabled New Instagram follower Entry Point, has that Agent send them an opening DM up to a daily cap (an older setup with no such Entry Point still uses a Live campaign with follower outreach turned on). It returns accountId, totalFollowers, newFollowers, dmsSent and isBaselineSeed, the one camelCase response on this page. isBaselineSeed: true marks the first sync after connecting, which only records the starting list and never sends DMs (dmsSent is 0). The first call can take a while; later calls only diff new followers. 404 means the account is not connected; 412 means the connection has not finished initializing yet, so wait and retry.


LINE

LINE has no browser redirect and no polling. The customer creates a Messaging API channel in the LINE Developers console, copies two values, and you submit them in one call.

curl -X POST "https://api.dmchamp.com/v1/channels/line?apiKey=YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "channel_access_token": "LONG_LIVED_CHANNEL_ACCESS_TOKEN", "channel_secret": "CHANNEL_SECRET" }'

Good to know

  • webhook_url in the response must be pasted into the Webhook URL field of the LINE channel (with “Use webhook” on). Until then no inbound messages arrive, so show it prominently.
  • chat_mode_ok: false means the Official Account is in “chat” mode and will not send or receive until it is switched to “bot” mode in the LINE Official Account Manager. Gate your onboarding on it.
  • bot_user_id from the response is the id for the status, verify and disconnect calls.
  • After the customer sets the webhook and bot mode, call verify-webhook to re-check the token and refresh the cached chat mode. token_valid: false means the token was reissued or revoked: call POST /channels/line again with the new one.
  • LINE has no live status feed, so live is always false on the status call: values reflect the last connect or verify.
  • The access token and secret are never returned by any endpoint. Keep them on your side if you need them again.

Viber

Viber connects like LINE, with one call carrying the bot’s auth token from the Viber Admin Panel (My Bot Settings). The difference: connecting also registers our webhook on the bot right away, so there is no console step afterwards. It also means a connect can fail when our side cannot answer Viber’s synchronous webhook check, not only when the token is wrong.

curl -X POST "https://api.dmchamp.com/v1/channels/viber?apiKey=YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "auth_token": "444d5555e6666f7777a8888b9999c000" }'

Good to know

  • bot_id from the response is the id for the later calls. The auth token is never echoed back.
  • GET .../status?live=true re-checks the bot with Viber and refreshes the cached webhook registration; without it you get the stored state (live: false).
  • webhook_ok: false means the bot’s webhook no longer points at us and inbound messages are dead. Usually another tool connected the same bot afterwards (Viber’s webhook registration is last-write-wins). Fix it with verify-webhook, which re-registers using the stored token; no need to ask the customer to re-paste it. token_valid: false there means reconnect with a fresh token.
  • Disconnect unregisters our webhook on Viber’s side (best effort) and removes the connection.

TikTok

Availability: TikTok messaging is not available to accounts yet (see Which Channels We Support). These endpoints serve a closed test and return a permission error on every other account, so do not build on them or list TikTok as a channel your clients can connect.

TikTok Business Messaging is an OAuth channel like Meta, but with no status loop to build: the connected account appears on its own once TikTok redirects back.

curl -X POST "https://api.dmchamp.com/v1/channels/tiktok/connect?apiKey=YOUR_API_KEY"
  • The connect call takes no credentials and returns an oauth_url that is valid for about 30 minutes. Open it yourself; there is no connect_url for TikTok.
  • The status call (by the TikTok Business Account’s open_id, known after the callback) is for confirming state on demand, not for polling; live is always false because there is no cheap live check. status: "reauth_required" means connect again: tokens refresh automatically once a year and this shows when that refresh fails.

GoHighLevel

GoHighLevel (GHL) is a CRM integration, not a messaging channel: it rides the account’s existing channels and does not use a channel slot on the plan. It is also the only integration here that can hold several connections at once, one per GHL location the app is installed on.

curl -X POST "https://api.dmchamp.com/v1/channels/ghl/connect?apiKey=YOUR_API_KEY"
  • The connect call returns an oauth_url valid for about 30 minutes. Open it so the account holder picks a location and approves. Leave the optional brand field out: the marketplace listing that belongs to the address you call is picked for you, and the response names the one used. Only pass it if you were given a specific listing key.
  • The status call lists every connected location.
  • Disconnecting a location stops every sync and trigger for it. It does not uninstall the app on the GHL side; the customer removes it from their GHL marketplace installs for that.

New Message trigger fields

A GHL workflow started by the New Message trigger receives these fields. Every value is text, so GHL filters can compare them directly.

Field What it holds
contact_id The contact’s ID here.
contact_name First and last name.
contact_phone The phone number. Empty when WhatsApp has hidden the contact’s number.
contact_number_hidden "true" for a WhatsApp Web contact whose number WhatsApp withheld, otherwise "false".
contact_whatsapp_lid The contact’s WhatsApp privacy ID (<digits>@lid) when reported, otherwise empty. Not a phone number, but it tells hidden-number contacts apart.
contact_email The email address, or empty.
channel The channel the message came in on.
direction Incoming or outgoing.
message The message text.
agent The ID of the agent assigned to the contact, or empty.
contact_kind "group" when the chat is a WhatsApp group, otherwise empty.
author_name In a WhatsApp group: the name of the member who wrote the message. Empty in a one-to-one chat.
author_phone In a WhatsApp group: that member’s phone number, when WhatsApp shows it. Otherwise empty.
author_whatsapp_id In a WhatsApp group: that member’s WhatsApp ID, the same on every message they write. Empty in a one-to-one chat.

If a workflow step sends an SMS to contact_phone, add a filter on contact_number_hidden so hidden-number contacts skip that step.

In a WhatsApp group chat, contact_name and contact_phone describe the group itself. Filter on contact_kind to keep group posts out of a workflow meant for one-to-one chats, and use the author_ fields to see who wrote the message.

AI Reply action: when it returns no reply

The AI Reply action never fails a GHL step for an expected reason. It returns success: false, a readable error and an error_code you can branch on with an If/Else step:

error_code Meaning
no_config No AI agent is assigned to this contact yet.
bot_inactive The AI agent for this contact is switched off.
ai_paused Pause all AI messages is on for the account (Settings). Nothing is charged. Turn the pause off to get replies again.
test_mode The agent is in test mode and this contact is not on its test list.
do_not_disturb The contact is marked do not disturb.
no_credits The account is out of AI credits, or has reached its monthly AI spending budget.
empty_reply There was no message to reply to, or the AI returned no text.
generation_failed The reply could not be generated. Try again.

Phone numbers (buy and release)

Instead of connecting an existing number you can buy a new WhatsApp-capable number: search, buy, then poll until it is ONLINE.

curl "https://api.dmchamp.com/v1/phone-numbers/available?country_code=US&apiKey=YOUR_API_KEY"
curl -X POST "https://api.dmchamp.com/v1/phone-numbers?apiKey=YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "phone_number": "+14155551234", "country_code": "US", "display_name": "Support line" }'

Price and purchase

  • Each search result shows the one-time purchase_credits and the recurring monthly_credits. A platform number costs at least 50 credits a month, rising with the carrier’s own monthly price, charged at purchase and on every renewal. Quote the numbers the search returns; never work out a price yourself.
  • type (local or mobile) is a preference; both classes may still come back. The first search on a new account sets some things up and can be a little slower.
  • A purchase starts in PURCHASED, then WhatsApp registration runs in the background: PURCHASED → PENDING → ONLINE. Poll GET /phone-numbers/{phoneNumber}/status, which works for every connected number, not only bought ones.
  • A missing business address or other required detail fails the purchase with a 400 naming it. Set it and try again.
  • Credits are not refunded when you release the number.

Releasing depends on whose number it is (DELETE /phone-numbers/{phoneNumber}):

  • Rented through the platform: a true release. The WhatsApp sender is de-registered, the number goes back to the carrier and leaves the account (it may not be available to buy again), and no credits are refunded.
  • Brought by the account (its own Twilio, its own Meta app or WhatsApp Business Account, or an Android SMS gateway): only removed from the account. Nothing is released upstream, so it can be reconnected at once. Its WhatsApp sender may or may not survive: the teardown tries to delete it with the account’s platform-managed Twilio credentials. On an account still on the managed setup that works and the sender is deleted (reconnecting means registering again); on an account that switched to its own Twilio the delete cannot authenticate and the sender stays registered there (reconnecting just re-attaches it).

Other number calls

  • Add a number you already own (POST /phone-numbers/byo, 201): only records it. No credits, nothing provisioned. It stays inactive until the account holder completes WhatsApp authorization to register a sender on it (the dashboard’s “Bring your own number” flow). A number that is not real E.164, or looks like Meta’s WhatsApp test number (which can never message real customers), is a 400. A number already on the account, even spelled differently like Mexico’s +52 and +521 forms, is a 409 instead of a duplicate.
  • Set the primary number (POST /phone-numbers/{phoneNumber}/set-primary): sets this number is_active: true and every other one false in one atomic step, so the account never has two active numbers or none. is_active cannot be changed through the general update on purpose. The response carries the full number object. A number not on the account is a 404.
  • Remove only the record (DELETE /phone-numbers/{phoneNumber}/record): a plain delete with no provider release and no de-registration. Use it to clear BYO, WhatsApp Web, Telegram or LINE records, or a stale entry. Unlike a release, a number that is not on the account is a 404, not a silent success.

Route a channel to a campaign

Connecting a channel gets messages into the account. It does not decide which AI Agent answers them. That is done by Entry Points on an AI Agent, not by campaigns. Each channel has one channel-default Entry Point naming the Agent that answers new, unknown contacts on it:

What you want to do Call
Point a channel at the Agent that should answer it PUT /entry-points/channel-defaults with { "channel": "instagram", "agent_id": "AGENT_ID" }
Check whether Entry Points decide routing for the account GET /entry-points/routing-status (answers cutover_enabled: true once they do)
Leave a channel with no Agent answering it DELETE /entry-points/channel-defaults?channel=instagram

This is the step most integrations miss. Until a channel has an Entry Point, a first message from someone new is stored, but nothing picks it up and no assistant replies. Connecting Instagram and creating an Agent is not enough: point the channel at the Agent. One Agent per WhatsApp number, keyword and comment rules are in the Entry Points API.

Route one or more channels (legacy campaign routing map)

POST /channels/campaign still writes the legacy per-channel campaign routing map, but that map is no longer consulted for inbound routing on any account. It is kept for rollback only. Do not build against it. For existing integrations:

  • It sets campaign_id as the answerer for each channel in channels (whatsapp, whatsapp_web, telegram, instagram, messenger, chat_widget, custom_channel, sms, email). The routing slot and the campaign’s enabled_channels are updated together, atomically.
  • DELETE /channels/campaign/{channel} clears one channel and takes it off that campaign’s enabled_channels; contacts already in the campaign carry on. It is idempotent (cleared: false, campaign_id: null when nothing was routed) and needs the incoming campaigns feature on the plan (403 without it).

What has to be true for routing to actually fire

On an account that still reads the legacy map, three campaign settings decide whether an inbound message is answered: type must be Incoming from Unknown Contacts or Combined (otherwise the call is a 400); status must be Live (a Draft campaign stores the routing but never picks anything up, the most common “nothing happens”); ai_mode must be true (otherwise the message is stored and nobody replies). Keyword matching now lives on Entry Points (type keyword).

One campaign per channel

Each channel holds one legacy slot. Routing a second campaign to the same channel silently re-points it and returns 200, with no conflict error. The previous campaign keeps the contacts it already has and stops receiving new ones.

Clear a channel’s routing

Use DELETE /channels/campaign/{channel} as described above.

Agencies: both legacy endpoints accept sub_account_id (in the body on POST, as a query parameter on DELETE), so you can provision a client’s routing with your agency key. See API for Agencies.


Use your own Meta app (Instagram + Messenger)

By default the Instagram + Messenger connection runs through the platform’s Meta app, so that app’s name is on the Facebook consent screen. Register your own Meta app to show your brand instead. Once saved it applies to your account and the client accounts under it, including the Instagram & Messenger Connect button in the app’s channel settings. Nothing changes in the connect calls except the branding.

This only covers Instagram + Messenger. WhatsApp, WhatsApp Web, Telegram and LINE are unaffected.

What your app needs first

This is the slow part, and it happens on the Meta side:

  1. An app of type Business, with the Messenger and Instagram products.
  2. Advanced Access (Meta App Review) for pages_show_list, pages_messaging, pages_manage_metadata, pages_read_engagement, instagram_basic, instagram_manage_messages. Without it only people with a role on your app can connect, so your clients’ connects fail. Review typically takes a few weeks and needs Business Verification.
  3. A Facebook Login for Business configuration in your app granting the same permissions. Its numeric ID is per app, so you must create your own.

A missing permission fails at connect time with an error naming it (the status poll shows byo_app_missing_permissions) instead of appearing to work and failing on the first message.

Step 1 - Save your app

curl -X PUT "https://api.dmchamp.com/v1/account-config/meta-app?apiKey=YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "app_id": "1234567890123456", "app_secret": "your-app-secret", "config_id": "9876543210987654" }'

app_id, app_secret and config_id are all needed for the Facebook Login flow (leave all three out if you only run the Instagram Login lane below). The secret is checked with Meta before it is stored, encrypted, and never returned. The response gives you oauth_redirect_uri, verify_token and the webhook_urls for the next step.

Step 2 - Configure your app to talk to us

In your Meta app’s dashboard:

  1. Webhooks: for both the Instagram and Messenger products, set the Callback URL to the matching webhook_urls value and the Verify token to verify_token. Subscribe to messages, messaging_postbacks and comments.
  2. Valid OAuth Redirect URIs: in Facebook Login for Business settings, add oauth_redirect_uri exactly as returned. It is the same address for every account, whichever API domain you call.
  3. Login for Business configuration: it must include Pages (with pages_show_list and the page messaging permissions), or no Page is shared and the status ends failed with reason no_pages.

GET /account-config/meta-app returns the same setup material any time. DELETE /account-config/meta-app removes the app, so future connects go back to the platform app; also remove the webhook subscription inside your app.

Step 3 - Connect as usual

POST /channels/meta/connect (and the hosted connect_url) now use your app automatically; uses_byo_meta_app: true in the response confirms it. Sending, Page selection and disconnects work the same.

Bring your own Instagram Login app (token push)

The section above is the Facebook Login flow, through a Facebook Page. Meta also offers Instagram API with Instagram Login: the account holder signs in on Instagram itself, with no Facebook account or Page. If your platform already runs a Meta app with that product, there is no OAuth on our side. Your clients authorize your app and you push us the finished credential per account:

  1. Save your Instagram app’s credentials once, so we can verify your webhooks.
  2. Per account, push the Instagram professional account ID and the long-lived Instagram user token your app obtained.
  3. Point your app’s Instagram messaging webhook at us. Events for accounts you never pushed are acknowledged and ignored.
  4. You own the token lifecycle: refresh tokens in your system and push each refreshed one with the same call. We never refresh a pushed token.

What your app needs first

  • The Instagram product (“API setup with Instagram login”) on your Meta app. It has its own App ID and App Secret, separate from the Facebook pair; find them in the product’s setup panel.
  • Advanced Access for instagram_business_basic and instagram_business_manage_messages (plus instagram_business_manage_comments for comment automations). Without it only people with a role on your app can authorize.

Step 1 - Save your Instagram app credentials

Send instagram_app_id and instagram_app_secret (always together) to the same PUT /account-config/meta-app. Send the pair alone if Instagram Login is all you run, or with the Facebook fields if you run both. A save always describes the whole setting, so whichever set you leave out is removed. The response carries verify_token and webhook_urls.instagram_login (the instagram and messenger URLs only appear when the Facebook fields are stored too). In your app’s Webhooks panel for the Instagram product, set the Callback URL to webhook_urls.instagram_login, the Verify token to verify_token, and subscribe to messages and comments.

Step 2 - Push a token per account

curl -X PUT "https://api.dmchamp.com/v1/channels/instagram-login/token?apiKey=YOUR_AGENCY_KEY&sub_account_id=CLIENT_ID" \
  -H "Content-Type: application/json" \
  -d '{ "ig_user_id": "17841400000000000", "access_token": "IGAAR…", "expires_at": "2026-11-01T00:00:00Z" }'
  • ig_user_id is the Instagram professional account ID: the user_id field from GET https://graph.instagram.com/v21.0/me?fields=user_id,username, the same ID Instagram webhooks carry as entry.id. It is not the id field from /me, which is app-scoped and differs per Meta app; pushing that one returns a 400 naming the mistake.
  • The token is checked live with Instagram before it is stored: it must work and belong to ig_user_id. Expiry comes from expires_at or expires_in (seconds), and defaults to 60 days.
  • The push subscribes your app to that account’s webhooks for you, so messages start flowing with no extra call.
  • Refreshing: push the new token with the same ig_user_id; it updates in place.
  • Conflicts: one Instagram account is never live on two connections. If it is already connected elsewhere, or on this account through the Facebook Page flow, you get a 409 naming the connection to disconnect first. A Facebook-flow connection is never replaced automatically, because it may also serve Messenger.
  • Works with sub_account_id like every other route, so an agency key can provision its whole fleet.

Step 3 - Disconnect when a client leaves

DELETE /channels/instagram-login/token (same auth and sub_account_id) unsubscribes the webhooks (best effort) and removes the stored credential. It always succeeds, even when the token has already died, and from then on that account’s webhook events are ignored.


Tips for building a reliable wrapper

  • Poll gently. Every few seconds is plenty. Stop at a terminal state (connected / ONLINE, or a failure), and put an overall timeout on the loop: the browser and QR steps expire (see each expires_at).
  • URL-encode phone numbers in the path. Send the leading + as %2B. Bare digits are recovered too, but encoding is the safe default.
  • Never expect secrets back. Access tokens, channel secrets and page tokens are accepted and stored but never returned.
  • Handle the auth gate. A 403 means API access is not on the plan, or the channel you are connecting is not included in it. See API Access.
  • Mind the rate limit. Authenticated requests are capped at 300 per minute; a 429 means back off and retry. See Authentication.

Next steps