Draft Gmail
Save a draft in the connected Gmail mailbox based on a row – a fresh message, a reply, or a forward; nothing is sent – storing the draft’s Gmail id in a new column for later ingredients to use.
Ingredient Family: rowActionsIngredients
Outline Display: Draft Gmail{{mode: in {{mode}} mode}} to {{to}} with subject {{subject}}, storing the draft id in {{columnName}}.
Modes allowed: new{{allowReply:, reply}}{{allowForward:, forward}}{{allowedRecipients:
Allowed recipients: {{allowedRecipients}}}}{{blockedBodyPatterns:
Blocked body patterns: {{blockedBodyPatterns}}}} The content is:
{{body}}
Details
The same modes and the same assembly as the Send Gmail step, saved to the mailbox’s drafts instead of going out, for a person to review, edit, and send or discard. mode picks what is drafted: new (the default) from to/subject/body, reply answering the message named by messageId – the draft carries the original’s threadId and threading headers, so sending it lands in the conversation – or forward carrying that original along as an attachment. Recipient formulas may produce the empty string on a new or forward draft (a draft needs none); whichever addresses they do produce, and a reply’s derived recipients, follow the Send Gmail step’s rules exactly, allowedRecipients included, since a person can send the draft untouched later.
The draft is saved under the Google connection’s authenticated identity, and no From header is written, so the sender is not configurable. Recipient formulas produce comma-separated lists of bare addresses; display-name forms like Dan <dan@x.com> are refused. A recipient or subject containing a line break or other control character fails the step rather than being cleaned up, since it could otherwise inject headers into the assembled message. The body is saved as plain text; there is no HTML variant.
allowReply and allowForward decide which of those modes may run at all: a mode that is off fails the step when the mode formula names it. The scopes asked for follow them – gmail.compose always, gmail.readonly only for reply and forward, which read the original first – so a new-drafts-only configuration carries gmail.compose alone.
On success the new column carries the draft’s own Gmail id (not a message id) – fetch the draft to resolve its underlying message id if a later step needs one. On any failure the step fails the action and nothing later in the pipeline runs.
Local scope
The parent slot binds these (look up the slot in the parent to see how):
$table– The table to act on
Settings
Required
-
Gmail: API connection (API category:Google; scopes:https://www.googleapis.com/auth/gmail.compose,https://www.googleapis.com/auth/gmail.readonly(whenallowReply),https://www.googleapis.com/auth/gmail.readonly(whenallowForward))
The Google connection used to save the Gmail draft (and to read originals for reply and forward)
Set this to thenameof anapi:item whoseprovider:is in theGooglecategory, or which reachesGoogleon another category’s behalf – a brokered api counts when its own settings point it at that service, and its provider page says which setting decides. Do not set it to a service name; pick the API the service points at. -
to: formula (returns text; required, non-nullable)
A formula that generates the recipient addresses, as a comma-separated list of bare addresses; a draft may leave them empty, and a reply then answers the original’s sender
Scope: all columns of$table(reference as[ColumnName], e.g.,[Name],[Price]) -
subject: formula (returns text; required, non-nullable)
A formula that generates the email subject line
Scope: all columns of$table(reference as[ColumnName], e.g.,[Name],[Price]) -
body: formula (returns text; required, non-nullable)
A formula that produces the plain-text email body
Scope: all columns of$table(reference as[ColumnName], e.g.,[Name],[Price]) -
columnName: new column (type: text; required, non-nullable)
The name of the new column holding the draft’s Gmail id (must not shadow other names).
Optional
-
allowReply: constant value (type: bool; required, non-nullable)
Allow thereplymode, which reads the message being answered to thread and address the draft. Off by default, so the step carries only the scopes its enabled modes need; setting it true adds the gmail.readonly grant that read requires, and while it is off a mode formula producingreplyfails the step. -
allowForward: constant value (type: bool; required, non-nullable)
Allow theforwardmode, which reads the original message in raw form to carry it along as an attachment. Off by default; setting it true adds the gmail.readonly grant that read requires, and while it is off a mode formula producingforwardfails the step. -
mode: formula (returns text; required, non-nullable)
A formula choosing what is drafted:new(the default, and what an empty value means) composes a fresh message,replyanswers the message named bymessageIdin its thread,forwardcarries that original along as an attachment. Pin a literal mode or feed one in from a tool parameter.
Scope: all columns of$table(reference as[ColumnName], e.g.,[Name],[Price]) -
cc: formula (returns text; required, non-nullable)
A formula that generates the Cc addresses, comma-separated; leave empty for none
Scope: all columns of$table(reference as[ColumnName], e.g.,[Name],[Price]) -
bcc: formula (returns text; required, non-nullable)
A formula that generates the Bcc addresses, comma-separated; leave empty for none
Scope: all columns of$table(reference as[ColumnName], e.g.,[Name],[Price]) -
messageId: formula (returns text; required, non-nullable)
A formula producing the Gmail id of the original message being replied to or forwarded; required by the reply and forward modes, ignored otherwise
Scope: all columns of$table(reference as[ColumnName], e.g.,[Name],[Price]) -
allowedRecipients: constant value (type: text; optional)
Regex pattern restricting which email addresses may be drafted to (e.g. ‘.*@company.com$’). Checked against every address across to, cc and bcc, a reply’s derived original sender included; a single address that does not match fails the step. Leave blank to allow any recipient. -
blockedBodyPatterns: constant value (type: text; optional)
Regex matched against the drafted subject and body; if it matches, the step fails and nothing is saved. Combine multiple secret/PII patterns with regex alternation.