message/markAsRead
Remove the UNREAD label from a Gmail message, marking it as read programmatically.
When to Use
- Post-processing acknowledgment: After a workflow has fully processed an email (created a ticket, extracted data, sent a reply), mark it as read to prevent re-processing by a subsequent unread-filter workflow.
- Bulk digest auto-read: Automatically mark newsletter or digest emails as read after the relevant content has been extracted and routed to a summary document.
- SLA timestamp tracking: Mark an email as read at the exact moment the workflow acknowledges receipt, creating an accurate read timestamp for SLA measurement.
- Inbox management after label routing: Once an email has been labeled and forwarded to the right team queue, mark it as read to clean up the main inbox unread count.
- Automated monitoring confirmation: In monitoring workflows that poll a dedicated alert inbox, mark alerts as read after they have been forwarded to the alerting system.
Configuration
Connection
| Field | Type | Description |
credentialId | Guid required | OAuth2 credential ID from BizFirst Credentials Manager. Requires gmail.modify scope. |
Operation Fields
| Field | Type | Default | Description |
messageId | string required | — | Gmail message ID to mark as read. Removes the system UNREAD label. |
Sample Configuration
{
"nodeType": "Gmail",
"operation": "message/markAsRead",
"credentialId": "a3f9d12b-44e1-4c89-b7d2-9f0a1e2b3c4d",
"messageId": "{{processedEmail.messageId}}"
}
Validation Errors
| Error | Cause | Resolution |
MISSING_FIELD: messageId | messageId is empty | Ensure upstream node provides a valid message ID |
MESSAGE_NOT_FOUND | Message does not exist in the account | Verify message ID comes from the authenticated account |
INVALID_CREDENTIAL | OAuth token expired or credential not found | Re-authenticate in BizFirst Credentials Manager |
PERMISSION_DENIED | Credential lacks gmail.modify scope | Re-grant OAuth permissions with the correct scope |
Output
Success Port
| Field | Type | Description |
success | bool | true when the UNREAD label was removed |
status | string | success |
errorCode | string | Empty on success |
Error Port
On failure, routes to the error port with status: "error", errorCode, and errorMessage.
Sample Output
{
"success": true,
"status": "success",
"errorCode": ""
}
Expression Reference
| Expression | Resolves To | Example Use |
{{processedEmail.messageId}} | Message ID from upstream processing node | messageId field |
{{imapTrigger.messageId}} | Message ID from IMAP trigger | Mark as read after workflow acknowledgment |
{{loop.current.messageId}} | Current message in a batch Loop | Batch mark-as-read operation |
Node Policies & GuardRails
| Policy | Rule |
| Idempotency | Calling markAsRead on an already-read message is safe — it is a no-op with a success response |
| Credential Storage | Store OAuth credentials in BizFirst Credentials Manager — never hardcode tokens in workflow configuration |
| Processing Gate | Always mark as read AFTER all processing steps complete — not before — to prevent race conditions with other unread-filter workflows |
| Quota Management | markAsRead (modify) costs minimal quota units — safe for high-frequency and batch workflows |
| PII Protection | Do not log message IDs in combination with personal data in workflow execution history |
| Test Isolation | Test mark-as-read workflows against a dedicated Gmail test account to avoid affecting production inbox state |
Examples
Example 1: Mark Read After Ticket Creation
After an IMAP trigger fires, the workflow creates a support ticket and then marks the source email as read.
{
"nodeType": "Gmail",
"operation": "message/markAsRead",
"credentialId": "a3f9d12b-44e1-4c89-b7d2-9f0a1e2b3c4d",
"messageId": "{{imapTrigger.messageId}}"
}
Example 2: Batch Mark Digest Emails as Read
After extracting content from newsletter digest emails, mark them all as read in a Loop node.
{
"nodeType": "Gmail",
"operation": "message/markAsRead",
"credentialId": "a3f9d12b-44e1-4c89-b7d2-9f0a1e2b3c4d",
"messageId": "{{loop.current.messageId}}"
}
Example 3: SLA Read Timestamp
Mark email as read immediately when the support workflow acknowledges receipt, capturing SLA start time.
{
"nodeType": "Gmail",
"operation": "message/markAsRead",
"credentialId": "a3f9d12b-44e1-4c89-b7d2-9f0a1e2b3c4d",
"messageId": "{{supportTriage.messageId}}"
}