Send an email
well_send_messageSend one email to one or several people (a supplier, a customer, an accountant) from the user's own mailbox (Gmail or Outlook).
Use it when the user asks you to email, write to, or message someone else. To notify the user themselves, use well_send_notification instead.
to: a list of the recipients' email addresses, one entry per address. Use the addresses the user gave, or ones read from Well's records; never guess one. Ask the user when you do not have it. One email goes to all of them: do not call this tool once per recipient.ccandbcc: optional lists of addresses in copy and in blind copy. Fill them only when the user asked for a copy.subjectandbody: write them in the user's language, with what the user asked to say. The body is plain text; line breaks are kept.invoice_id: the id of an issued invoice, only when the user asks you to send that invoice or to chase its customer for it, and you hold its id from Well's records (an invoice you issued or read in this conversation). Well then records the email against the invoice, attaches the invoice's PDF when it is small enough to go as a file, and ends the body with a lasting link to the PDF, which the card shows: never write a link to the invoice in the body yourself, and never say a file is attached unless the result'sattached_filenames it. Leave it out for every other email, and never guess or invent an id. A draft invoice, or an invoice of another workspace, is refused before anything is sent.A sales invoice goes out once, then is chased at most once per lateness band (1 to 30, 31 to 60, 61 to 90, over 90 days late). When the result has code
invoice_already_sent, nothing was sent: follow its message.send_again: set it to true when the user knows the invoice already went out at this step (you told them, or they said so) and asks to send it again anyway, for example to a corrected address or as a copy the customer asked for, or when aninvoice_already_sentresult tells you to. The card then says it sends the invoice again, and the user approves it there; nothing leaves before that. Never set it otherwise.reply_to_note_id: thenote_idof the mail this email answers, read from the user's own email records. The email then goes out as a reply in that mail's thread, from the mailbox that received it. Well writes the subject of a reply itself: that mail's subject with "Re: " in front, which the card shows. Leave it out for a new email, and never guess an id. When the result has codereply_target_not_found, nothing was sent: tell the user, and do not send it as a new email unless they ask.accountant_package: instead of a written email, send the accountant the package of one closed month: its receipts as a ZIP, the reconciliation and the journal, given ascalendar_yearandcalendar_month. Setinclude_feconly when the user asks for the FEC. Never combine it withinvoice_idorreply_to_note_id. When the result has codeaccountant_package_too_large, call again with the same values anddeliveryset to"link".
This call sends nothing. It returns an approval link: give it to the user and say the email goes out only after they open the link in Well, read it and approve it there. Never say the email was sent, and never call this tool again for the same email unless the user asks for a changed one (a changed email needs a new link) or an invoice_already_sent result tells you to.
When the result has code missing_send_scope or gmail_reconnect_required, Well cannot send from the user's mailbox yet: give the user the reconnect link from the message, and call this tool again with the same values once they say they reconnected. With mailbox_send_right_missing, say only that the mailbox cannot send, with no link. Offer an other_space_mailbox by its address, and on a yes call again with sender_mailbox_id set to its mailbox_id. Never send the email another way.
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 | Addresses in copy. | |
| to | Yes | The recipients' email addresses, one entry per address. Empty only with accountant_package, which goes to the address Well remembers. | |
| bcc | No | Addresses in blind copy. | |
| body | Yes | The email body, in plain text. Line breaks are kept. | |
| subject | Yes | The email subject line. | |
| invoice_id | No | The id of the issued invoice this email sends. Omit it when the email is not about an invoice. | |
| send_again | No | True only when the user knows this invoice already went out at this step and asks to send it again anyway. | |
| 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. | |
| bound_delivery | No | Set by Well, never by you: how the accountant package goes. | |
| 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. | |
| send_again_over | No | Set by Well, never by you: the send a send-again card repeats. | |
| 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. | |
| bound_expires_on | No | Set by Well, never by you: the day the package link expires. | |
| reply_to_note_id | No | The note_id of the mail this email answers, from the user's own email records: the email goes out as a reply in that mail's thread. Omit it for a new email. | |
| bound_fingerprint | No | Set by Well, never by you: the digest of the files the package showed. | |
| sender_mailbox_id | No | Only the `mailbox_id` of an `other_space_mailbox` a refusal offered, once the user said yes to sending from it. Omit it otherwise. | |
| accountant_package | No | The calendar month (`calendar_year`, `calendar_month`) of a closed month whose receipts, bank reconciliation and journal the user asks to send to their accountant. Set `include_fec` only when the user asks for the FEC. Well builds the package and attaches it or links it; never describe the attachment or write a link yourself. Omit it for any other email. | |
| bound_receipt_count | No | Set by Well, never by you: the receipt count the package showed. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | No | missing_send_scope or gmail_reconnect_required when the user's mailbox needs reconnecting; mailbox_send_right_missing when its send right is missing and the link was already given; write_target_unreadable, invoice_not_issued or invoice_canceled when invoice_id cannot be used; order_not_billable when invoice_id names a store's sales order, whose customer Well never writes to; invoice_already_sent when the invoice already went out at this step; reply_target_not_found when reply_to_note_id names no mail of the user's own Gmail. | |
| link | No | A link the refusal hands to the user. | |
| error | No | Why no approval link was created, with the reconnect link when the mailbox needs reconnecting. | |
| status | Yes | ||
| success | Yes | ||
| error_code | Yes | ||
| expires_at | Yes | ||
| approval_url | Yes | ||
| 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. | |
| 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. | |
| approval_required | Yes | ||
| resolved_workspace | No | The workspace that answered, when the caller named none and the token authorizes several. | |
| other_space_mailbox | No | A mailbox of another of the user's spaces that can send: name it in sender_mailbox_id on a yes. | |
| conversation_id_note | No | Present only when the server opened a fresh lane, stating that no choice recorded earlier was read. | |
| flow_action_offer_id | Yes | ||
| 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. | |
| reconnect_already_offered | No | True when the reconnect link was already given for this mailbox, so this refusal carries none. |