Skip to content
B6AIDocs

Connect Gmail to B6AI

Set up the Gmail integration end to end, from creating credentials in Gmail to verifying the live connection and using it in your bots.

8 min readLast updated

Overview

The Gmail integration connects a Gmail or Google Workspace mailbox so bots and workflows can triage inbound email, draft and send replies, and apply labels for routing.

It turns a shared inbox (like support@yourco.com) into an automated first line that classifies, responds to, and organizes email.

What you will need
A Gmail account with administrator access, and a B6AI user with the Enterprise Admin role, integrations are configured once at the workspace level and shared by every bot.

What you can do with Gmail

Once connected, your bots and agents can use Gmail inside conversations and automations. Typical uses include:

  1. Read new inbound emails and classify them (for example by intent or priority).
  2. Send replies on behalf of the connected mailbox.
  3. Apply or remove labels to route messages or mark them handled.
  4. Create drafts for an agent to review before sending.
  5. Extract details from an email (order number, account id) to drive a flow.

How the integration works

You connect with one click, B6AI uses its own Google app, so there is nothing to create in Google Cloud and no Client ID/Secret to copy.

Clicking Connect sends you to Google to sign in to the mailbox and approve the Gmail permissions; Google returns a secure refresh token that B6AI stores encrypted at rest.

B6AI calls the Gmail API on your behalf, limited to exactly the scopes you approved.

Prerequisites

Make sure all of the following are in place before you start. Each one is required, skipping any will cause the connection to fail later.

  1. A Gmail or Google Workspace account for the mailbox you want to connect.
  2. The ability to sign in to that mailbox and approve access.
  3. The Enterprise Admin role in B6AI.

Generate your Gmail connection

B6AI authenticates with Gmail using your Gmail connection. Follow these steps exactly, each field you copy here is entered into B6AI later.

  1. Unlike a manual API setup, Gmail needs no Google Cloud project, OAuth client or Client ID/Secret from you, B6AI provides the Google app.
  2. You only need to be able to sign in to the mailbox you want to connect.
  3. The connection is created during Connect (next section), where you pick the mailbox and approve the Gmail permissions.
Keep secrets safe
Treat every token, key and secret like a password. Never commit them to source control, paste them into chat, or email them. B6AI stores them encrypted at rest, enter them only in the integration settings.

Required permissions & scopes

Grant only the scopes below. Each one maps to a specific B6AI capability; requesting fewer reduces risk and speeds up any review your Gmail administrator performs. The table explains exactly what each scope allows and why it is needed.

Scope / permissionWhat it allowsWhy B6AI needs it
gmail.readonlyRead messages and metadataTriage and classify inbound email
gmail.sendSend email as the mailboxSend replies from a conversation
gmail.modifyModify message labels and stateApply labels and mark messages handled
gmail.labelsCreate and manage labelsSet up the routing labels your flows use
openid, emailIdentify the authorized accountConfirm which mailbox you connected

Connect Gmail in B6AI

Now enter your credentials in B6AI. Signed in as an Enterprise Admin, open Settings → Integrations, find the Gmail card and click Connect, then complete the form. Every field is explained below.

  1. In B6AI, open Settings → Integrations and click Connect on the Gmail card.
  2. Sign in to the Google mailbox and approve the Gmail permissions B6AI requests.
  3. You’re returned to B6AI and the card shows “Connected”, there is nothing to paste.
  4. When building a bot, use the Gmail action nodes to read, label, draft or send mail.
json
{
  "provider": "gmail",
  "mailbox": "support@yourco.com",
  "status": "connected"
}

Verify the connection

Confirm the integration is live before you rely on it in a bot.

  1. Confirm the Gmail card shows “Connected”.
  2. Run the Send test email action to an address you control.
  3. Confirm the email arrives and that any configured label was applied.
Connected
A green “Connected” status plus a successful test confirms Gmail is ready to use in your bots, action nodes and automations.

Troubleshooting

If the connection fails or an action does not work, match the symptom below to its cause and fix.

Symptom / errorLikely causeHow to fix it
“Please reconnect” / invalid_grantThe Google authorization expired or was revokedClick Connect again and re-approve access
access_deniedYou declined a permission during consentReconnect and approve all requested Gmail permissions
403 insufficientPermissionsThe bot uses an action needing a scope you didn’t approveReconnect and approve the full set of Gmail permissions
Wrong mailbox connectedYou signed in with a different Google accountDisconnect, then Connect again and pick the correct mailbox

Limitations & rate limits

Keep these constraints in mind so your bots behave predictably at scale.

  1. Gmail API usage is subject to per-user rate limits and daily quotas.
  2. Sending volume must stay within Gmail/Workspace sending policy.
  3. B6AI accesses only the mailbox you authorized and only the scopes you approved.
Rate limits
Gmail enforces per-user and per-project quotas; sustained high volume is paced by B6AI.

Security best practices

  1. Grant only the scopes and permissions listed above, never request more “just in case”.
  2. Rotate your Gmail connection on a regular schedule, and immediately if you suspect exposure.
  3. Restrict the Enterprise Admin role (which manages integrations) to a small, trusted group.
  4. Prefer a dedicated service account or bot user over a personal login, so access survives staff changes.
  5. Review the integration’s activity in the B6AI Activity Logs periodically for unexpected calls.
  6. Disconnect the integration the moment a credential leaks; then rotate it in Gmail before reconnecting.

Recommendations

  1. Test against a sandbox or non-production Gmail account before connecting live data.
  2. Document which bots and flows depend on this integration so changes are predictable.
  3. Set a recurring reminder to review scopes and rotate credentials.
  4. Enable only the capabilities you actually use today; you can widen scopes later.
Was this page helpful?