New message → reply draft
Each new message is sorted into one of your categories and a reply is drafted in the right tone for that category. You approve, edit, or reject the draft with a comment.
- messageId
- msg-sample-2
- threadId
- thr-sample-2
- from
- reader@sample.example
- to
- ["you@example.com"]
- subject
- Question about my order
- snippet
- Hi — when will my order arrive?
- receivedAt
- 2026-11-04T11:00:00Z
- labelIds
- ["INBOX"]
- hasAttachments
- false
Sample result: Sorted as: Question. Reply drafted in your voice. Approved by you. Reply draft ready.
What each step does
Step 1 · Sort it into a category
An AI step does this part. Today it runs on a simulated stand-in, labelled simulated on every run, until a real model is wired. This step reads text that arrived from outside — an email, a document, a form. Treat its output as a draft from untrusted input: that is why a person checks what it produces before anything leaves. This step sorts each item into your categories. After it has seen about 15 examples you have checked, it can start sorting the routine ones on its own — staged — coming next.
Step 2 · Draft it
An AI step does this part. Today it runs on a simulated stand-in, labelled simulated on every run, until a real model is wired. This step reads text that arrived from outside — an email, a document, a form. Treat its output as a draft from untrusted input: that is why a person checks what it produces before anything leaves.
Step 3 · A person decides
The run stops and asks the person named in your settings. The decision window is 72 hours; if it lapses, the run carries on without a decision, and the lapse is on the record. Rejecting always takes a comment.
Step 4 · The result
This is what the run hands back, written into the run's record where you can read it.
What you'll fill in
These are the only things the template asks of you. Examples teach the shape — they are never values your flow runs on; what you type (or the stated starting value) is what gets used.
| Field | What to put in it | Example |
|---|---|---|
| Who approves reply drafts | The role or person who approves, edits, or rejects each draft. | Inbox owner |
| How your replies should sound | A line or two on tone the drafts should follow. | Warm, short, plain words |
Set it up
- Fill in the fields below.
- Name the connections it needs — by name only.
- Look at the trigger preview: what would start a run, counted before anything is armed.
- Review the steps, the rules, and every place a person is asked.
- Create it — then run it once yourself, and read the run's record.
Use this template
The definition
The whole mechanism, before you take it. Package checksums: sha256:4600203d87f8… · sha256:61aa2fba9ce3… · sha256:fa82d5b47aa9…. A flow made from this template carries this template's name and version in its record, and exports in the standard bundle with that provenance.
Advanced · the three files, as written
{
"trigger.json": {
"template": {
"slug": "new-message-reply-draft",
"version": 1,
"name": "New message → reply draft",
"category": "inbox-messages",
"outcome": "Each new message is sorted into one of your categories and a reply is drafted in the right tone for that category. You approve, edit, or reject the draft with a comment.",
"outputName": "Reply draft",
"fits_when": [
"email_inbox"
],
"needs": []
},
"trigger": {
"type": "email.message.received",
"source": "gmail",
"manifestFields": {
"messageId": "string!",
"threadId": "string!",
"from": "string!",
"to": "string[]!",
"subject": "string",
"snippet": "string",
"receivedAt": "iso!",
"labelIds": "string[]!",
"hasAttachments": "bool!"
}
},
"inputConvention": "envelope",
"variables": [
{
"name": "approverRole",
"kind": "string",
"label": "Who approves reply drafts",
"instruction": "The role or person who approves, edits, or rejects each draft.",
"example": "Inbox owner",
"default": "Approver"
},
{
"name": "voiceNotes",
"kind": "string",
"label": "How your replies should sound",
"instruction": "A line or two on tone the drafts should follow.",
"example": "Warm, short, plain words",
"default": ""
}
],
"sample": {
"input": {
"messageId": "msg-sample-2",
"threadId": "thr-sample-2",
"from": "reader@sample.example",
"to": [
"you@example.com"
],
"subject": "Question about my order",
"snippet": "Hi — when will my order arrive?",
"receivedAt": "2026-11-04T11:00:00Z",
"labelIds": [
"INBOX"
],
"hasAttachments": false
},
"output": "Sorted as: Question. Reply drafted in your voice. Approved by you. Reply draft ready."
}
},
"flow.json": {
"name": "New message → reply draft",
"inputConvention": "envelope",
"steps": [
{
"type": "ai",
"task": "classify",
"untrustedInput": true,
"classify": {
"categories": [
"Question",
"Request",
"Complaint",
"Praise",
"Other"
]
},
"text": {
"segments": [
{
"text": "Message subject: "
},
{
"field": {
"source": "trigger",
"name": "subject",
"label": "Message · Subject"
}
},
{
"text": ". Message: "
},
{
"field": {
"source": "trigger",
"name": "snippet",
"label": "Message · Snippet"
}
}
]
}
},
{
"type": "ai",
"task": "draft",
"untrustedInput": true,
"text": {
"segments": [
{
"text": "Draft a reply to: "
},
{
"field": {
"source": "trigger",
"name": "snippet",
"label": "Message · Snippet"
}
},
{
"text": ". Voice: "
},
{
"field": {
"source": "variable",
"name": "voiceNotes",
"label": "How your replies should sound"
}
}
]
}
},
{
"type": "human",
"kind": "approval",
"prompt": {
"segments": [
{
"text": "Approve this reply draft? "
},
{
"field": {
"source": "step",
"stepIndex": 1,
"path": [
"draft"
],
"label": "Reply draft · Draft"
}
}
]
},
"due": 259200,
"onExpire": "continue"
},
{
"type": "output",
"value": {
"segments": [
{
"text": "Reply draft ready for message "
},
{
"field": {
"source": "trigger",
"name": "messageId",
"label": "Message · ID"
}
}
]
}
}
]
},
"rules.json": {
"rulesets": [],
"permissions": {
"approvals": {
"approveBeforeSteps": [
2
],
"rejectRequiresComment": true,
"dueSeconds": 259200,
"onExpire": "continue"
},
"connections": {
"required": [],
"optional": []
}
}
}
}