Overview
Composio provides unified OAuth flows and API access for Gmail, Outlook, Google Drive, Calendar, and 100+ other applications. Website: composio.devWhat is Composio?
Composio simplifies third-party integrations by providing:- Unified OAuth: Single flow for multiple providers
- Token Management: Automatic token refresh
- API Abstraction: Consistent API across different services
- Webhook Handling: Real-time notifications
- Security: Enterprise-grade security and compliance
Services Integrated
Gmail
Email OAuth, sending, reading, searching
Outlook
Microsoft email OAuth and operations
Google Drive
File sync and storage
Google Calendar
Event management and scheduling
Setup
1. Create Composio Account
- Go to composio.dev
- Sign up for an account
- Create a new project
2. Get API Key
From Composio Dashboard → Settings → API Keys:3. Configure OAuth Apps
For each service (Gmail, Outlook, Drive, Calendar):- Go to Composio Dashboard → Integrations
- Select integration (e.g., Gmail)
- Create Auth Config
- Set callback URL:
http://localhost:8000/email_bot/gmail/oauth/callback - Copy Auth Config ID:
OAuth Flow with Composio
Initialization
Callback Handling
Using Composio Tools
Gmail
Outlook
Google Drive
Google Calendar
Entity Management
What is an Entity?
An entity in Composio represents a user in your system:- entity_id: Your user’s UUID
- Connected Accounts: OAuth accounts connected by this entity
- Isolation: Each entity’s tokens are separate
Create Entity
Get Entity
Security
Token Storage
Composio handles token storage securely:- Tokens never exposed to you
- Automatic token refresh
- Encrypted at rest
- Compliance certifications
Best Practices
Use entity-based isolation
Use entity-based isolation
Always pass user_id as entity_id to ensure proper isolation
Store only account IDs
Store only account IDs
Store
connected_account_id, not raw OAuth tokensHandle webhook signatures
Handle webhook signatures
Verify webhook signatures to prevent spoofing
Implement error handling
Implement error handling
OAuth can fail - handle errors gracefully
Environment Variables
Webhooks
Set Up Webhooks
Handle Webhooks
Available Actions
Gmail Actions
GMAIL_GET_PROFILE- Get user profileGMAIL_SEND_EMAIL- Send emailGMAIL_SEARCH_EMAILS- Search emailsGMAIL_GET_EMAIL- Get specific emailGMAIL_CREATE_DRAFT- Create draftGMAIL_DELETE_EMAIL- Delete email
Outlook Actions
OUTLOOK_OUTLOOK_GET_PROFILE- Get user profileOUTLOOK_SEND_EMAIL- Send emailOUTLOOK_LIST_EMAILS- List emailsOUTLOOK_GET_EMAIL- Get specific email
Drive Actions
GOOGLEDRIVE_LIST_FILES- List filesGOOGLEDRIVE_DOWNLOAD_FILE- Download fileGOOGLEDRIVE_UPLOAD_FILE- Upload fileGOOGLEDRIVE_DELETE_FILE- Delete fileGOOGLEDRIVE_SHARE_FILE- Share file
Calendar Actions
GOOGLECALENDAR_LIST_EVENTS- List eventsGOOGLECALENDAR_CREATE_EVENT- Create eventGOOGLECALENDAR_UPDATE_EVENT- Update eventGOOGLECALENDAR_DELETE_EVENT- Delete event
Troubleshooting
OAuth callback not working
OAuth callback not working
Solution:
- Verify callback URL matches exactly in Composio dashboard
- Check API_BASE_URL is set correctly
- Ensure backend is accessible from internet (use ngrok for local dev)
Token refresh failing
Token refresh failing
Solution:
- Check Composio API key is valid
- Verify OAuth scopes include offline_access
- Check account hasn’t been revoked by user
Action execution failing
Action execution failing
Solution:
- Verify entity_id exists and has connected account
- Check action parameters are correct
- Review Composio logs in dashboard
Next Steps
OAuth Setup Guide
Complete OAuth implementation guide
Gmail Integration
Email bot API
Drive Integration
Google Drive setup
Calendar Integration
Calendar integration
