PubSub helpers for broadcasting integration changes in real-time.
Lets the settings pages update live without a refresh. There are two topic scopes:
- the global system topic
"phoenix_kit:integrations"— system-wide connection changes (the website-wide page + consumers subscribe here); - a per-user topic
"phoenix_kit:integrations:<user_uuid>"— a user's own personal connection changes (the personal page subscribes here).
Each broadcaster routes by the connection's owner, so a personal change only reaches that user's page and a system change only reaches the system page.
Events
{:integration_setup_saved, provider_key, data}— setup credentials saved{:integration_connected, provider_key, data}— OAuth flow completed{:integration_disconnected, provider_key}— disconnected{:integration_validated, provider_key, :ok | {:error, reason}}— health check{:integration_connection_added | _removed, provider_key, name}{:integration_connection_renamed, provider_key, old, new}
The data payload on setup_saved/connected is REDACTED — secret fields are
stripped before broadcast so credentials never travel over PubSub (consumers
reload from the owner-scoped context anyway).
Summary
Types
Owner scope for routing a broadcast (mirrors PhoenixKit.Integrations.owner/0).
Functions
Broadcast that an OAuth integration was connected. Routes + redacts by data's owner.
Broadcast that a new named connection was added for a provider.
Broadcast that a named connection was removed from a provider.
Broadcast that a named connection was renamed.
Broadcast that an integration was disconnected.
Broadcast that an integration's setup credentials were saved. Routes + redacts by data's owner.
Broadcast that an integration's health check completed.
Subscribe to system-wide integration change events (the global topic).
Subscribe to a user's personal integration change events.
The per-user personal-integrations topic.
Types
Owner scope for routing a broadcast (mirrors PhoenixKit.Integrations.owner/0).
Functions
Broadcast that an OAuth integration was connected. Routes + redacts by data's owner.
Broadcast that a new named connection was added for a provider.
Broadcast that a named connection was removed from a provider.
Broadcast that a named connection was renamed.
Broadcast that an integration was disconnected.
Broadcast that an integration's setup credentials were saved. Routes + redacts by data's owner.
Broadcast that an integration's health check completed.
@spec subscribe() :: :ok | {:error, term()}
Subscribe to system-wide integration change events (the global topic).
Subscribe to a user's personal integration change events.
The per-user personal-integrations topic.