Gmail connector setup

Operator·3 minutes to read

This page is the setup half — creating the OAuth app Gmail needs in Google's own console and getting its client id and secret into this deployment. Authorising a connection afterwards is the Authenticate control on the plugin sheet, which is what actually sends you to Google.

1. Create the OAuth app in Google Cloud

  1. Open the Google Cloud console and create a project (or pick an existing one) — this is your own project, not Botseon's.

  2. APIs & Services → Library: enable the Gmail API.

  3. APIs & Services → OAuth consent screen: choose External (unless your Google Workspace restricts it to internal), fill in an app name and your own e-mail as the support and developer contact. Publishing status can stay Testing for personal use — Google shows an "unverified app" screen for a testing app, which you will see and click through once; that screen, not a shared secret, is the actual cost of bringing your own app.

  4. APIs & Services → Credentials → Create Credentials → OAuth client ID, application type Web application.

  5. Under Authorized redirect URIs, add the redirect URL from docs/connectors/README.md — with the quickstart's default BOTSEON_PUBLIC_URL, that is:

    http://127.0.0.1:3000/api/oauth/gmail/callback
    
  6. Create it. Google shows you a client ID and a client secret once — copy both now.

2. Scopes

Request the narrowest set that covers triage-and-draft use (F-PLUG-1: minimum scopes per capability, read and write requested separately):

  • https://www.googleapis.com/auth/gmail.readonly — read messages and threads; no writes.
  • https://www.googleapis.com/auth/gmail.modify — read, label, archive and draft. Covers "draft a reply for approval" without granting delete or mailbox-settings access.
  • https://www.googleapis.com/auth/gmail.send — send a message the member approved.

The connector module's own manifest is what actually requests scopes at authorisation time (its oauth.scopes field — see docs/reference/module-manifest.md); these are the three to have configured and ready on the OAuth consent screen above.

3. Enter the app

One command, with the client secret on standard input — there is no flag that takes it and no environment variable that holds it (see docs/connectors/README.md):

printf %s "$CLIENT_SECRET" | botseon oauth-app set \
  --org <organisation id> --slug gmail \
  --client-id <the client ID from step 1> \
  --auth-url https://accounts.google.com/o/oauth2/v2/auth \
  --token-url https://oauth2.googleapis.com/token \
  --revoke-url https://oauth2.googleapis.com/revoke \
  --configured-by <your user id>

It stores the secret encrypted and prints the redirect URL from step 1 back, so you can check the two match. botseon oauth-app show --org <organisation id> --slug gmail says whether an app is configured and under which client id; nothing prints the secret back.

Never put either value in a bot's description, a memory, or anywhere else a model reads as ordinary text.

Last verified against build c0f77aa.