Skip to content

Gmail Thread

Gmail Thread works with Gmail conversations, which Gmail calls threads: the original email and all its replies together. With it you can list the conversations in a label, move a conversation to the trash or take it out again, and delete it.

Use it when the unit of work is the whole conversation and not a single email. To send, read or reply to individual emails, use Gmail Message.

When to use it

  • You want the list of recent conversations in a label to review or count them.
  • After handling an enquiry, you want to move the whole conversation to the trash.
  • An AI agent moved a conversation to the trash by mistake and you want to restore it.
  • You want to permanently delete the conversations of a campaign that has ended.

Configuration

You need a Google Gmail credential, which connects by signing in with your Google account. To move or delete conversations, the credential needs the Create, Update, Delete, Read access. See Credentials.

FieldWhat it does
Credential (required)The Google Gmail credential of the account you work with.
OperationWhat the component does: Get Thread, Trash Thread or Delete Thread. See Operations.
Thread IdThe ID of the conversation. Required in Trash Thread and Delete Thread. Optional in Get Thread: if you fill it in, only that conversation is returned.
LabelsOnly in Get Thread. The label to read conversations from, for example INBOX. The list loads with your account’s labels when you choose the credential.
Select ActionOnly in Trash Thread. Trash moves the conversation to the trash and Untrash takes it out. Default: Trash.

Operations

OperationWhat it does
Get ThreadReturns the most recent conversations in a label, or just one if you give its Thread Id.
Trash ThreadMoves a conversation to the trash or restores it, depending on Select Action.
Delete ThreadDeletes a conversation permanently, without going through the trash.

Advanced options

Only in Get Thread:

FieldWhat it does
QueryFilters conversations with the same search you would use in Gmail, for example from:customer@company.com or subject:quote.
Number of Emails to readHow many conversations to read, starting with the most recent. Default: 10.

Output

The Data output depends on the operation:

  • In Get Thread, one item per conversation, with its ID (id) and a short summary of its content (snippet). Use that ID in Thread Id to trash or delete it.
  • In Trash Thread, the details of the email that starts the conversation after the change.
  • In Delete Thread, a confirmation.

You can connect the result to an AI agent or to another component in the flow. The component can also be connected to an Agent as a tool, so the agent decides when to look up or archive conversations. See Tool Mode.

Example

A support team wants to clean up the conversations in a Resolved label every Friday.

  1. Schedule the flow to run on Fridays. See Scheduler.
  2. Add Gmail Thread with the Get Thread operation and choose Resolved in Labels.
  3. Connect the output to an Agent that has another Gmail Thread with the Trash Thread operation as a tool, and ask it in its instructions to move every conversation in the list to the trash.
  4. Check the Gmail trash the first time to make sure the right conversations were moved.

Good practices

  • Delete Thread cannot be undone and deletes every email in the conversation. If in doubt, use Trash Thread: Gmail keeps the trash for a while and you can restore it with Untrash.
  • In Get Thread, Thread Id only finds the conversation if it is among the ones read with Number of Emails to read, Labels and Query.