Connect a channel

SDK platic.channels.connect()

Start a pending connection. A person completes it to create one or more channels in the workspace. Check the connection until its state is connected.

completion tells you how to finish the connection for its type:

  • authorize (messenger, instagram, facebook-comments, instagram-comments): someone authorizes with Meta and chooses which pages or accounts to connect. The response has shareUrl, a link you can send to whoever manages the Facebook page or the Instagram account, even if they have no Platica account or are not part of your workspace. It also has authorizeIn, the same step inside Platica for someone on your team with a session. See sending the link to someone else.
  • wizard (whatsapp, email, gmail, outlook): authorizeIn opens that channel's wizard in Platica, with ?connection=chc_…. Someone on your team with a session and write access to Integrations finishes it there. There is no shareUrl. The connection becomes connected when a channel of that type is created in the workspace.

It also works to reconnect a channel that stopped working: request another connection of the same type.

For your site's chat or a web page, use create a web chat.

Example

await platic.channels.connect({ type: "messenger", agentId: "agent_123" });

Query parameters

ParameterTypeDescriptionRequired
workspacestringWorkspace ID. Required if your credential covers several workspaces; without it the answer is 400If the credential has several

Request body

FieldTypeDescriptionRequired
typestringThe channel. With a shareable link: messenger, instagram, facebook-comments, or instagram-comments. With a wizard in Platica: whatsapp, email, gmail, or outlook. The rest are explained in other types✓
agentIdstring | nullThe agent that will answer the resulting channels. It must exist in the workspace. If you omit it, they are left without an agent and you choose it later with update a channel—
expiresInMinutesintegerHow long the connection and its link last, in minutes: 15 to 10080 (7 days). If you omit it, 1440 (24 hours)—
{
  "type": "messenger",
  "agentId": "tVKljCHCNiebQdasHeit",
  "expiresInMinutes": 2880
}

Response

201 Created. data is the connection, in awaiting_user.

Messenger, Instagram, or comments (completion: "authorize"):

{
  "status": "success",
  "message": "Pending: a person must complete this connection — see nextStep",
  "data": {
    "id": "chc_7f3k9QmX2pLwR4tZ",
    "type": "messenger",
    "completion": "authorize",
    "status": "awaiting_user",
    "authorizeIn": "https://app.platica.mx/workspace/g6yCA16pkWl5eXo7KszB/connect/channel/chc_7f3k9QmX2pLwR4tZ",
    "shareUrl": "https://app.platica.mx/connect/chl_Q2x7vR9mK4pT1sW8yZ3bN6cF0hJ5gL2dA7eU9iO4qXk",
    "createdAt": "2026-11-12T18:40:00.000Z",
    "expiresAt": "2026-11-14T18:40:00.000Z",
    "agentId": "tVKljCHCNiebQdasHeit",
    "availableAssets": [],
    "channels": [],
    "error": null,
    "nextStep": "Send shareUrl to whoever manages the Facebook page: it works without a Platica account until expiresAt. They sign in with Facebook and choose the pages. A member of this workspace with access to Integrations can also open authorizeIn. Then check this connection again with GET /v1/channels/connections/chc_7f3k9QmX2pLwR4tZ. To send a new link (the current one stops working), use POST /v1/channels/connections/chc_7f3k9QmX2pLwR4tZ/link."
  }
}

WhatsApp, email, Gmail, or Outlook (completion: "wizard"):

{
  "status": "success",
  "message": "Pending: a person must complete this connection — see nextStep",
  "data": {
    "id": "chc_Vn2sQ8rT5wYk1LmP",
    "type": "whatsapp",
    "completion": "wizard",
    "status": "awaiting_user",
    "authorizeIn": "https://app.platica.mx/workspace/g6yCA16pkWl5eXo7KszB/integrations/channels/whatsapp/new?connection=chc_Vn2sQ8rT5wYk1LmP",
    "shareUrl": null,
    "createdAt": "2026-11-12T18:40:00.000Z",
    "expiresAt": "2026-11-13T18:40:00.000Z",
    "agentId": null,
    "availableAssets": [],
    "channels": [],
    "error": null,
    "nextStep": "Ask a person with access to Integrations in this workspace to open authorizeIn and finish the WhatsApp wizard in Platica. This connection becomes connected when the channel is created; check it with GET /v1/channels/connections/chc_Vn2sQ8rT5wYk1LmP."
  }
}

The fields are in get a connection. Save the id: you check the connection with it.

Other types

typeResponse
webchat, webpage409 USE_WEBCHATS. Web chat and the web page do not use a connection: they are created with POST /v1/webchats (the web page with mode: "page"). details.nextStep says how
telegram, sms, voice409 CHANNEL_TYPE_NOT_AVAILABLE. They cannot be connected yet. details.channelsUrl opens the channels in Platica, where they show as coming soon
Any other400 INVALID_REQUEST
{
  "code": 409,
  "error": "Conflict - The resource state conflicts with this request",
  "details": {
    "code": "CHANNEL_TYPE_NOT_AVAILABLE",
    "message": "A \"telegram\" channel cannot be connected yet.",
    "channelsUrl": "https://app.platica.mx/workspace/g6yCA16pkWl5eXo7KszB/integrations/channels",
    "nextStep": "It is not available yet. channelsUrl opens the channels in Platica, where it shows as coming soon."
  }
}

Errors

Statusdetails.codeWhen it happens
400INVALID_REQUESTtype is missing or is not a type Platica knows, agentId is not valid, or expiresInMinutes is not an integer between 15 and 10080. details.issues says which field. Also when your credential covers several workspaces and ?workspace= is missing (details.available)
401UNAUTHENTICATED / CREDENTIAL_REVOKEDThe credential is missing, invalid, or no longer covers this workspace
403FORBIDDENThe credential does not have write access to Integrations, or does not have access to the agentId agent
403INSUFFICIENT_SCOPEThe OAuth token does not have platica:write
403READ_ONLY_CREDENTIALAn internal Platica agent can only read
404AGENT_NOT_FOUNDThe agentId agent does not exist in this workspace
409USE_WEBCHATStype is webchat or webpage. Create it with create a web chat
409CHANNEL_TYPE_NOT_AVAILABLEtype is telegram, sms, or voice. details.channelsUrl opens the channels in Platica
503CHANNEL_NOT_CONFIGUREDThat type is not available in this environment yet
503OPERATION_UNCONFIRMEDPlatica could not confirm whether it created the connection. List the connections before retrying
{
  "code": 400,
  "error": "Bad Request - The request has validation errors",
  "details": {
    "code": "INVALID_REQUEST",
    "message": "expiresInMinutes must be at most 10080 (7 days)",
    "issues": [
      { "path": ["expiresInMinutes"], "message": "expiresInMinutes must be at most 10080 (7 days)" }
    ]
  }
}

Messages that come from Platica (AGENT_NOT_FOUND, CHANNEL_NOT_CONFIGURED, and the permission ones) are in Spanish; code against details.code. The general format is in Errors.

Notes

  • authorizeIn is completed by a workspace member with write access to Integrations, with their Platica session. It does not have to be whoever requested the connection. shareUrl does not ask for a session: whoever has access to the page or account in Meta opens it.
  • On a wizard connection, any channel of that type created in the workspace after you request it completes it, even if it was not opened from authorizeIn. It is checked every time you get or list connections.
  • One connection can create several channels. If the account has several pages or accounts, the connection waits in awaiting_selection: choose what to connect, or let the person choose on the page where they authorized.
  • To stop it before it finishes, cancel it.
  • Needs a workspace API key, or an OAuth token with write access to Integrations and the platica:write scope.