So after some battling it out with various approaches ranging from browser, gog, OAuth; I think I have a reliable way of connecting gmail to MoltClaw.
Gmail pub/sub method seems to be the most reliable.
In this screenshot it is going over my email and categorizing it based upon urgency.
βοΈ Next -> Make it reply automatically to low priority emails while it send me a slack notification for high urgency ones.
π₯· I also created a gmail-inbox skill file that stores all of my classification rules that I keep tweaking over time.
πΆββοΈ STEPS I USED TO ACHIEVE THE INTEGRATION
Connect Gmail to MoltClaw / OpenClaw
This guide shows how to connect Gmail to OpenClaw using Google OAuth credentials.
What you need
You need these 3 values from Google:
Client ID
Client Secret
Refresh Token
You will add them to OpenClawβs Gmail integration:
Before you start
Make sure you have:
a Gmail or Google Workspace account
access to Google Cloud Console
access to OAuth Playground
access to your MoltClaw / OpenClaw setup
Useful links:
Step 1: Create a Google Cloud project
Open Google Cloud Console.
Click the project selector at the top.
Click New Project.
Enter a name such as OpenClaw Gmail.
Click Create.
Select the new project.
Step 2: Enable Gmail API
Go to APIs & Services β Library.
Search for Gmail API.
Open it.
Click Enable.
Step 3: Configure the OAuth consent screen
Go to APIs & Services β OAuth consent screen.
Choose External.
Fill in:
App name
User support email
Developer contact email
Save and continue.
If prompted for Test users, add the Gmail address you want to connect.
Step 4: Create OAuth credentials
Go to APIs & Services β Credentials.
Click Create Credentials β OAuth client ID.
Choose Web application.
Enter a name such as OpenClaw Gmail Web App.
Step 5: Add the OAuth Playground redirect URI
Under Authorized redirect URIs, add:
https://developers.google.com/oauthplayground
Then save.
Step 6: Copy Client ID and Client Secret
After saving the OAuth client, copy these values:
Save them somewhere secure.
Step 7: Open OAuth Playground
Open:
https://developers.google.com/oauthplayground/
Step 8: Use your own OAuth credentials
Click the gear icon in the top-right.
Enable Use your own OAuth credentials.
Paste your:
Step 9: Enter the Gmail scope
In the scope field, enter:
https://mail.google.com/
Then click Authorize APIs.
Step 10: Approve access
Sign in with the Gmail account you want to connect.
Review the permission request.
Click Allow.
You will be redirected back to OAuth Playground.
Step 11: Exchange the code for tokens
Click:
OAuth Playground will return:
Access Token
Refresh Token
Step 12: Save the Refresh Token
Save the Refresh Token.
This is the token OpenClaw needs.
You should now have:
Client ID
Client Secret
Refresh Token
Step 13: Add the credentials to OpenClaw
Add the Gmail account under openclaw-gmail.
Example:
{
channels: {
"openclaw-gmail": {
enabled: true,
accounts: {
"[email protected]": {
email: "[email protected]",
oauth: {
clientId: "YOUR_CLIENT_ID",
clientSecret: "YOUR_CLIENT_SECRET",
refreshToken: "YOUR_REFRESH_TOKEN"
}
}
}
}
}
}
The required fields are:
oauth.clientId
oauth.clientSecret
oauth.refreshToken
Step 14: Save and restart if needed
Depending on your setup, you may need to:
save the config
restart the app
reload the service
If you have CLI access, you can check status with:
openclaw status
Step 15: Test the connection
Try a simple Gmail request, such as:
If it works, the setup is complete.
Common mistakes
Wrong redirect URI
If you use OAuth Playground, this must be added:
https://developers.google.com/oauthplayground
Saving the wrong token
Use the Refresh Token, not the Access Token.
Wrong Google account
Authorize the same Gmail account you want OpenClaw to access.
Gmail API not enabled
Make sure Gmail API is enabled in the Google Cloud project.
Missing test user
If the OAuth app is in testing mode, add your Gmail address as a test user.
Copy/paste errors
Make sure there are no extra spaces or missing characters in the credentials.
Wrong Gmail scope
For this setup, the scope used is:
https://mail.google.com/
Do not replace it with a narrower Gmail scope unless your OpenClaw setup specifically expects that.
Quick checklist
Google Cloud
Create project
Enable Gmail API
Configure OAuth consent screen
Create OAuth client
Set type to Web application
Add redirect URI
Copy Client ID and Client Secret
OAuth Playground
Use your own OAuth credentials
Paste Client ID and Client Secret
Add scope:
Authorize
Exchange code for tokens
Save Refresh Token
OpenClaw
Open Gmail config
Add email, clientId, clientSecret, refreshToken
Save
Restart if needed
Test
Summary
To connect Gmail to OpenClaw:
Create a Google OAuth app
Enable Gmail API
Generate a Refresh Token with OAuth Playground using https://mail.google.com/
Add Client ID, Client Secret, and Refresh Token to openclaw-gmail