Hand a conversation to your team

Configure when the agent should ask your team for help. When that rule is triggered, Platica opens a case that a person can take, annotate and close.

An escalation defines when to ask a person for help, what data to collect, the priority and who to notify. It also determines whether the agent pauses or keeps replying. When triggered, it opens a case with a reference number and history.

Before you start

You need a published agent, its id in AGENT_ID and a team member's email.

To use the platform, see Human assistance and Handle cases.

  1. Create the escalation

    Escalations are stored in the workspace library and can be shared by agents. Check the list of escalations before creating another one. (Create an escalation)

    import { Platic } from "platic-sdk";
    
    const platic = new Platic({ apiKey: process.env.PLATIC_API_KEY! });
    const agentId = process.env.AGENT_ID!;
    
    const billing = await platic.escalations.create({
      name: "Billing",
      description: "When the customer reports a mistake on their invoice.",
      prefix: "BIL",
      fields: [{ key: "order", label: "Order number", kind: "text", required: true }],
      assignment: { mode: "contact_owner", userIds: ["billing@acme.com"] },
      agent: { keepReplying: false, waitMessage: "I am passing you to billing." },
    });

    Keep the response's id in ESCALATION_ID. description is what the agent reads to decide whether to use this escalation: write it as you would explain the situation to a person. prefix is 2 to 4 letters and starts the folio (BIL-0143). With keepReplying: false the agent pauses and the conversation moves to assistance; with true it keeps answering. waitMessage is what it tells the contact when it escalates, and only goes with keepReplying: false.

  2. Let the agent use it

    Turn on assistance in the agent's draft, list the escalation and publish. (Update the draft, Publish)

    await platic.agents.draft.update(agentId, {
      assistance: { enabled: true, escalations: [{ escalationId: billing.id, enabled: true }] },
    });
    await platic.agents.publish(agentId);

    Assistance is part of the agent's configuration, so it goes through the draft and a publication. The shortcut Connect an escalation links one that already exists and publishes right away, but it doesn't turn assistance.enabled on and it fails with 409 DRAFT_PENDING if the draft has unpublished changes (connect_agent_escalation in MCP).

    Editing or archiving an escalation later applies right away to the agents that use it, but every open case keeps its own copy.

  3. Find the case

    A case opens when the agent triggers the escalation. List the open cases. (List cases)

    const { data: cases } = await platic.cases.list({ status: "open" });
    const caseId = cases[0].id;

    Keep the case's id in CASE_ID. Filters combine: status, escalationId, contactId, conversationId, assigneeId and priority. The list doesn't include the log: read it with Get a case.

    To open a case yourself, for example when your own system detects the problem, use Open a case (open_case) with the escalationId and the conversationId. A customer has at most one open case per escalation.

  4. Take it and leave a note

    Whoever takes the case is assigned to it, and the conversation moves to supervised: a person handles it. With an API key you must say who (userId, an id or the email of a member). (Take a case, Add a note)

    await platic.cases.accept(caseId, { userId: "ana@acme.com" });
    await platic.cases.addNote(caseId, { text: "The charge was checked: it was duplicated." });

    Taking the case does not send a message to the customer. notifyCustomer: true only records in the response that you want to notify them. Send the message through the conversation yourself (Send a message).

  5. Close it and return the conversation to the agent

    Choose reason: resolved if the issue was resolved, discarded if the case didn't apply (declined in the platform), or unresolved if it remains unresolved. Include a note for discarded and unresolved. (Close a case)

    await platic.cases.close(caseId, { reason: "resolved", note: "The invoice was reissued.", returnToAgent: true });

    With returnToAgent: true, the agent resumes on the customer's next message if this was the last open case and a person was handling the conversation. It doesn't send an immediate reply. To notify the customer, send a message yourself, or resume the agent with an instruction so it replies now. Closing one case doesn't return the conversation to the agent while other cases remain open.

Check it worked

Use Get the case to check the closed status and closing note in its log. If it was the last open case and you used returnToAgent: true in a supervised conversation, check that the conversation returned to automatic.

A closed case is read-only and can't be reopened.

Subscribe a webhook to case.created, case.updated, case.assigned, case.note.created and case.closed to follow cases from your own system: see Receive webhooks.

Take over a conversation without a case

Your team can also take a conversation from the agent at any moment, with no escalation, and hand it back later. Use the conversation's id.

ActionWhat happens
PauseThe team takes over: the conversation becomes supervised and a reply the agent is writing stops.
ResumeBack to the agent (automatic), which replies to the contact now, following the optional instruction. On a conversation that is already automatic it changes nothing.
WaitBack to the agent without replying now. The instruction is stored and the agent reads it when the contact writes next.
const conversationId = process.env.CONVERSATION_ID!;

await platic.conversations.pause(conversationId);

// The agent replies now, following the instruction.
await platic.conversations.resume(conversationId, {
  instruction: "Apologize for the delay and confirm the refund date.",
});

// Or: hand it back without replying now; the agent reads the note on the contact's next message.
await platic.conversations.wait(conversationId, {
  instruction: "The refund was approved on Monday; confirm it if they ask.",
});

Each answer is the conversation afterwards, with meta.changed: pausing a conversation that is already supervised answers changed: false and does nothing. Send an Idempotency-Key on resume: without it, a retry after a lost answer could make the agent reply twice. The SDK sends one for you. To find the conversations your team is handling, list conversations with operation=supervised, or assign them to a member.

Next steps