Use this setup when a local agent starter needs to call the Gmail API directly from your machine. For the Customer Email Assist starter, this is the path that lets the dashboard send an approved reply automatically after the undo countdown. If you only use the Codex Gmail connector, you can skip this setup.Documentation Index
Fetch the complete documentation index at: https://labs.prompthon.io/llms.txt
Use this file to discover all available pages before exploring further.
What You Will Create
| Value | Where it comes from | Used for |
|---|---|---|
GOOGLE_CLIENT_ID | Google Cloud OAuth client | Identifies your local app to Google. |
GOOGLE_CLIENT_SECRET | Google Cloud OAuth client | Authenticates the OAuth client. |
| Gmail refresh token | Dashboard Connect Gmail flow | Stored locally by the app after Google redirects back to localhost. |
CUSTOMER_EMAIL_ASSIST_OPERATOR_EMAIL | Gmail profile or optional env var | Helps detect human outbound replies and avoid duplicate sends. |
CUSTOMER_EMAIL_ASSIST_GMAIL_LABEL | Gmail label ID such as INBOX | Controls which mailbox label the local sync reads. |
GOOGLE_REFRESH_TOKEN, CUSTOMER_EMAIL_ASSIST_DB_PATH, and
CUSTOMER_EMAIL_ASSIST_POLICY_PATH are optional. The dashboard stores the
refresh token locally, and the starter has defaults for the DB and policy paths.
Step 1: Open Or Create A Google Cloud Project
- Open Google Cloud Console.
- Sign in with the Google account that owns the Gmail mailbox.
- In the top bar, click the project selector.
- Click New Project.
- Name it something explicit, such as
Customer Email Assist Local. - Click Create.
- Use the project selector again and select the new project.
Step 2: Enable Gmail API
- In the left navigation, open APIs & Services.
- Click Library.
- Search for
Gmail API. - Open Gmail API.
- Click Enable.
Step 3: Configure The OAuth Consent Screen
Google has been moving this UI into Google Auth Platform. Older projects may still show APIs & Services > OAuth consent screen. The same settings exist in both layouts.- In the left navigation, open Google Auth Platform. If your Console still uses the older layout, open APIs & Services > OAuth consent screen.
- If this is a new project, click Get started.
- Set the app name to something local and clear, such as
Customer Email Assist Local. - Set User support email to your Gmail address.
- Set Audience:
- Choose External for a personal Gmail account.
- Choose Internal only for a Google Workspace app used inside that organization.
- Add your email under Contact information or Developer contact information.
- Keep publishing status as Testing while developing.
- Save the app information.
Step 4: Add Yourself As A Test User
- Open Google Auth Platform > Audience. In the older layout, open APIs & Services > OAuth consent screen.
- Find Test users.
- Click Add users.
- Enter the Gmail address that will authorize mailbox access.
- Click Save.
Step 5: Add Gmail Scopes
- Open Google Auth Platform > Data Access. In the older layout, open the consent screen’s Scopes step.
- Click Add or remove scopes.
- Search for Gmail.
- Select or manually add:
gmail.send when the local dashboard needs to send approved replies.
Use gmail.readonly when local scripts need to import Gmail threads. If your
flow only sends and never imports through local OAuth, gmail.send is the
minimum scope.
Step 6: Create The OAuth Client
- Open APIs & Services > Credentials.
- Click Create Credentials.
- Select OAuth client ID.
- For Application type, choose Web application.
- Name it
Customer Email Assist Local Web. - Under Authorized redirect URIs, click Add URI.
- Enter the callback URI for the port where your dashboard runs:
- Click Create.
- Copy the client ID and client secret into
.env.local.
.env.local, not in the repository.
Step 7: Create .env.local
In the starter directory, create:
.env.local.
Step 8: Connect Gmail From The Dashboard
- Start the dashboard.
- Leave Gmail mode set to OAuth.
- Click Connect Gmail.
- Sign in as the same test user you configured in Google Cloud.
- Approve the Gmail scopes.
- Google redirects back to
/api/gmail/oauth/callback. - The app stores the refresh token locally under:
Step 9: Use The Dashboard Mode Switch
In the Customer Email Assist dashboard:- Select OAuth to use local OAuth. This attempts the direct Gmail API send path after the undo countdown.
- Select Gmail connector to queue approved replies for connector-backed processing instead.
