PhoenixKit.Modules.Emails.BrevoIntegrations (phoenix_kit_emails v0.1.14)

Copy Markdown View Source

Shared "which Brevo account(s) are actually active" resolution, used by everything that needs to reach the Brevo events API on behalf of the currently-configured sender(s): BrevoPollingJob (the background poll), BrevoOnDemandSync (the "sync now" button), and the "Brevo Events" settings section's per-account opt-out list.

"Active" means an enabled PhoenixKit.Email.SendProfile pointed at a "brevo_api" integration — the same sender-aware definition BrevoPollingJob's moduledoc documents.

Summary

Functions

Every distinct integration_uuid referenced by an enabled brevo_api SendProfile. Multiple profiles can share one integration/API key — deduplicated so callers don't fetch the same account twice.

{integration_uuid, name} pairs for every account active_integration_uuids/0 would poll — for the settings UI's per-account opt-out list, which needs a human-readable name alongside the uuid it writes to the exclusion setting.

Resolves the decrypted api_key for a Brevo integration.

Functions

active_integration_uuids()

@spec active_integration_uuids() :: [String.t()]

Every distinct integration_uuid referenced by an enabled brevo_api SendProfile. Multiple profiles can share one integration/API key — deduplicated so callers don't fetch the same account twice.

active_integrations_with_names()

@spec active_integrations_with_names() :: [{String.t(), String.t()}]

{integration_uuid, name} pairs for every account active_integration_uuids/0 would poll — for the settings UI's per-account opt-out list, which needs a human-readable name alongside the uuid it writes to the exclusion setting.

resolve_api_key(integration_uuid)

@spec resolve_api_key(String.t()) :: {:ok, String.t()} | {:error, term()}

Resolves the decrypted api_key for a Brevo integration.