Skip to content

integrations/email/gmail/dist

Classes

ProviderApiError

Extends

  • Error

Constructors

Constructor
new ProviderApiError(input): ProviderApiError;
Parameters
Parameter Type
input ProviderApiErrorInput
Returns

ProviderApiError

Overrides
Error.constructor

Properties

body
readonly body: unknown;
code?
readonly optional code?: string | number;
provider
readonly provider: string;
response
readonly response: ProviderApiErrorResponseMetadata;
retryAfter?
readonly optional retryAfter?: string;
status
readonly status: number;

Interfaces

GmailArchiveThreadInput

Extends

Properties

removeLabelIds?
optional removeLabelIds?: string[];
signal?
optional signal?: AbortSignal;
Inherited from

GmailProviderRequestOptions.signal

threadId
threadId: string;

GmailCreateDraftInput

Extends

Properties

bcc?
optional bcc?: string[];
Inherited from

GmailRawMessageInput.bcc

cc?
optional cc?: string[];
Inherited from

GmailRawMessageInput.cc

from?
optional from?: string;
Inherited from

GmailRawMessageInput.from

inReplyTo?
optional inReplyTo?: string;
Inherited from

GmailRawMessageInput.inReplyTo

messageId?
optional messageId?: string;
Inherited from

GmailRawMessageInput.messageId

raw?
optional raw?: string;
Inherited from
GmailComposedMessageInput.raw
references?
optional references?: string[];
Inherited from

GmailRawMessageInput.references

replyTo?
optional replyTo?: string;
Inherited from

GmailRawMessageInput.replyTo

signal?
optional signal?: AbortSignal;
Inherited from
GmailComposedMessageInput.signal
subject?
optional subject?: string;
Inherited from

GmailRawMessageInput.subject

text?
optional text?: string;
Inherited from

GmailRawMessageInput.text

threadId?
optional threadId?: string;
to?
optional to?: string[];
Inherited from

GmailRawMessageInput.to


GmailCredentialStatusInput

Properties

accessToken?
optional accessToken?: string;
auth?
optional auth?: GmailOfficialAuthClient;
expiresAt?
optional expiresAt?: string;
scopes?
optional scopes?: string[];

GmailEmailAttachment

Properties

attachmentId?
optional attachmentId?: string;
filename?
optional filename?: string;
mimeType?
optional mimeType?: string;
partId?
optional partId?: string;
size?
optional size?: number;

GmailEmailClient

Properties

handlers
handlers: GmailEmailOperationHandlers;
rawClient
rawClient: Gmail;
userId
userId: string;

Methods

archiveThread()
archiveThread(input): Promise<GmailEmailThread>;
Parameters
Parameter Type
input GmailArchiveThreadInput
Returns

Promise\<GmailEmailThread>

createDraft()
createDraft(input): Promise<GmailEmailDraft>;
Parameters
Parameter Type
input GmailCreateDraftInput
Returns

Promise\<GmailEmailDraft>

execute()
execute<K>(alias, input): Promise<GmailEmailOperationOutputMap[K]>;
Type Parameters
Type Parameter
K extends | "email.receive" | "email.thread.read" | "email.reply.send" | "email.send" | "email.draft.create" | "email.draft.send" | "email.archive" | "mailbox.watch" | "gmail.history.list" | "gmail.attachment.get" | "gmail.labels.list"
Parameters
Parameter Type
alias K
input GmailEmailOperationInputMap[K]
Returns

Promise\<GmailEmailOperationOutputMap[K]>

getAttachment()
getAttachment(input): Promise<Schema$MessagePartBody>;
Parameters
Parameter Type
input GmailGetAttachmentInput
Returns

Promise\<Schema$MessagePartBody>

getProfile()
getProfile(input?): Promise<Schema$Profile>;
Parameters
Parameter Type
input? GmailProviderRequestOptions
Returns

Promise\<Schema$Profile>

listHistory()
listHistory(input): Promise<Schema$ListHistoryResponse>;
Parameters
Parameter Type
input GmailListHistoryInput
Returns

Promise\<Schema$ListHistoryResponse>

listLabels()
listLabels(input?): Promise<Schema$ListLabelsResponse>;
Parameters
Parameter Type
input? GmailProviderRequestOptions
Returns

Promise\<Schema$ListLabelsResponse>

readThread()
readThread(input): Promise<GmailEmailThread>;
Parameters
Parameter Type
input GmailReadThreadInput
Returns

Promise\<GmailEmailThread>

sendDraft()
sendDraft(input): Promise<GmailEmailMessage>;
Parameters
Parameter Type
input GmailSendDraftInput
Returns

Promise\<GmailEmailMessage>

sendEmail()
sendEmail(input): Promise<GmailEmailMessage>;
Parameters
Parameter Type
input GmailSendEmailInput
Returns

Promise\<GmailEmailMessage>

sendReply()
sendReply(input): Promise<GmailEmailMessage>;
Parameters
Parameter Type
input GmailReplySendInput
Returns

Promise\<GmailEmailMessage>

watchMailbox()
watchMailbox(input): Promise<Schema$WatchResponse>;
Parameters
Parameter Type
input GmailWatchInput
Returns

Promise\<Schema$WatchResponse>


GmailEmailClientOptions

Extends

Properties

accessToken?
optional accessToken?: string;
auth?
optional auth?: GmailOfficialAuthClient;
rawClient?
optional rawClient?: Gmail;
rootUrl?
optional rootUrl?: string;
signal?
optional signal?: AbortSignal;
Inherited from

GmailProviderRequestOptions.signal

userId?
optional userId?: string;

GmailEmailDraft

Properties

id?
optional id?: string;
message?
optional message?: GmailEmailMessage;
provider
provider: "gmail";
raw
raw: Schema$Draft;

GmailEmailMessage

Properties

attachments
attachments: GmailEmailAttachment[];
bcc?
optional bcc?: string[];
cc?
optional cc?: string[];
from?
optional from?: string;
headers
headers: Record<string, string[]>;
historyId?
optional historyId?: string;
id?
optional id?: string;
inReplyTo?
optional inReplyTo?: string;
internalDate?
optional internalDate?: string;
labelIds
labelIds: string[];
messageId?
optional messageId?: string;
provider
provider: "gmail";
raw
raw: Schema$Message;
references?
optional references?: string[];
replyTo?
optional replyTo?: string;
snippet?
optional snippet?: string;
subject?
optional subject?: string;
threadId?
optional threadId?: string;
to?
optional to?: string[];

GmailEmailOperationInputMap

Properties

email.archive
email.archive: GmailArchiveThreadInput;
email.draft.create
email.draft.create: GmailCreateDraftInput;
email.draft.send
email.draft.send: GmailSendDraftInput;
email.receive
email.receive:
  | Request
  | GmailPubSubNotificationEnvelope;
email.reply.send
email.reply.send: GmailReplySendInput;
email.send
email.send: GmailSendEmailInput;
email.thread.read
email.thread.read: GmailReadThreadInput;
gmail.attachment.get
gmail.attachment.get: GmailGetAttachmentInput;
gmail.history.list
gmail.history.list: GmailListHistoryInput;
gmail.labels.list
gmail.labels.list: GmailProviderRequestOptions;
mailbox.watch
mailbox.watch: GmailWatchInput;

GmailEmailOperationOutputMap

Properties

email.archive
email.archive: GmailEmailThread;
email.draft.create
email.draft.create: GmailEmailDraft;
email.draft.send
email.draft.send: GmailEmailMessage;
email.receive
email.receive: GmailPubSubNotification;
email.reply.send
email.reply.send: GmailEmailMessage;
email.send
email.send: GmailEmailMessage;
email.thread.read
email.thread.read: GmailEmailThread;
gmail.attachment.get
gmail.attachment.get: Schema$MessagePartBody;
gmail.history.list
gmail.history.list: Schema$ListHistoryResponse;
gmail.labels.list
gmail.labels.list: Schema$ListLabelsResponse;
mailbox.watch
mailbox.watch: Schema$WatchResponse;

GmailEmailThread

Properties

historyId?
optional historyId?: string;
id?
optional id?: string;
messages
messages: GmailEmailMessage[];
provider
provider: "gmail";
raw
raw: Schema$Thread;

GmailGetAttachmentInput

Extends

Properties

attachmentId
attachmentId: string;
messageId
messageId: string;
signal?
optional signal?: AbortSignal;
Inherited from

GmailProviderRequestOptions.signal


GmailJsonObject

Indexable

[key: string]: GmailJsonValue

GmailListHistoryInput

Extends

Properties

historyTypes?
optional historyTypes?: GmailHistoryType[];
labelId?
optional labelId?: string;
maxResults?
optional maxResults?: number;
pageToken?
optional pageToken?: string;
signal?
optional signal?: AbortSignal;
Inherited from

GmailProviderRequestOptions.signal

startHistoryId
startHistoryId: string;

GmailProviderRequestOptions

Extended by

Properties

signal?
optional signal?: AbortSignal;

GmailPubSubNotification

Properties

attributes?
optional attributes?: Record<string, string>;
emailAddress
emailAddress: string;
historyId
historyId: string;
messageId?
optional messageId?: string;
publishTime?
optional publishTime?: string;
rawPayload
rawPayload: GmailJsonObject;
subscription?
optional subscription?: string;

GmailPubSubNotificationEnvelope

Properties

message?
optional message?: {
  attributes?: Record<string, string>;
  data?: string;
  message_id?: string;
  messageId?: string;
  publish_time?: string;
  publishTime?: string;
};
attributes?
optional attributes?: Record<string, string>;
data?
optional data?: string;
message_id?
optional message_id?: string;
messageId?
optional messageId?: string;
publish_time?
optional publish_time?: string;
publishTime?
optional publishTime?: string;
subscription?
optional subscription?: string;

GmailRawMessageInput

Properties

bcc?
optional bcc?: string[];
cc?
optional cc?: string[];
from
from: string;
inReplyTo?
optional inReplyTo?: string;
messageId?
optional messageId?: string;
references?
optional references?: string[];
replyTo?
optional replyTo?: string;
subject
subject: string;
text
text: string;
to
to: string[];

GmailReadThreadInput

Extends

Properties

format?
optional format?: "metadata" | "full" | "raw" | "minimal";
metadataHeaders?
optional metadataHeaders?: string[];
signal?
optional signal?: AbortSignal;
Inherited from

GmailProviderRequestOptions.signal

threadId
threadId: string;

GmailReplySendInput

Extends

Properties

bcc?
optional bcc?: string[];
Inherited from

GmailRawMessageInput.bcc

cc?
optional cc?: string[];
Inherited from

GmailRawMessageInput.cc

from?
optional from?: string;
Inherited from

GmailRawMessageInput.from

inReplyTo?
optional inReplyTo?: string;
Inherited from

GmailRawMessageInput.inReplyTo

messageId?
optional messageId?: string;
Inherited from

GmailRawMessageInput.messageId

raw?
optional raw?: string;
Inherited from
GmailComposedMessageInput.raw
references?
optional references?: string[];
Inherited from

GmailRawMessageInput.references

replyTo?
optional replyTo?: string;
Inherited from

GmailRawMessageInput.replyTo

signal?
optional signal?: AbortSignal;
Inherited from
GmailComposedMessageInput.signal
subject?
optional subject?: string;
Inherited from

GmailRawMessageInput.subject

text?
optional text?: string;
Inherited from

GmailRawMessageInput.text

threadId
threadId: string;
to?
optional to?: string[];
Inherited from

GmailRawMessageInput.to


GmailSendDraftInput

Extends

Properties

draftId
draftId: string;
signal?
optional signal?: AbortSignal;
Inherited from

GmailProviderRequestOptions.signal


GmailSendEmailInput

Extends

Properties

bcc?
optional bcc?: string[];
Inherited from

GmailRawMessageInput.bcc

cc?
optional cc?: string[];
Inherited from

GmailRawMessageInput.cc

from?
optional from?: string;
Inherited from

GmailRawMessageInput.from

inReplyTo?
optional inReplyTo?: string;
Inherited from

GmailRawMessageInput.inReplyTo

messageId?
optional messageId?: string;
Inherited from

GmailRawMessageInput.messageId

raw?
optional raw?: string;
Inherited from
GmailComposedMessageInput.raw
references?
optional references?: string[];
Inherited from

GmailRawMessageInput.references

replyTo?
optional replyTo?: string;
Inherited from

GmailRawMessageInput.replyTo

signal?
optional signal?: AbortSignal;
Inherited from
GmailComposedMessageInput.signal
subject?
optional subject?: string;
Inherited from

GmailRawMessageInput.subject

text?
optional text?: string;
Inherited from

GmailRawMessageInput.text

threadId?
optional threadId?: string;
to?
optional to?: string[];
Inherited from

GmailRawMessageInput.to


GmailWatchInput

Extends

Properties

labelFilterBehavior?
optional labelFilterBehavior?: "include" | "exclude";
labelIds?
optional labelIds?: string[];
signal?
optional signal?: AbortSignal;
Inherited from

GmailProviderRequestOptions.signal

topicName
topicName: string;

ProviderApiErrorInput

Properties

body?
optional body?: unknown;
code?
optional code?: string | number;
message
message: string;
provider
provider: string;
response
response: ProviderApiErrorResponseMetadata;
retryAfter?
optional retryAfter?: string;
status
status: number;

ProviderApiErrorResponseMetadata

Properties

headers
headers: Record<string, string>;
requestId?
optional requestId?: string;
statusText
statusText: string;
url?
optional url?: string;

Type Aliases

GmailAttachmentBody

type GmailAttachmentBody = gmail_v1.Schema$MessagePartBody;

GmailComposedMessageInput

type GmailComposedMessageInput = GmailProviderRequestOptions & Partial<GmailRawMessageInput> & {
  raw?: string;
};

Type Declaration

Name Type
raw? string

GmailEmailOperationAlias

type GmailEmailOperationAlias = typeof GMAIL_EMAIL_OPERATION_ALIASES[number];

GmailEmailOperationHandler

type GmailEmailOperationHandler<K> = (input) => Promise<GmailEmailOperationOutputMap[K]>;

Type Parameters

Type Parameter
K extends GmailEmailOperationAlias

Parameters

Parameter Type
input GmailEmailOperationInputMap[K]

Returns

Promise\<GmailEmailOperationOutputMap[K]>


GmailEmailOperationHandlers

type GmailEmailOperationHandlers = { [K in GmailEmailOperationAlias]: GmailEmailOperationHandler<K> };

GmailHistoryListResponse

type GmailHistoryListResponse = gmail_v1.Schema$ListHistoryResponse;

GmailHistoryType

type GmailHistoryType = "messageAdded" | "messageDeleted" | "labelAdded" | "labelRemoved";

GmailJsonPrimitive

type GmailJsonPrimitive = string | number | boolean | null;

GmailJsonValue

type GmailJsonValue =
  | GmailJsonPrimitive
  | GmailJsonObject
  | GmailJsonValue[];

GmailLabelListResponse

type GmailLabelListResponse = gmail_v1.Schema$ListLabelsResponse;

GmailLiveCheckOptions

type GmailLiveCheckOptions = GmailEmailClientOptions & {
  client?: Pick<GmailEmailClient, "getProfile">;
};

Type Declaration

Name Type
client? Pick\<GmailEmailClient, "getProfile">

GmailOfficialAuth

type GmailOfficialAuth = typeof auth;

GmailOfficialAuthClient

type GmailOfficialAuthClient = NonNullable<gmail_v1.Options["auth"]>;

GmailOfficialClient

type GmailOfficialClient = gmail_v1.Gmail;

GmailOfficialMethodOptions

type GmailOfficialMethodOptions = MethodOptions;

GmailProfileResource

type GmailProfileResource = gmail_v1.Schema$Profile;

GmailWatchResponse

type GmailWatchResponse = gmail_v1.Schema$WatchResponse;

Variables

GMAIL_EMAIL_OPERATION_ALIASES

const GMAIL_EMAIL_OPERATION_ALIASES: readonly ["email.receive", "email.thread.read", "email.reply.send", "email.send", "email.draft.create", "email.draft.send", "email.archive", "mailbox.watch", "gmail.history.list", "gmail.attachment.get", "gmail.labels.list"];

gmailEmailProviderOperations

const gmailEmailProviderOperations: ProviderOperationDeclarationInput[];

Functions

createGmailEmailClient()

function createGmailEmailClient(options): GmailEmailClient;

Parameters

Parameter Type
options GmailEmailClientOptions

Returns

GmailEmailClient


createGmailEmailIntegration()

function createGmailEmailIntegration(options): DefinedIntegration<{
  capabilities: {
     audiences?: ("customer-facing" | "internal-support" | "mixed")[];
     capability: string;
     changesWorkflow?: boolean;
     description?: string;
     exposesSensitiveData?: boolean;
     extension?: boolean;
     label?: string;
     metadata?: Record<string, unknown>;
     providerObjects?: {
        description?: string;
        kind: string;
        label?: string;
        metadata?: Record<string, unknown>;
        schemaName?: string;
     }[];
     requiresCredential?: boolean;
     sideEffect?: boolean;
  }[];
  category: string;
  channelAudiences: ("customer-facing" | "internal-support" | "mixed")[];
  coverage: {
     evidence: {
        label: string;
        url?: string;
     }[];
     notes: string[];
     scope:   | "support-workflow-subset"
        | "provider-api-subset"
        | "connector-required"
        | "local-protocol"
        | "full-provider-api";
  };
  credentialRequirements: {
     description?: string;
     id: string;
     label?: string;
     metadata?: Record<string, unknown>;
     required: boolean;
     scopes: string[];
  }[];
  directions: (
     | "receive-only"
     | "send-only"
     | "inbound-only"
     | "outbound-only"
    | "bidirectional")[];
  id: string;
  limitations: string[];
  maintainers: {
     name: string;
     type: "community" | "official" | "unknown" | "partner";
     url?: string;
  }[];
  metadata?: Record<string, unknown>;
  name: string;
  operations: {
     alias: string;
     audience?: "customer-facing" | "internal-support" | "mixed";
     audiences?: ("customer-facing" | "internal-support" | "mixed")[];
     capability: string;
     changesWorkflow?: boolean;
     description?: string;
     exposesSensitiveData?: boolean;
     extension: boolean;
     externallyVisible?: boolean;
     inputSchema?: unknown;
     inputSchemaName?: string;
     inputSchemaRef?: string;
     label?: string;
     metadata?: Record<string, unknown>;
     outputSchema?: unknown;
     outputSchemaName?: string;
     outputSchemaRef?: string;
     providerObject?: string;
     providerObjects?: {
        description?: string;
        kind: string;
        label?: string;
        metadata?: Record<string, unknown>;
        schemaName?: string;
     }[];
     providerOperation?: string;
     requiredPolicyIds?: string[];
     requiresApproval?: boolean;
     requiresCredential?: boolean;
     sideEffect?: boolean;
  }[];
  packageName: string;
  privacyNotes: string[];
  provider: string;
  trustLevel: "community" | "official" | "verified" | "experimental";
} & {
  capabilities: readonly [{
     audiences: readonly ["customer-facing", "internal-support", "mixed"];
     capability: "receive";
     description: "Parses Gmail Pub/Sub notifications and reads Gmail watch/history cursors.";
     exposesSensitiveData: true;
     label: "Receive Gmail mailbox changes";
     providerObjects: readonly [{
        kind: "mailbox";
        label: "Gmail Mailbox";
      }, {
        kind: "gmailHistory";
        label: "Gmail History";
     }];
     requiresCredential: true;
   }, {
     audiences: readonly ["customer-facing", "internal-support", "mixed"];
     capability: "read-provider-object";
     description: "Reads Gmail threads, messages, labels, and attachment bodies through the official SDK.";
     exposesSensitiveData: true;
     label: "Read Gmail threads and attachments";
     providerObjects: readonly [{
        kind: "emailThread";
        label: "Email Thread";
      }, {
        kind: "emailMessage";
        label: "Email Message";
      }, {
        kind: "attachment";
        label: "Attachment";
      }, {
        kind: "mailLabel";
        label: "Mail Label";
     }];
     requiresCredential: true;
   }, {
     audiences: readonly ["customer-facing", "internal-support", "mixed"];
     capability: "draft";
     description: "Creates Gmail draft messages for SDK-user-configured approval workflows.";
     exposesSensitiveData: true;
     label: "Create Gmail drafts";
     providerObjects: readonly [{
        kind: "emailDraft";
        label: "Email Draft";
     }];
     requiresCredential: true;
     sideEffect: true;
   }, {
     audiences: readonly ["customer-facing", "mixed"];
     capability: "send";
     description: "Sends Gmail replies, new messages, or existing drafts when SDK-user policy permits outbound contact.";
     exposesSensitiveData: true;
     label: "Send Gmail messages";
     providerObjects: readonly [{
        kind: "emailMessage";
        label: "Email Message";
      }, {
        kind: "emailDraft";
        label: "Email Draft";
     }];
     requiresCredential: true;
     sideEffect: true;
   }, {
     audiences: readonly ["internal-support", "mixed"];
     capability: "update-provider-object";
     changesWorkflow: true;
     description: "Removes active inbox labels from Gmail threads when SDK-user policy permits mutation.";
     exposesSensitiveData: true;
     label: "Archive Gmail threads";
     providerObjects: readonly [{
        kind: "emailThread";
        label: "Email Thread";
     }];
     requiresCredential: true;
     sideEffect: true;
  }];
  category: "email";
  channelAudiences: readonly ["customer-facing", "internal-support", "mixed"];
  coverage: {
     evidence: readonly [{
        label: "@googleapis/gmail package";
        url: "https://www.npmjs.com/package/@googleapis/gmail";
      }, {
        label: "Gmail API Node.js quickstart";
        url: "https://developers.google.com/workspace/gmail/api/quickstart/nodejs";
      }, {
        label: "Gmail users.threads.get";
        url: "https://developers.google.com/workspace/gmail/api/reference/rest/v1/users.threads/get";
      }, {
        label: "Gmail users.messages.send";
        url: "https://developers.google.com/workspace/gmail/api/reference/rest/v1/users.messages/send";
      }, {
        label: "Gmail users.drafts.create";
        url: "https://developers.google.com/workspace/gmail/api/reference/rest/v1/users.drafts/create";
      }, {
        label: "Gmail users.threads.modify";
        url: "https://developers.google.com/workspace/gmail/api/reference/rest/v1/users.threads/modify";
      }, {
        label: "Gmail users.watch";
        url: "https://developers.google.com/workspace/gmail/api/reference/rest/v1/users/watch";
      }, {
        label: "Gmail push notifications";
        url: "https://developers.google.com/workspace/gmail/api/guides/push";
     }];
     notes: readonly ["Coverage is intentionally scoped to normalized Cognidesk email support workflows implemented by typed handlers.", "Implementation uses the official service-specific @googleapis/gmail SDK. Broader Gmail methods remain accessible through GmailEmailClient.rawClient instead of generated Cognidesk-owned full API functions.", "Operation handlers are bound through @cognidesk/integration-kit so manifest operations and executable handlers must stay in exact parity.", "Receive coverage is Gmail watch/history foundation plus Google Cloud Pub/Sub push notification parsing; Pub/Sub topic/subscription hosting, authentication, retry, and history synchronization policy are SDK-user responsibilities."];
     scope: "support-workflow-subset";
  };
  credentialRequirements: readonly [{
     description: "Server-side OAuth access token or injected official Gmail SDK auth client.";
     id: "google-oauth-access-token";
     label: "Google OAuth access token";
     metadata: {
        scopeKind: "provider-oauth-scopes";
     };
     required: true;
     scopes: readonly ["https://www.googleapis.com/auth/gmail.readonly", "https://www.googleapis.com/auth/gmail.compose", "https://www.googleapis.com/auth/gmail.send", "https://www.googleapis.com/auth/gmail.modify", "https://www.googleapis.com/auth/gmail.metadata"];
  }];
  directions: readonly ["receive-only", "send-only", "bidirectional"];
  id: "email.gmail";
  limitations: readonly ["Available operations depend on OAuth scopes, Google Workspace policy, delegated user, and mailbox state configured by the SDK user.", "Gmail watch notifications require an SDK-user-managed Google Cloud Pub/Sub topic, subscription, webhook/worker, and history synchronization strategy.", "Draft approval, auto-send, retention, redaction, and outbound-contact policy are SDK-user configuration.", "This package does not claim full Gmail API coverage; use rawClient for advanced official SDK methods."];
  maintainers: readonly [{
     name: "Cognidesk";
     type: "official";
  }];
  metadata: {
     channelCoverage: {
        broaderGmailApi: "provider-supported-raw-client";
        gmailAttachments: "typed-read-body";
        gmailDrafts: "typed-create-and-send";
        gmailLabels: "typed-list";
        gmailMessages: "typed-send-and-reply";
        gmailThreads: "typed-read-and-archive";
        gmailWatchHistory: "typed-watch-history-foundation";
        pubSubPushDelivery: "typed-parse-only-sdk-owned-hosting";
     };
     implementation: {
        integrationKitStatus: "implemented";
        manifestImport: "no-sdk-client-initialization";
        rawClientEscapeHatch: "GmailEmailClient.rawClient";
        sdkPackage: "@googleapis/gmail";
        sdkVersionRange: "^17.0.0";
        strategy: "official-sdk";
     };
     scopeAlternatives: {
        metadataOnlyCaveat: "Gmail metadata-only scopes support profile/watch/read metadata surfaces, but SDK users must avoid query-dependent listing where the Gmail API disallows q with gmail.metadata.";
        profile: readonly ["https://mail.google.com/", "https://www.googleapis.com/auth/gmail.modify", "https://www.googleapis.com/auth/gmail.compose", "https://www.googleapis.com/auth/gmail.readonly", "https://www.googleapis.com/auth/gmail.metadata"];
        send: readonly ["https://mail.google.com/", "https://www.googleapis.com/auth/gmail.modify", "https://www.googleapis.com/auth/gmail.compose", "https://www.googleapis.com/auth/gmail.send"];
        watch: readonly ["https://mail.google.com/", "https://www.googleapis.com/auth/gmail.modify", "https://www.googleapis.com/auth/gmail.readonly", "https://www.googleapis.com/auth/gmail.metadata"];
     };
  };
  name: "Gmail";
  operations: {
     alias: string;
     audience?: "customer-facing" | "internal-support" | "mixed";
     audiences?: ("customer-facing" | "internal-support" | "mixed")[];
     capability: string;
     changesWorkflow?: boolean;
     description?: string;
     exposesSensitiveData?: boolean;
     extension?: boolean;
     externallyVisible?: boolean;
     inputSchema?: unknown;
     inputSchemaName?: string;
     inputSchemaRef?: string;
     label?: string;
     metadata?: Record<string, unknown>;
     outputSchema?: unknown;
     outputSchemaName?: string;
     outputSchemaRef?: string;
     providerObject?: string;
     providerObjects?: {
        description?: string;
        kind: string;
        label?: string;
        metadata?: Record<string, unknown>;
        schemaName?: string;
     }[];
     providerOperation?: string;
     requiredPolicyIds?: string[];
     requiresApproval?: boolean;
     requiresCredential?: boolean;
     sideEffect?: boolean;
  }[];
  packageName: "@cognidesk/integration-email-gmail";
  privacyNotes: readonly ["Gmail messages can contain customer content, attachments, addresses, labels, and thread history.", "OAuth tokens stay server-side and are represented in Studio only as credential readiness."];
  provider: "gmail";
  trustLevel: "official";
}, unknown, IntegrationOperationHandlers>;

Parameters

Parameter Type
options GmailEmailClientOptions

Returns

DefinedIntegration\<{ capabilities: { audiences?: ("customer-facing" | "internal-support" | "mixed")[]; capability: string; changesWorkflow?: boolean; description?: string; exposesSensitiveData?: boolean; extension?: boolean; label?: string; metadata?: Record\<string, unknown>; providerObjects?: { description?: string; kind: string; label?: string; metadata?: Record\<string, unknown>; schemaName?: string; }[]; requiresCredential?: boolean; sideEffect?: boolean; }[]; category: string; channelAudiences: ("customer-facing" | "internal-support" | "mixed")[]; coverage: { evidence: { label: string; url?: string; }[]; notes: string[]; scope: | "support-workflow-subset" | "provider-api-subset" | "connector-required" | "local-protocol" | "full-provider-api"; }; credentialRequirements: { description?: string; id: string; label?: string; metadata?: Record\<string, unknown>; required: boolean; scopes: string[]; }[]; directions: ( | "receive-only" | "send-only" | "inbound-only" | "outbound-only" | "bidirectional")[]; id: string; limitations: string[]; maintainers: { name: string; type: "community" | "official" | "unknown" | "partner"; url?: string; }[]; metadata?: Record\<string, unknown>; name: string; operations: { alias: string; audience?: "customer-facing" | "internal-support" | "mixed"; audiences?: ("customer-facing" | "internal-support" | "mixed")[]; capability: string; changesWorkflow?: boolean; description?: string; exposesSensitiveData?: boolean; extension: boolean; externallyVisible?: boolean; inputSchema?: unknown; inputSchemaName?: string; inputSchemaRef?: string; label?: string; metadata?: Record\<string, unknown>; outputSchema?: unknown; outputSchemaName?: string; outputSchemaRef?: string; providerObject?: string; providerObjects?: { description?: string; kind: string; label?: string; metadata?: Record\<string, unknown>; schemaName?: string; }[]; providerOperation?: string; requiredPolicyIds?: string[]; requiresApproval?: boolean; requiresCredential?: boolean; sideEffect?: boolean; }[]; packageName: string; privacyNotes: string[]; provider: string; trustLevel: "community" | "official" | "verified" | "experimental"; } & { capabilities: readonly [{ audiences: readonly ["customer-facing", "internal-support", "mixed"]; capability: "receive"; description: "Parses Gmail Pub/Sub notifications and reads Gmail watch/history cursors."; exposesSensitiveData: true; label: "Receive Gmail mailbox changes"; providerObjects: readonly [{ kind: "mailbox"; label: "Gmail Mailbox"; }, { kind: "gmailHistory"; label: "Gmail History"; }]; requiresCredential: true; }, { audiences: readonly ["customer-facing", "internal-support", "mixed"]; capability: "read-provider-object"; description: "Reads Gmail threads, messages, labels, and attachment bodies through the official SDK."; exposesSensitiveData: true; label: "Read Gmail threads and attachments"; providerObjects: readonly [{ kind: "emailThread"; label: "Email Thread"; }, { kind: "emailMessage"; label: "Email Message"; }, { kind: "attachment"; label: "Attachment"; }, { kind: "mailLabel"; label: "Mail Label"; }]; requiresCredential: true; }, { audiences: readonly ["customer-facing", "internal-support", "mixed"]; capability: "draft"; description: "Creates Gmail draft messages for SDK-user-configured approval workflows."; exposesSensitiveData: true; label: "Create Gmail drafts"; providerObjects: readonly [{ kind: "emailDraft"; label: "Email Draft"; }]; requiresCredential: true; sideEffect: true; }, { audiences: readonly ["customer-facing", "mixed"]; capability: "send"; description: "Sends Gmail replies, new messages, or existing drafts when SDK-user policy permits outbound contact."; exposesSensitiveData: true; label: "Send Gmail messages"; providerObjects: readonly [{ kind: "emailMessage"; label: "Email Message"; }, { kind: "emailDraft"; label: "Email Draft"; }]; requiresCredential: true; sideEffect: true; }, { audiences: readonly ["internal-support", "mixed"]; capability: "update-provider-object"; changesWorkflow: true; description: "Removes active inbox labels from Gmail threads when SDK-user policy permits mutation."; exposesSensitiveData: true; label: "Archive Gmail threads"; providerObjects: readonly [{ kind: "emailThread"; label: "Email Thread"; }]; requiresCredential: true; sideEffect: true; }]; category: "email"; channelAudiences: readonly ["customer-facing", "internal-support", "mixed"]; coverage: { evidence: readonly [{ label: "@googleapis/gmail package"; url: "https://www.npmjs.com/package/@googleapis/gmail"; }, { label: "Gmail API Node.js quickstart"; url: "https://developers.google.com/workspace/gmail/api/quickstart/nodejs"; }, { label: "Gmail users.threads.get"; url: "https://developers.google.com/workspace/gmail/api/reference/rest/v1/users.threads/get"; }, { label: "Gmail users.messages.send"; url: "https://developers.google.com/workspace/gmail/api/reference/rest/v1/users.messages/send"; }, { label: "Gmail users.drafts.create"; url: "https://developers.google.com/workspace/gmail/api/reference/rest/v1/users.drafts/create"; }, { label: "Gmail users.threads.modify"; url: "https://developers.google.com/workspace/gmail/api/reference/rest/v1/users.threads/modify"; }, { label: "Gmail users.watch"; url: "https://developers.google.com/workspace/gmail/api/reference/rest/v1/users/watch"; }, { label: "Gmail push notifications"; url: "https://developers.google.com/workspace/gmail/api/guides/push"; }]; notes: readonly ["Coverage is intentionally scoped to normalized Cognidesk email support workflows implemented by typed handlers.", "Implementation uses the official service-specific @googleapis/gmail SDK. Broader Gmail methods remain accessible through GmailEmailClient.rawClient instead of generated Cognidesk-owned full API functions.", "Operation handlers are bound through @cognidesk/integration-kit so manifest operations and executable handlers must stay in exact parity.", "Receive coverage is Gmail watch/history foundation plus Google Cloud Pub/Sub push notification parsing; Pub/Sub topic/subscription hosting, authentication, retry, and history synchronization policy are SDK-user responsibilities."]; scope: "support-workflow-subset"; }; credentialRequirements: readonly [{ description: "Server-side OAuth access token or injected official Gmail SDK auth client."; id: "google-oauth-access-token"; label: "Google OAuth access token"; metadata: { scopeKind: "provider-oauth-scopes"; }; required: true; scopes: readonly ["https://www.googleapis.com/auth/gmail.readonly", "https://www.googleapis.com/auth/gmail.compose", "https://www.googleapis.com/auth/gmail.send", "https://www.googleapis.com/auth/gmail.modify", "https://www.googleapis.com/auth/gmail.metadata"]; }]; directions: readonly ["receive-only", "send-only", "bidirectional"]; id: "email.gmail"; limitations: readonly ["Available operations depend on OAuth scopes, Google Workspace policy, delegated user, and mailbox state configured by the SDK user.", "Gmail watch notifications require an SDK-user-managed Google Cloud Pub/Sub topic, subscription, webhook/worker, and history synchronization strategy.", "Draft approval, auto-send, retention, redaction, and outbound-contact policy are SDK-user configuration.", "This package does not claim full Gmail API coverage; use rawClient for advanced official SDK methods."]; maintainers: readonly [{ name: "Cognidesk"; type: "official"; }]; metadata: { channelCoverage: { broaderGmailApi: "provider-supported-raw-client"; gmailAttachments: "typed-read-body"; gmailDrafts: "typed-create-and-send"; gmailLabels: "typed-list"; gmailMessages: "typed-send-and-reply"; gmailThreads: "typed-read-and-archive"; gmailWatchHistory: "typed-watch-history-foundation"; pubSubPushDelivery: "typed-parse-only-sdk-owned-hosting"; }; implementation: { integrationKitStatus: "implemented"; manifestImport: "no-sdk-client-initialization"; rawClientEscapeHatch: "GmailEmailClient.rawClient"; sdkPackage: "@googleapis/gmail"; sdkVersionRange: "^17.0.0"; strategy: "official-sdk"; }; scopeAlternatives: { metadataOnlyCaveat: "Gmail metadata-only scopes support profile/watch/read metadata surfaces, but SDK users must avoid query-dependent listing where the Gmail API disallows q with gmail.metadata."; profile: readonly ["https://mail.google.com/", "https://www.googleapis.com/auth/gmail.modify", "https://www.googleapis.com/auth/gmail.compose", "https://www.googleapis.com/auth/gmail.readonly", "https://www.googleapis.com/auth/gmail.metadata"]; send: readonly ["https://mail.google.com/", "https://www.googleapis.com/auth/gmail.modify", "https://www.googleapis.com/auth/gmail.compose", "https://www.googleapis.com/auth/gmail.send"]; watch: readonly ["https://mail.google.com/", "https://www.googleapis.com/auth/gmail.modify", "https://www.googleapis.com/auth/gmail.readonly", "https://www.googleapis.com/auth/gmail.metadata"]; }; }; name: "Gmail"; operations: { alias: string; audience?: "customer-facing" | "internal-support" | "mixed"; audiences?: ("customer-facing" | "internal-support" | "mixed")[]; capability: string; changesWorkflow?: boolean; description?: string; exposesSensitiveData?: boolean; extension?: boolean; externallyVisible?: boolean; inputSchema?: unknown; inputSchemaName?: string; inputSchemaRef?: string; label?: string; metadata?: Record\<string, unknown>; outputSchema?: unknown; outputSchemaName?: string; outputSchemaRef?: string; providerObject?: string; providerObjects?: { description?: string; kind: string; label?: string; metadata?: Record\<string, unknown>; schemaName?: string; }[]; providerOperation?: string; requiredPolicyIds?: string[]; requiresApproval?: boolean; requiresCredential?: boolean; sideEffect?: boolean; }[]; packageName: "@cognidesk/integration-email-gmail"; privacyNotes: readonly ["Gmail messages can contain customer content, attachments, addresses, labels, and thread history.", "OAuth tokens stay server-side and are represented in Studio only as credential readiness."]; provider: "gmail"; trustLevel: "official"; }, unknown, IntegrationOperationHandlers>


createGmailEmailLiveChecks()

function createGmailEmailLiveChecks(options): {
  description: string;
  id: string;
  requiredCredentialIds: string[];
  run: Promise<{
     details: {
        emailAddress: string;
        messagesTotal: number;
     };
  }>;
}[];

Parameters

Parameter Type
options GmailLiveCheckOptions

Returns

{ description: string; id: string; requiredCredentialIds: string[]; run: Promise\<{ details: { emailAddress: string; messagesTotal: number; }; }>; }[]


createGmailRawMessage()

function createGmailRawMessage(input): string;

Parameters

Parameter Type
input GmailRawMessageInput

Returns

string


gmailEmailCredentialStatuses()

function gmailEmailCredentialStatuses(input): {
  expiresAt?: string;
  message?: string;
  providerPackageId?: string;
  requirementId: string;
  scopes?: string[];
  state:   | "required"
     | "configured"
     | "permission-blocked"
     | "not-required"
     | "missing"
     | "expired"
     | "insufficient-scope"
     | "unavailable";
}[];

Parameters

Parameter Type
input GmailCredentialStatusInput

Returns

{ expiresAt?: string; message?: string; providerPackageId?: string; requirementId: string; scopes?: string[]; state: | "required" | "configured" | "permission-blocked" | "not-required" | "missing" | "expired" | "insufficient-scope" | "unavailable"; }[]


normalizeGmailDraft()

function normalizeGmailDraft(draft): GmailEmailDraft;

Parameters

Parameter Type
draft Schema$Draft

Returns

GmailEmailDraft


normalizeGmailMessage()

function normalizeGmailMessage(message): GmailEmailMessage;

Parameters

Parameter Type
message Schema$Message

Returns

GmailEmailMessage


normalizeGmailThread()

function normalizeGmailThread(thread): GmailEmailThread;

Parameters

Parameter Type
thread Schema$Thread

Returns

GmailEmailThread


parseGmailPubSubNotification()

function parseGmailPubSubNotification(requestOrEnvelope): Promise<GmailPubSubNotification>;

Parameters

Parameter Type
requestOrEnvelope | Request | GmailPubSubNotificationEnvelope

Returns

Promise\<GmailPubSubNotification>

References

gmailEmailProviderManifest

Re-exports gmailEmailProviderManifest