AbstractProtectedProviderReturns the name of this provider for use in error messages. Override in subclasses to provide a more descriptive name.
Convenience gate: true when this provider supports inbound push in ANY form
(subscription-managed or inbound-parse), false otherwise. Lets callers cleanly
short-circuit — if (provider.SupportsPush) { ... } — instead of probing individual
operations.
Derived from GetSubscriptionCapabilities so it stays in lockstep with actual
capability: providers that support push return capabilities and thereby report
SupportsPush === true for free; providers that don't return undefined and report
false. Subclasses normally do NOT override this — override
GetSubscriptionCapabilities instead.
Archives a message. Override in subclasses that support this operation.
Parameters for archiving the message
Optionalcredentials: ProviderCredentialsBaseOptional credentials override for this request
Promise
AbstractCreateCreates a draft message using the provider. Providers that don't support drafts should return Success: false with an appropriate error message.
Parameters for creating the draft
Optionalcredentials: ProviderCredentialsBaseOptional credentials override for this request
Promise
Creates a push-notification subscription with the remote messaging service. Override in subclasses that support this operation.
Parameters describing what to watch and where to notify
Optionalcredentials: ProviderCredentialsBaseOptional credentials override for this request
Promise
Deletes a message. Override in subclasses that support this operation.
Parameters for deleting the message
Optionalcredentials: ProviderCredentialsBaseOptional credentials override for this request
Promise
Deletes an existing subscription. The caller MUST pass credentials for the same account/app registration used to create the subscription. Implementations should treat "already gone" (e.g. 404) as success - deletion is idempotent from the consumer's perspective. Override in subclasses that support this operation.
Parameters identifying the subscription to delete
Optionalcredentials: ProviderCredentialsBaseOptional credentials override for this request
Promise
Downloads an attachment from a message. Override in subclasses that support this operation.
Parameters for downloading the attachment
Optionalcredentials: ProviderCredentialsBaseOptional credentials override for this request
Promise
AbstractForwardForwards a message to another client using the provider
Parameters for forwarding the message
Optionalcredentials: ProviderCredentialsBaseOptional credentials override for this request
Promise
AbstractGetFetches messages using the provider
Parameters for fetching messages
Optionalcredentials: ProviderCredentialsBaseOptional credentials override for this request
Promise
Gets a single message by ID. Override in subclasses that support this operation.
Parameters for retrieving the message
Optionalcredentials: ProviderCredentialsBaseOptional credentials override for this request
Promise
Returns this provider's subscription capabilities, or undefined when subscriptions
are not supported. Consumers use this to schedule renewals and validate change types
generically. Override in subclasses that support subscriptions.
INVARIANT: returning a defined value here REQUIRES the four subscription operations to appear in getSupportedOperations.
SubscriptionCapabilities when supported, otherwise undefined
Returns the list of operations supported by this provider. Override in subclasses to accurately reflect capabilities. Default implementation returns only the core abstract methods.
Lists attachments on a message. Override in subclasses that support this operation.
Parameters for listing attachments
Optionalcredentials: ProviderCredentialsBaseOptional credentials override for this request
Promise
Lists folders/mailboxes available in the provider. Override in subclasses that support this operation.
Parameters for listing folders
Optionalcredentials: ProviderCredentialsBaseOptional credentials override for this request
Promise
Marks message(s) as read or unread. Override in subclasses that support this operation.
Parameters for marking messages
Optionalcredentials: ProviderCredentialsBaseOptional credentials override for this request
Promise
Moves a message to a different folder. Override in subclasses that support this operation.
Parameters for moving the message
Optionalcredentials: ProviderCredentialsBaseOptional credentials override for this request
Promise
Parses and validates an inbound push notification. This is a pure operation: no
network calls. It MUST be safe on hostile/garbage input - never throw on malformed
payloads; return Success: false with SuggestedResponseStatus: 400 instead.
When the result carries a ParseNotificationResult.Handshake, the consumer must send exactly that response and process nothing else (endpoint validation). Override in subclasses that support this operation.
Transport-neutral capture of the inbound webhook request
Optionalcredentials: ProviderCredentialsBaseOptional credentials override (for schemes that verify signatures)
Promise
Renews an existing subscription before it expires. The caller MUST pass credentials for the same account/app registration used to create the subscription. Override in subclasses that support this operation.
Parameters identifying the subscription and the new expiration
Optionalcredentials: ProviderCredentialsBaseOptional credentials override for this request
Promise
AbstractReplyReplies to a message using the provider
Parameters for replying to the message
Optionalcredentials: ProviderCredentialsBaseOptional credentials override for this request
Promise
Searches messages using a query string. Override in subclasses that support this operation.
Parameters for searching messages
Optionalcredentials: ProviderCredentialsBaseOptional credentials override for this request
Promise
AbstractSendSends a single message using the provider
The processed message to send
Optionalcredentials: ProviderCredentialsBaseOptional credentials override for this request. Provider-specific credential interface (e.g., SendGridCredentials). If not provided, uses environment variables.
Promise
Checks if this provider supports a specific operation.
The operation to check
true if the operation is supported
Base class for all communication providers. Each provider sub-classes this base class and implements functionality specific to the provider.
Remarks
All methods accept an optional
credentialsparameter that allows per-request credential overrides. When credentials are provided, they take precedence over environment variables. Setcredentials.disableEnvironmentFallback = trueto disable environment variable fallback.Each provider defines its own credential interface that extends
ProviderCredentialsBase. For example,SendGridCredentials,MSGraphCredentials, etc.Example