Skip to content

Gmail Message

Gmail Message connects your flow to your Gmail mailbox to work with individual emails: send a new email (or save it as a draft), read the latest emails in a label, reply to an email, change its labels, mark it as read or unread, and delete it.

It is useful when email is part of a process: notices that go out on their own, customer emails that an AI agent reads and answers, or invoices that arrive by email and need processing.

When to use it

  • You want to send a customer a confirmation email, with a document attached, at the end of a flow.
  • Every morning you want to read the unread emails in your inbox and have an agent summarise them.
  • An AI agent handles email enquiries and needs to reply in the same thread.
  • You want to archive or label a supplier’s emails after processing them.
  • You need to download the attachments of emails that arrive with invoices and extract their text.

Configuration

You need a Google Gmail credential, which connects by signing in with your Google account. To send, reply to, label, mark or delete emails, the credential needs the Create, Update, Delete, Read access; with Read Only you can only read. See Credentials.

FieldWhat it does
Credential (required)The Google Gmail credential of the account you work with.
OperationWhat the component does. See Operations. Default: Send Message.
RecipientOnly in Send Message. The recipient’s email address. Required.
SubjectOnly in Send Message. The email subject. Required.
BodyOnly in Send Message. The email text. Required. If you write it in HTML, the email is sent with formatting.
AttachmentsOnly in Send Message. The files to attach. Connect a component that provides files here, or a link to a file.
Save as draft.Only in Send Message. When on, the email is saved in Drafts instead of being sent.
Email Id.The ID of the email you work with. Required in Reply Message, Update Message Label, Realize Message Marks and Delete Message. Optional in Get Message: if you fill it in, only that email is returned.
Reply TextOnly in Reply Message. The text of the reply. Required.
Number of Emails to readOnly in Get Message. How many emails to read, starting with the most recent. Default: 10.
LabelsIn Get Message, the label to read emails from (for example INBOX for the inbox). In Update Message Label, the labels to add, remove or set. The list loads with your account’s labels when you choose the credential.
Select ActionOnly in Update Message Label. Add adds the chosen labels, Remove removes them and Replace removes every label the email has and sets only the chosen ones. Default: Add.
Select MarkOnly in Realize Message Marks. Read marks the email as read and Unread as unread. Default: Read.

Operations

OperationWhat it does
Send MessageSends a new email, or saves it as a draft if you turn on Save as draft.
Get MessageReads the latest emails in a label, with their text, sender, recipients, subject and date.
Reply MessageReplies to the sender of an email, in the same thread and with the subject prefixed by Re:.
Update Message LabelAdds, removes or replaces the labels of an email.
Realize Message MarksMarks an email as read or unread.
Delete MessageDeletes an email permanently, without going through the trash.

Advanced options

Only in Get Message:

FieldWhat it does
QueryFilters emails with the same search you would use in Gmail, for example from:invoices@supplier.com, is:unread or has:attachment.
Fetch AttachmentsDownloads the attachments of the emails read. Default: off.
Process AttachmentsRequires Fetch Attachments. Extracts the text of attachments, for example from a PDF or a Word document. Default: off.
Enable OCRRequires Fetch Attachments. Reads the text shown in attached images, for example a photo of a receipt. Default: off.

Output

The Data output depends on the operation:

  • In Get Message, one item per email, with the email text, the sender (sender), the recipients (to and cc), the subject (subject), the date in day/month/year format, the ID of the email (id) and of its thread (thread_id), a short summary (snippet), its labels and, if you asked for them, the attachments.
  • In Send Message, the details of the sent email or the draft, with its ID.
  • In Reply Message, Update Message Label and Realize Message Marks, the details of the email after the change.
  • In Delete Message, a confirmation.

You can connect the result to an AI agent so it summarises or answers the emails, or to another component that stores the data, for example in a spreadsheet. The component can also be connected to an Agent as a tool, so the agent decides when to read or send emails. See Tool Mode.

Example

A training school wants to send the timetable to every student who enrols.

  1. The enrolment form reaches the flow with the student’s name and email.
  2. Add Gmail Message with the Send Message operation.
  3. In Recipient put the student’s email, in Subject Your class timetable and in Body a greeting with their name.
  4. Connect the component that provides the timetable PDF to Attachments.
  5. Run the flow with a test enrolment and check that the email arrives.

Good practices

  • The email text returned by Get Message comes from the plain-text version. If an email only has a formatted version, the text may be empty; the short summary (snippet) always comes through.
  • In Get Message, Email Id. only finds the email if it is among the ones read with Number of Emails to read, Labels and Query. If you are looking for an old one, widen the search.
  • Replace in Select Action also removes the INBOX label, so the email leaves the inbox. Use Add or Remove if you only want to change one label.
  • Delete Message cannot be undone. If you prefer to be able to recover the email, use the Trash Thread operation of Gmail Thread.