Send an email draft
well_send_email_draftSave the final text of an email draft into the user's own Gmail drafts, or hand it to the user's own email app. Well sends nothing itself. The card that well_draft_email shows calls this when the user presses Send.
Do not call it yourself to send on the user's behalf. Draw the card with well_draft_email and let the user press Send.
REQUIRED: to (at least one address), subject and body_lines (the paragraphs), all exactly as the user last saw them. attachment_ids are document_ids of this workspace. Pass the card's draft_id unchanged: it keys the durable write, so a second press of the same card replays the first result and never creates a second draft.
Returns status: "draft_created" (with mailbox_address and gmail_drafts_url) when a Gmail draft now waits in the member's mailbox, "draft_queued" when the write is still owed, or "mailto" with a mailto_url — and a fallback_reason when the Gmail path declined. Every status carries mailto_url: on draft_queued the card keeps it as the way out, and a call after the owed write gave up answers mailto with the reason, so the member always keeps a way to send. sent is false on every one of them: the member sends the draft, never Well. The attached documents travel as the download links the body already carries, which do not expire while the document exists. Well sent nothing, so never tell the user the email was sent. A failure carries an error_reason; nothing was sent.
When the token authorizes one workspace, call this directly — no workspace call is needed first. When it authorizes several, this read will not guess which one you mean: pass workspace_id on the call.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cc | No | ||
| to | Yes | ||
| bcc | No | ||
| subject | Yes | ||
| draft_id | No | The `draft_id` the card showed. With it, one Gmail draft is created in the member's connected mailbox; without it (an older card) the draft opens as a `mailto:` link. | |
| body_lines | Yes | The message's paragraphs, in order. | |
| workspace_id | No | Target workspace. Omit when the token authorizes one workspace. Required when it authorizes several — a write lands in exactly one workspace and this call would not say which. | |
| attachment_ids | No | `document_id`s of this workspace to attach. | |
| transaction_id | No | The `transaction_id` the card showed for a receipt request. The card echoes it unchanged. | |
| conversation_id | No | The conversation id returned by the previous Well result, in its meta under well/conversation_id, in its structuredContent, or in its JSON text block. Pass it back on every call in the same conversation, including a call a card makes, so the chosen workspace and the earlier answers still apply. It decides the conversation on its own: nothing the host states about the session replaces it. Omit it only on the first call of a conversation. | |
| idempotency_key | No | Optional client-supplied key. A retried write with the same key returns the original result instead of re-applying the operation. | |
| workspace_scope | No | Restrict this call to the family: the token's primary workspace plus the company workspaces under it that you are a member of. Unrelated authorized workspaces drop out of the read; row reads merge across the family, while a per-workspace figure still reports exactly one workspace. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sent | No | ||
| error | No | ||
| status | No | ||
| success | Yes | ||
| mailto_url | No | ||
| error_reason | No | ||
| reconnect_url | No | ||
| conversation_id | No | The conversation this result belongs to. Pass it back as the conversation_id argument on every later Well call in the same conversation. | |
| fallback_reason | No | ||
| mailbox_address | No | ||
| newly_connected | No | Tools that connected to this workspace since the last result and that no session was told about yet, oldest first. Present only when at least one tool is new. The connected-line rule says when to tell an entry; when it does, one line per entry, in the person's language: "<name> is connected.". Never fold several entries into one sentence. Each entry comes back once, on one result only: never repeat its line later. | |
| gmail_drafts_url | No | ||
| resolved_workspace | No | The workspace that answered, when the caller named none and the token authorizes several. | |
| connected_mailboxes | No | ||
| conversation_id_note | No | Present only when the server opened a fresh lane, stating that no choice recorded earlier was read. | |
| conversation_id_source | No | Where the conversation id came from: the host's own request meta, the caller's argument, or a fresh lane the server opened. |