gmail
diapason.channels.gmail
¶
GmailChannel — native Gmail API adapter using OAuth2.
GmailChannel
¶
Bases: BaseChannel
Native Gmail channel adapter using the Gmail API with OAuth2.
Parameters¶
credentials_path:
Path to the OAuth2 credentials.json file.
Falls back to GMAIL_CREDENTIALS_PATH env var.
token_path:
Path to the stored OAuth2 token file.
Falls back to GMAIL_TOKEN_PATH env var.
user_id:
Gmail user ID (default "me" for the authenticated user).
poll_interval:
Seconds between inbox polls (default 30).
bus:
Optional event bus for publishing channel events.
connect()
¶
Load OAuth2 credentials and build the Gmail API service.
disconnect()
¶
Stop the polling thread and clear the service.
list_channels()
¶
Return available channel identifiers.
on_message(handler)
¶
Register a callback for incoming Gmail messages.
send(channel, content, *, conversation_id='', metadata=None)
¶
Send an email via the Gmail API.
channel is the recipient email address.
status()
¶
Return the current connection status.