Skip to Content
CraftBot Docs v1 — internal preview

Safety

The safety surface is the duty-of-care control that runs before every Agent-node webhook fires. It has two parts: a list of keywords that trigger the filter, and a library of messages that are sent to the user when a keyword matches. On a match, the agent call is skipped, the configured message is sent, and the conversation is routed to a human queue.

Safety page with the Keywords / Messages tab bar and a sample keyword row

Safety enforcement at the tenant level is controlled separately — see Tenant for the super-admin toggle. When enforcement is on (the launch default), every keyword on this page is evaluated before any Agent node runs.

Keywords

Each keyword is a whole-word, case-insensitive matcher against the user’s most recent inbound message. Regex metacharacters in the keyword are escaped automatically.

Adding a keyword

  1. Settings → Safety → Keywords tab → + Add keyword.
  2. Keyword — the word or short phrase to match. Whole-word match only.
  3. Language — English or Arabic. Each keyword fires only when the contact’s language matches.
  4. Category — free text used for organisation and analytics. Common values are medical_emergency, mental_health, distress, fraud, abuse. Any taxonomy that makes sense for your operation is valid.
  5. Safety message — pick one of the messages defined in the Messages tab. Leave blank to fall back to the tenant default safety message at runtime.
  6. Enabled — disabled keywords are stored but excluded from the live regex.

Editing and filtering

The list supports filtering by language and category. Use this when refining a single category’s coverage — for example, reviewing every keyword tagged medical_emergency together.

Messages

A safety message is a bilingual canned reply the user receives when a matching keyword fires. Multiple messages cover different categories (e.g. a clinical-emergency message vs. a mental-health one).

Adding a message

  1. Settings → Safety → Messages tab → + Add message.
  2. Name — internal label used by admins when linking a keyword to a message (e.g. Mental health — adult).
  3. English body — the reply sent to English-speaking users. Supports {{contact.name}} interpolation.
  4. Arabic body — the reply sent to Arabic-speaking users. Same interpolation rules.
  5. Transfer queue (optional) — when set, conversations matching a keyword that points at this message route to this queue instead of the default routing strategy.

How matches resolve

When a keyword matches a user’s inbound message:

  1. The Agent node call is skipped — no webhook fires.
  2. The user receives the safety message linked to that keyword (or the tenant default message if no link).
  3. The conversation is routed to the message’s transfer queue if set, otherwise via the default routing strategy.
  4. The match is logged for audit and analytics review.

Best practices

  • Seed both languages from day one. A keyword list that only covers English will miss every Arabic-speaking user in distress — high-severity scenarios are exactly the wrong place to leave a coverage gap.
  • Author the message before the keyword. Linking a keyword to a missing message means it falls back to the tenant default, which may not be specific enough for the category.
  • Treat the keyword list as a living document. Review false negatives weekly during the first month after launch; the right vocabulary is operation-specific and rarely complete on day one.
  • Keep category strings consistent. Free-text categories are powerful but also easy to typo — agree on a small set and stick to it.
  • Never disable the safety pre-filter at the tenant level without sign-off from compliance. The toggle exists for narrow technical-deployment cases; production tenants should always run with it enforced.
Last updated on