diff --git a/README.md b/README.md index aa6c2fff..f1595cfc 100644 --- a/README.md +++ b/README.md @@ -160,6 +160,10 @@ Supports basic HTTP authentication and Bearer token authentication via the SDK. [instagram](instagram): Comprehensive Instagram Business/Creator integration for managing posts, comments, and insights via the Instagram Graph API v24.0. Supports account information retrieval, content publishing (images, videos, reels, carousels, stories), comment moderation (read, reply, hide/unhide, delete), and advanced analytics for both account and post performance. Features Business Login for Instagram authentication with granular permissions, media container polling for reliable publishing, and support for alt text on images. Includes 8 actions covering account management, content creation, comment engagement, and insights retrieval. Rate limits scale with account reach (4800 × impressions per 24hrs) with 100 posts per day publishing limit. +### Gmail + +[gmail](gmail): Comprehensive Gmail integration for sending, reading, searching, labelling, and organising email messages, threads, and drafts via the Gmail API v1. Supports plain-text and rich-HTML messages with attachments (HTML sanitised via `bleach` with auto-generated plain-text fallback), thread replies, full draft lifecycle (create/update/list/get/send/delete), label management (list/create/apply/remove/list-by-label), inbox and all-mail listing with read/unread filtering, batch mark-as-read/unread, and archive operations. Pagination supported on every list endpoint via `nextPageToken`. Uses Google platform OAuth 2.0 with the `gmail.modify` scope. Includes 21 actions across messages, threads, drafts, and labels. + ### Google Calendar [google-calendar](google-calendar): Integrates with Google Calendar API for comprehensive calendar and event management within Autohive workflows. Supports listing accessible calendars, creating and managing calendar events (both timed and all-day), attendee management, and event lifecycle operations. Features secure OAuth2 authentication and pagination support for large event datasets. diff --git a/gmail/README.md b/gmail/README.md new file mode 100644 index 00000000..35f29161 --- /dev/null +++ b/gmail/README.md @@ -0,0 +1,152 @@ +# Gmail Integration for Autohive + +Connects Autohive to the Gmail API to send, read, search, label, and organise email messages, threads, and drafts on behalf of an authenticated user. + +## Description + +This integration provides comprehensive Gmail functionality through Google's Gmail API v1. It supports the full email lifecycle — composing and sending plain-text or HTML messages with attachments, reading and replying to threads, managing drafts, applying and removing labels, and archiving messages. + +HTML email bodies are sanitised with [`bleach`](https://github.com/mozilla/bleach) before sending to prevent XSS and to strip disallowed tags/attributes/protocols. A plain-text fallback is generated automatically from the sanitised HTML for maximum email-client compatibility. + +Key features: + +- Send plain-text or rich-HTML email with attachments, CC, and BCC +- Reply to threads with automatic recipient and subject handling +- Draft lifecycle: create, update, list, get, send, delete +- Read inbox / all mail with read/unread filtering and pagination +- Read full threads and individual messages (with body, headers, and attachments) +- Label management: list, create, apply, remove, list-by-label +- Archive and mark as read/unread in batch +- Pagination via `nextPageToken` on all list endpoints + +## Setup & Authentication + +The integration uses Google's platform OAuth 2.0 authentication. Users authenticate through the Google OAuth flow inside Autohive to grant access to their Gmail account. + +**Authentication Type:** Platform (Gmail) + +**Required Scopes:** + +- `https://www.googleapis.com/auth/gmail.modify` — read, compose, send, and permanently delete email is **not** included; the scope allows full mailbox modification (labels, drafts, sending) but excludes permanent deletion of messages. + +No additional configuration fields are required as authentication is handled through Google's OAuth 2.0 flow. + +## Actions + +The integration exposes 21 actions across messages, threads, drafts, and labels. + +### Messages + +| Action | Description | +|---|---| +| `send_email` | Send a new email (text or HTML) with optional CC/BCC and attachments | +| `read_email` | Retrieve a single message by ID, including body, headers, and attachments | +| `read_inbox` | List inbox messages, filtered by read/unread, with pagination | +| `read_all_mail` | List messages across the entire mailbox with read/unread filtering and pagination | +| `mark_emails_as_read` | Mark one or more messages as read | +| `mark_emails_as_unread` | Mark one or more messages as unread | +| `archive_emails` | Remove messages from the inbox (archive) | +| `get_user_info` | Get profile information for the authenticated Gmail user | + +### Threads + +| Action | Description | +|---|---| +| `reply_to_thread` | Reply to an existing thread, with text/HTML body, attachments, and optional additional recipients | +| `get_thread_emails` | Retrieve all messages in a thread | + +### Drafts + +| Action | Description | +|---|---| +| `create_draft` | Create a new draft, optionally as a reply to a thread/message | +| `update_draft` | Update an existing draft | +| `list_drafts` | List drafts with optional Gmail-search-syntax query and pagination | +| `get_draft` | Retrieve a single draft by ID | +| `send_draft` | Send a previously created draft | +| `delete_draft` | Delete a draft | + +### Labels + +| Action | Description | +|---|---| +| `list_labels` | List all labels in the mailbox | +| `create_label` | Create a new user label | +| `add_labels_to_emails` | Apply one or more labels to one or more messages | +| `remove_labels_from_emails` | Remove one or more labels from one or more messages | +| `list_emails_by_label` | List messages with a given label, paginated | + +See [`config.json`](config.json) for the full input/output schema of every action. + +## HTML Email Notes + +When `body_format` is `"html"` on `send_email` / `reply_to_thread` / `create_draft`: + +- The HTML body is sanitised by `bleach` against an allow-list of tags, attributes, and protocols. +- **Do not** include `