mirror of
https://github.com/warmbly/warmbly.git
synced 2026-11-17 08:18:51 +00:00
feat: use a neutral my-agent source label in the by-thread AI draft upsert docs example
This commit is contained in:
@@ -340,7 +340,7 @@ The same `WRITE_EMAILS` mailbox PATCH accepts `test_mode` (`diagnostic`, `off`,
|
||||
|
||||
The `agent-drafts` endpoints back the [inbox agent](/guides/inbox-agent/): the agent drafts a suggested reply on an inbound human reply and holds it here for review. `GET` lists the pending drafts; `approve` sends one (optionally with an edited `body`) through the normal reply path and is safe to retry with an `Idempotency-Key`; `discard` dismisses it. Approving is the only path that sends. An approval claims the draft in one step and sends the draft as it stood at that moment, so a concurrent `PUT /unibox/ai-drafts/by-thread` either lands before the claim and is what gets sent, or comes after it and leaves the approved draft unchanged. An edited `body` replaces only the text; the recipient, subject and threading are the claimed draft's.
|
||||
|
||||
`PUT /unibox/ai-drafts/by-thread` lets an API key hand in a reply it wrote itself, for the team to review in the same Drafts view. Send `thread_id`, `body` (plain text, up to 8000 characters) and `source` (a short label such as `llcdrop`, up to 40 letters, digits, dots, dashes or underscores, kept as the draft's model). `intent_class` (up to 40 characters) and `confidence` (0 to 1) are optional. The draft answers the newest message on the thread that came from someone else: it replaces the body of the thread's pending draft (and points it at that message if it answered an older one), or creates a pending draft addressed to that sender with the subject `Re: ...`. The response is `{"id", "status": "pending", "created"}`, and repeating the call is safe. It never sends and never changes an approved or discarded draft: `404 thread_not_found` when the workspace has no inbound message on the thread, `409 already_sent` when an approved draft already answers the newest inbound message, and `409 draft_discarded` when a discarded one does. A resolved draft answers the message it was written for, so a reply that arrives later (even one synced after the approval but dated before it) gets a fresh pending draft. A key limited to certain mailboxes can only draft on threads that arrive in them.
|
||||
`PUT /unibox/ai-drafts/by-thread` lets an API key hand in a reply it wrote itself, for the team to review in the same Drafts view. Send `thread_id`, `body` (plain text, up to 8000 characters) and `source` (a short label naming the tool that wrote it, such as `my-agent`, up to 40 letters, digits, dots, dashes or underscores, kept as the draft's model). `intent_class` (up to 40 characters) and `confidence` (0 to 1) are optional. The draft answers the newest message on the thread that came from someone else: it replaces the body of the thread's pending draft (and points it at that message if it answered an older one), or creates a pending draft addressed to that sender with the subject `Re: ...`. The response is `{"id", "status": "pending", "created"}`, and repeating the call is safe. It never sends and never changes an approved or discarded draft: `404 thread_not_found` when the workspace has no inbound message on the thread, `409 already_sent` when an approved draft already answers the newest inbound message, and `409 draft_discarded` when a discarded one does. A resolved draft answers the message it was written for, so a reply that arrives later (even one synced after the approval but dated before it) gets a fresh pending draft. A key limited to certain mailboxes can only draft on threads that arrive in them.
|
||||
|
||||
### Templates and CRM
|
||||
|
||||
|
||||
Reference in New Issue
Block a user