useGmailWrite.ts

deepspace-crm · crm, gmail-write, gmail-api, email-mutation, email

useGmailWrite — Gmail mutation surface for the CRM (gmail.modify scope). Companion to the read-only `useGmail` hook. Wraps the SDK write endpoints added for typical CRM workflows: - google/gmail-send compose / reply (rides gmail.modify) - google/gmail-mark-read / gmail-mark-unr

/**
 * useGmailWrite — Gmail mutation surface for the CRM (gmail.modify scope).
 *
 * Companion to the read-only `useGmail` hook. Wraps the SDK write endpoints
 * added for typical CRM workflows:
 *   - google/gmail-send       compose / reply (rides gmail.modify)
 *   - google/gmail-mark-read  / gmail-mark-unread
 *   - google/gmail-archive
 *   - google/gmail-star       / gmail-unstar  (STARRED label)
 *   - google/gmail-trash
 *   - google/gmail-modify     low-level add/removeLabelIds primitive
 *
 * Every call goes through `withGoogleConsent`, which transparently handles
 * the api-worker's `{ requiresOAuth, authUrl }` recovery shape: it opens the
 * Google consent popup, waits for it to finish, and replays the original
 * request once. The first write a `gmail.readonly` user performs t

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search 40K more like it.

Get a free API key