Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

574 B
Raw Blame
"""The active workflows that use an integration row. The integrations SDK loads this module."""

from posthog.integrations import IntegrationUsage

from products.workflows.backend.facade.api import get_active_workflows_using_integration

WORKFLOW_USAGE_TYPE = "workflow"


def integration_usages(team_id: int, integration_id: int) -> list[IntegrationUsage]:
    return [
        IntegrationUsage(type=WORKFLOW_USAGE_TYPE, id=flow.id, name=flow.name or flow.id)
        for flow in get_active_workflows_using_integration(team_id=team_id, integration_id=integration_id)
    ]