Handling the response

The four actions Dexbi sends back, what your app should do with each, and a full example of every one.

Every successful response has these fields. action tells you what to do. Dexbi never posts, pings or closes anything itself for an API request: your app does.

FieldTypeWhat it is
action"reply", "handover", "close" or "none"What your app should do.
messagestring or nullThe text to send the member. It can contain Markdown, like bold, lists and links, as in Discord.
staffNotestring or nullWith handover: a short brief of the issue, for your staff.
titlestring or nullA suggested thread title, only when you ask for one with suggestTitle: sent once, on the turn the issue becomes clear, in lowercase words joined by dashes.
teamWaitSecondsnumber or nullWith none in a ticket with reply: "smart": your staff replied last, so Dexbi waits this many seconds for them. null with teamWaitMinutes: "never". See Waiting for your staff.
conversationstringThe conversation you sent.
fieldsobjectOnly when you send fields: each one filled in, under its own name. See Custom fields.
attributionobjectThe "Powered by Dexbi" credit, and whether your plan requires it. See Show the Powered by Dexbi credit.

Show the "Powered by Dexbi" credit

Every response has an attribution object:

"attribution": { "text": "Powered by Dexbi", "url": "https://dexbi.app", "required": true }

On the Free plan, required is true. Wherever you show Dexbi's answers, on your website, in your app or in Modmail, keep "Powered by Dexbi" visible next to them, linked to https://dexbi.app. Removing, hiding or changing it breaks the Terms of Service, and we may suspend the API key or the workspace.

On a paid plan, required is false, and showing it is up to you.

The Modmail plugin handles this for you. See Keys made by Modmail.

The four actions

actionWhat it meansWhat your app should do
replyDexbi has something to tell the member.Send message to the member.
handoverOne of your escalation rules matched.Send message to the member, and alert your staff with staffNote.
closeThe member is done, or asked to close.Send message, then close the thread.
noneDexbi should stay out.Nothing. Don't send anything.

message can also be null with handover or close, when Dexbi has nothing to say. Only send it when it's there.

reply

{
  "action": "reply",
  "message": "You can ask for a refund within 14 days from your order page: **Account → Orders → Request refund**.",
  "staffNote": null,
  "title": "refund",
  "conversation": "thread-8812"
}

handover

{
  "action": "handover",
  "message": "I've passed this to the team. A teammate will sort out your refund here shortly.",
  "staffNote": "Charged twice this month for the same order; wants one charge refunded.",
  "title": null,
  "conversation": "modmail-thread-8812"
}

Your escalation rules live in Guidance > Escalation, the same ones Discord uses. What happens next is up to you: ping your staff, move the thread, or assign it. The On escalation actions you set in the dashboard don't run for API requests. See Escalate tickets to staff.

close

{
  "action": "close",
  "message": "Glad that's sorted! I'll close this ticket now.",
  "staffNote": null,
  "title": null,
  "conversation": "modmail-thread-8812"
}

Dexbi sends close when the member asks to close the conversation or confirms it's done. Close the thread in your app. The On close actions you set in the dashboard don't run for API requests.

none

{
  "action": "none",
  "message": null,
  "staffNote": null,
  "title": null,
  "conversation": "website-chat-visitor-51"
}

Handle it in code

const answer = await response.json();

switch (answer.action) {
  case "reply":
    await sendToMember(answer.message);
    break;
  case "handover":
    if (answer.message) await sendToMember(answer.message);
    await alertStaff(answer.staffNote);
    break;
  case "close":
    if (answer.message) await sendToMember(answer.message);
    await closeThread();
    break;
  case "none":
    break; // Dexbi stays out.
}

sendToMember, alertStaff and closeThread are your app's own functions.

Why Dexbi sends none

none means Dexbi should not speak. It's not an error, and it doesn't use an AI reply. Some reasons:

  • With reply: "smart", the message is chatter, not a question for Dexbi. In a ticket, your staff replied last and Dexbi is waiting for them: the response has teamWaitSeconds.
  • The message is from your staff (author: "staff").
  • Dexbi has no answer and whenUnsure is "quiet".
  • With reply: "pings", the message isn't directed.
  • The conversation was escalated and Dexbi is staying quiet. See After an escalation.
  • It's a ticket Dexbi couldn't answer while your workspace was out of monthly AI replies. Your staff looked after it, so it stays theirs after the replies come back: Dexbi answers only directed messages there, until you resume it.
  • The conversation was closed and afterClose is "quiet".
  • The member is ignored for trolling, blocked, or reached the daily reply limit.
  • Your workspace used its monthly AI replies, or replies are paused.

After an escalation

After a handover, afterEscalation decides what Dexbi does for the rest of the conversation. Leave it out and your workspace's After escalation setting in Guidance applies.

  • "quiet" (Only reply when pinged): Dexbi sends none so your team can take over, unless the message has directed: true.
  • "open" (Keep replying normally): Dexbi keeps answering.

Keep using the same conversation, so Dexbi knows it was escalated. Set directed: true when the member pings Dexbi or replies to it. A directed message is answered, and the conversation stays with your team.

When your team is done, resume the conversation and Dexbi answers every message again.

After a close

If the member writes again in a closed conversation, afterClose decides:

  • "quiet": Dexbi sends none for every later message, like Go silent. To start over, use a new conversation.
  • "open": Dexbi keeps answering.

Leave it out and Dexbi keeps answering, the same as "open".

Dexbi doesn't close a conversation that went quiet. Close idle threads in your app.

On this page