Skip to main content

Overview

Composio provides unified OAuth flows and API access for Gmail, Outlook, Google Drive, Calendar, and 100+ other applications. Website: composio.dev

What 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

  1. Go to composio.dev
  2. Sign up for an account
  3. 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):
  1. Go to Composio Dashboard → Integrations
  2. Select integration (e.g., Gmail)
  3. Create Auth Config
  4. Set callback URL: http://localhost:8000/email_bot/gmail/oauth/callback
  5. 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

Always pass user_id as entity_id to ensure proper isolation
Store connected_account_id, not raw OAuth tokens
Verify webhook signatures to prevent spoofing
OAuth can fail - handle errors gracefully

Environment Variables

Webhooks

Set Up Webhooks

Handle Webhooks

Available Actions

Gmail Actions

  • GMAIL_GET_PROFILE - Get user profile
  • GMAIL_SEND_EMAIL - Send email
  • GMAIL_SEARCH_EMAILS - Search emails
  • GMAIL_GET_EMAIL - Get specific email
  • GMAIL_CREATE_DRAFT - Create draft
  • GMAIL_DELETE_EMAIL - Delete email

Outlook Actions

  • OUTLOOK_OUTLOOK_GET_PROFILE - Get user profile
  • OUTLOOK_SEND_EMAIL - Send email
  • OUTLOOK_LIST_EMAILS - List emails
  • OUTLOOK_GET_EMAIL - Get specific email

Drive Actions

  • GOOGLEDRIVE_LIST_FILES - List files
  • GOOGLEDRIVE_DOWNLOAD_FILE - Download file
  • GOOGLEDRIVE_UPLOAD_FILE - Upload file
  • GOOGLEDRIVE_DELETE_FILE - Delete file
  • GOOGLEDRIVE_SHARE_FILE - Share file

Calendar Actions

  • GOOGLECALENDAR_LIST_EVENTS - List events
  • GOOGLECALENDAR_CREATE_EVENT - Create event
  • GOOGLECALENDAR_UPDATE_EVENT - Update event
  • GOOGLECALENDAR_DELETE_EVENT - Delete event

Troubleshooting

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)
Solution:
  • Check Composio API key is valid
  • Verify OAuth scopes include offline_access
  • Check account hasn’t been revoked by user
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

Resources