Skip to main content

Gmail integration

Send, read, label, and archive Gmail messages on behalf of your clients.

View the Gmail page

What it does

The Gmail integration lets you move email work into TaskJuice without juggling a client's inbox by hand. Connect a client's Google account once and you can list and read messages with a Gmail search query, send brand-new emails, reply inside an existing thread, create drafts for review, send approved drafts, file and archive mail with labels, create and list labels, move a message to the trash, and start a workflow whenever a new message lands in a watched mailbox.

Connect a Gmail account

  1. Open your workspace in TaskJuice and navigate to Connections.
  2. Choose Gmail and click Connect.
  3. Sign in with the Google account whose mailbox you want to manage on behalf of your client.
  4. Grant the requested scopes (read and modify access to Gmail, plus the send scope for outgoing messages).
  5. TaskJuice returns you to the workspace with the connection ready to use in any workflow.

To revoke access at any time, visit Google Account permissions and remove the TaskJuice entry.

Triggers

  • gmail/new-message polls the connected mailbox on a configurable interval and emits one activation per cycle containing every message that matches the configured label filters and optional Gmail search query. Drop a Loop node downstream to process each message individually, or feed the array straight into a digest.

    By default the trigger watches the INBOX label, so mail the connected account sends does not count as a new message. Clear the Label IDs field only if you want every mailbox change — including your own sent mail — to start a run.

Actions

  • gmail/list-messages returns the message IDs in the mailbox that match an optional Gmail search query, label filter, and spam or trash inclusion flag, with cursor pagination.
  • gmail/get-message returns a single message by ID in the chosen format (minimal, full, raw, or metadata).
  • gmail/send-email sends a new email message with To, CC, BCC, subject, and HTML body fields.
  • gmail/reply-to-message sends a reply that keeps the response inside the original conversation thread.
  • gmail/create-draft creates a draft email under the connected account for later review or sending.
  • gmail/send-draft sends an existing draft by its draft ID.
  • gmail/delete-message moves a message to the trash. Gmail keeps trashed mail for about 30 days before it deletes it for good, so you can restore it until then.
  • gmail/modify-message-labels adds and removes labels on one message in a single step.
  • gmail/modify-thread-labels adds and removes labels on every message in a conversation in a single step.
  • gmail/archive-email archives a conversation, like Gmail's Archive button.
  • gmail/create-label creates a label and returns its ID. It fails with a clear message if a label with that name already exists.
  • gmail/list-labels returns every label in the mailbox with its ID, system labels such as INBOX and UNREAD included.

Labels, folders, and archiving

Gmail has no folders. A "folder" is a label, and the Inbox is the INBOX label. The label steps cover the common inbox jobs:

  • Move a message to a folder: in Modify Message Labels, put the folder's label in Labels to add and INBOX in Labels to remove. Both changes happen in one step.
  • Mark as read: remove UNREAD. To star a message, add STARRED.
  • Archive: Archive Email takes a Thread ID and archives the whole conversation, which is what Gmail's Archive button does. To archive a single message instead, use Modify Message Labels and remove INBOX.

Message or conversation? In Gmail's conversation view, a conversation shows a label while any one of its messages has it. If you remove a label from only the newest message, the conversation still shows it because an older message still has it. Use Modify Thread Labels to change what a whole conversation shows. A thread change applies to the messages already in the conversation. Messages that arrive later do not inherit it.

The Labels to add and Labels to remove pickers list every label in the mailbox. You can add or remove INBOX, UNREAD, STARRED, IMPORTANT, SPAM, TRASH, and the CATEGORY_ labels. Gmail does not let you add SENT or DRAFT, and a step that tries fails with Gmail's own error message.

The lists hold label IDs, not names. A system label's ID is its name (INBOX), while a label you created has an ID like Label_12. To use a label ID from an earlier step, switch the field to { } and wrap the ID in a list, for example [$steps.create_label.data.id]. Without the brackets the step fails before it reaches Gmail, because the field expects a list.

Find a label or create it

Create Label fails if the label already exists, so a workflow that labels mail by a name it works out (one label per client, for example) looks the label up first:

  1. Add List Labels.
  2. Add a Branch with one condition: Field $steps.list_labels.data.labels[name = "Clients/Acme"], Operator Exists. Give the Branch a default path for when no label has that name.
  3. On the condition's path (the label exists), add Modify Message Labels with Labels to add set to [$steps.list_labels.data.labels[name = "Clients/Acme"].id].
  4. On the default path (no label has that name yet), add Create Label with the name Clients/Acme, then Modify Message Labels with Labels to add set to [$steps.create_label.data.id].

Each path has its own Modify Message Labels step, so each step only reads from steps that ran on its path.

Known limitations

  • Gmail does not publish a webhook that fires on every incoming message in the declarative envelope. The new-message trigger polls on a configurable interval (60 seconds minimum, five minutes by default), so latency is bounded by the chosen interval rather than instant.
  • The Gmail API enforces per-user and per-project quotas measured in quota units. When a 429 is returned, TaskJuice surfaces it as a retryable rate-limit error and respects the recommended backoff.
  • Sending a message requires the gmail.send scope and is subject to Google's daily sending limits for the connected account type.
  • Sending from the same connection the new-message trigger watches puts the workflow's own output back in the watched mailbox. The INBOX default keeps sent mail out of the trigger, but if you widen the label filter or write a search query that matches your own sent mail, the workflow can start itself. TaskJuice warns you at publish time when a trigger and an action that writes share one connection.
Was this helpful?