# `PhoenixKit.Modules.Emails.BrevoPollingManager`
[🔗](https://github.com/BeamLabEU/phoenix_kit_emails/blob/0.4.2/lib/phoenix_kit/modules/emails/brevo_polling_manager.ex#L1)

Manager module for Brevo event polling via Oban jobs.

Mirrors `SQSPollingManager` — see that module's `@moduledoc` for the
general architecture (Oban jobs instead of a GenServer, so settings
changes take effect without a restart). `enable_polling/0` and
`disable_polling/0` back the admin UI toggle; `poll_now/0` forces one
cycle even when `brevo_events_enabled` is off (useful to verify a
freshly-configured Brevo profile without turning the background chain
on). Forced runs still respect `Emails.enabled?/0` and the sender-aware
profile gate — zero active Brevo profiles yields a no-op cycle, same as
a scheduled tick would.

# `disable_polling`

Disables Brevo event polling by updating the configuration.

No explicit job cancellation: `BrevoPollingJob.perform/1` checks
`should_poll?/0` (unless forced) before self-scheduling its next cycle
— see that module. At most one already-queued job fires once more,
sees polling disabled, does nothing, and does not re-schedule; the
chain dies on its own within one cycle.

# `enable_polling`

Enables Brevo event polling by setting the configuration and starting
the first job.

# `poll_now`

Triggers an immediate polling job, regardless of the normal schedule
or the `brevo_events_enabled` toggle — a `forced: true` job (see
`BrevoPollingJob.perform/1`) still fetches once even while polling is
disabled, rather than silently no-op'ing while claiming success. Still
respects `Emails.enabled?/0` (system disabled) and the sender-aware
profile gate: a forced poll with zero active Brevo profiles correctly
fetches nothing, same as a scheduled cycle would.

# `set_polling_interval`

Sets the polling interval in milliseconds (minimum 30 000ms).

# `status`

Returns the current status of Brevo event polling.

`active_brevo_profiles` is the sender-aware gate's own count (see
`BrevoPollingJob`'s moduledoc): the number of *enabled* send profiles
pointed at a `"brevo_api"` integration. When it's 0, the polling chain
is alive (as long as `enabled` is true) but every cycle no-ops.

`total_brevo_accounts`/`polling_brevo_accounts` are the *distinct
integration* view the per-account opt-out list needs — several
profiles can share one integration, so this can differ from
`active_brevo_profiles`. `polling_brevo_accounts` excludes whatever's
in `Emails.get_brevo_polling_excluded_integrations/0`; when it's `0`
while `total_brevo_accounts` is not, every active account has been
explicitly excluded.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
