Starters
Starter schemas ship as documentation and as the sandbox defaults. Reference one as "schema": "starter:<name>" in create_bucket, or copy the JSON and edit it. Generated from the code. There are no invoice or payment starters and there will not be.
support-request-v1
A customer asking for help. Fills who asked, what about, any reference number they quote, and an urgency flag. Works on plain text and HTML bodies; needs no attachments.
| Field | Type | Required | Human | Extractors |
|---|---|---|---|---|
requester_email | yes | mailbox (reply_to), then mailbox (from) | ||
requester_name | string | mailbox (from) | ||
summary | string | yes | regex (subject) | |
reference | string | labeled_value (all_text), then regex (all_text) | ||
urgency | string (low, normal, high) | regex (all_text), then constant |
Bucket example
{
"name": "support-requests",
"rule": {
"any": [
{
"address": "support@"
},
{
"address": "help@"
},
{
"subject_contains": [
"help",
"support",
"issue",
"problem",
"not working",
"broken"
]
}
]
},
"schema": "starter:support-request-v1",
"policy": {
"auto_accept": {
"min_confidence": 1
}
},
"destinations": [
"main"
]
}
Full schema
{
"name": "support-request-v1",
"version": "1",
"description": "A customer asking for help. Extracts who, what, and any reference they quote.",
"fields": {
"requester_email": {
"type": "email",
"required": true,
"extract": [
{
"kind": "mailbox",
"source": "reply_to",
"part": "address"
},
{
"kind": "mailbox",
"source": "from",
"part": "address"
}
]
},
"requester_name": {
"type": "string",
"extract": [
{
"kind": "mailbox",
"source": "from",
"part": "name"
}
]
},
"summary": {
"type": "string",
"required": true,
"extract": [
{
"kind": "regex",
"pattern": "^(?:re:|fwd?:)?\\s*(?<value>.+)$",
"source": "subject",
"transforms": [
"trim"
]
}
]
},
"reference": {
"type": "string",
"description": "An order, ticket, or account number the customer quotes, if any.",
"extract": [
{
"kind": "labeled_value",
"labels": [
"Order",
"Order #",
"Order number",
"Ticket",
"Ticket #",
"Account",
"Account #",
"Reference"
],
"source": "all_text",
"value": "[A-Z0-9-]{3,}"
},
{
"kind": "regex",
"pattern": "\\b(?:order|ticket|ref(?:erence)?)\\s*(?:#|no\\.?|number)?\\s*:?\\s*(?<value>[A-Z0-9-]{3,})",
"source": "all_text",
"transforms": [
"upper"
]
}
]
},
"urgency": {
"type": "string",
"enum": [
"low",
"normal",
"high"
],
"description": "high when the text says so, else normal by default.",
"extract": [
{
"kind": "regex",
"pattern": "\\b(?<value>urgent|asap|immediately|emergency)\\b",
"source": "all_text",
"transforms": [
{
"replace": {
"pattern": ".+",
"with": "high"
}
}
]
},
{
"kind": "constant",
"value": "normal"
}
]
}
}
}
customer-order-v1
An order placed by a customer, typically a store confirmation copied to the business. ship_to is marked requires_human, so every order creates a task until a person or an approve-scoped key confirms the address.
| Field | Type | Required | Human | Extractors |
|---|---|---|---|---|
order_number | string | yes | labeled_value (all_text), then regex (subject) | |
customer_email | yes | labeled_value (all_text), then mailbox (reply_to), then mailbox (from) | ||
customer_name | string | labeled_value (all_text), then mailbox (reply_to), then mailbox (from) | ||
order_date | date | labeled_value (all_text), then header | ||
total | number | labeled_value (all_text) | ||
currency | string (USD, EUR, GBP) | regex (all_text), then regex (all_text) | ||
ship_to | string | yes | regex (all_text) | |
items | string[] | regex (all_text) |
Bucket example
{
"name": "customer-orders",
"rule": {
"any": [
{
"address": "orders@"
},
{
"subject_contains": [
"order confirmation",
"your order",
"new order"
]
},
{
"subject_matches": "\\border\\s*#?\\s*[A-Z0-9-]{3,}"
}
]
},
"schema": "starter:customer-order-v1",
"policy": {
"auto_accept": {
"min_confidence": 1
}
},
"destinations": [
"main"
]
}
Full schema
{
"name": "customer-order-v1",
"version": "1",
"description": "An order placed by a customer, typically a store confirmation forwarded or copied to the business.",
"fields": {
"order_number": {
"type": "string",
"required": true,
"extract": [
{
"kind": "labeled_value",
"labels": [
"Order",
"Order #",
"Order number",
"Order No",
"Order ID"
],
"source": "all_text",
"value": "#?[A-Z0-9-]{3,}",
"transforms": [
{
"replace": {
"pattern": "^#",
"with": ""
}
}
]
},
{
"kind": "regex",
"pattern": "order\\s*(?:#|no\\.?|number|id)?\\s*:?\\s*#?(?<value>[A-Z0-9-]{3,})",
"source": "subject"
}
]
},
"customer_email": {
"type": "email",
"required": true,
"extract": [
{
"kind": "labeled_value",
"labels": [
"Email",
"Customer email",
"E-mail"
],
"source": "all_text",
"value": "[^\\s]+@[^\\s]+"
},
{
"kind": "mailbox",
"source": "reply_to",
"part": "address"
},
{
"kind": "mailbox",
"source": "from",
"part": "address"
}
]
},
"customer_name": {
"type": "string",
"extract": [
{
"kind": "labeled_value",
"labels": [
"Customer",
"Name",
"Customer name",
"Bill to",
"Ship to"
],
"source": "all_text"
},
{
"kind": "mailbox",
"source": "reply_to",
"part": "name"
},
{
"kind": "mailbox",
"source": "from",
"part": "name"
}
]
},
"order_date": {
"type": "date",
"extract": [
{
"kind": "labeled_value",
"labels": [
"Order date",
"Date",
"Placed on",
"Ordered on"
],
"source": "all_text"
},
{
"kind": "header",
"name": "date"
}
]
},
"total": {
"type": "number",
"min": 0,
"extract": [
{
"kind": "labeled_value",
"labels": [
"Order total",
"Total",
"Grand total",
"Amount"
],
"source": "all_text",
"value": "[$€£]?\\s?[\\d,]+(?:\\.\\d{2})?"
}
]
},
"currency": {
"type": "string",
"enum": [
"USD",
"EUR",
"GBP"
],
"extract": [
{
"kind": "regex",
"pattern": "(?<value>USD|EUR|GBP)\\b",
"source": "all_text",
"transforms": [
"upper"
]
},
{
"kind": "regex",
"pattern": "(?<value>[$€£])\\s?[\\d,]+",
"source": "all_text",
"transforms": [
{
"replace": {
"pattern": "\\$",
"with": "USD"
}
},
{
"replace": {
"pattern": "€",
"with": "EUR"
}
},
{
"replace": {
"pattern": "£",
"with": "GBP"
}
}
]
}
]
},
"ship_to": {
"type": "string",
"requires_human": true,
"description": "Delivery address. Always reviewed by a person before use.",
"extract": [
{
"kind": "regex",
"pattern": "ship(?:ping)?\\s*(?:to|address)\\s*:?\\s*\\n?(?<value>(?:[^\\n]+\\n?){1,4}?)(?:\\n\\s*\\n|$)",
"source": "all_text",
"transforms": [
"collapse_whitespace"
]
}
]
},
"items": {
"type": "string[]",
"extract": [
{
"kind": "regex",
"pattern": "items?\\s*:?\\s*\\n(?<value>(?:[ \\t]*(?:-|\\d+\\s*[x×])[^\\n]+\\n?)+)",
"source": "all_text",
"transforms": [
{
"replace": {
"pattern": "^[ \\t]*-\\s*",
"with": ""
}
}
]
}
]
}
}
}This page as Markdown.