
PostHog EvaluateFeatureFlag
CertifiedEvaluate a PostHog feature flag
PostHog EvaluateFeatureFlag
Evaluate a PostHog feature flag
Asks PostHog for the value of a feature flag for a given user. The result is the flag value: a boolean for a boolean flag, or the variant name for a multivariate flag. A flag that PostHog does not return gives a null value, which is not an error. The task fails if the evaluation request itself fails (invalid API key, unreachable host, server error...). Reading the flag also sends a $feature_flag_called event to PostHog, as the PostHog SDK does by default. Uses the project API key (phc_).
type: io.kestra.plugin.posthog.EvaluateFeatureFlagExamples
Check a feature flag and use its value in a later task
id: feature_flag_gate
namespace: company.analytics
inputs:
- id: user_id
type: STRING
tasks:
- id: check_flag
type: io.kestra.plugin.posthog.EvaluateFeatureFlag
apiKey: "{{ secret('POSTHOG_API_KEY') }}"
host: "https://us.i.posthog.com"
distinctId: "{{ inputs.user_id }}"
flagKey: new-checkout
- id: log_flag
type: io.kestra.plugin.core.log.Log
message: "new-checkout is {{ outputs.check_flag.enabled ? 'on' : 'off' }} for {{ inputs.user_id }} (value: {{ outputs.check_flag.value }})"
Properties
apiKey *string
PostHog project API key
The project API key (starts with phc_). Use a Kestra secret, e.g. {{ secret('POSTHOG_API_KEY') }}.
distinctId *string
Distinct ID
The distinct ID of the user to evaluate the feature flag for.
flagKey *string
Flag key
The key of the feature flag to evaluate, e.g. new-checkout.
assets
Assets this task consumes as inputs or produces as outputs, for lineage tracking and the asset graph (Enterprise Edition). A flow declaring this property on a task is rejected in the open-source edition.
io.kestra.core.models.assets.AssetsDeclaration
IGNOREFAILWARNAsset failure behavior
Behavior applied to the task state when a declared asset fails to render, emit, or be persisted (e.g. a lock conflict): FAIL escalates it to FAILED, WARN (default) warns it if it would otherwise succeed, IGNORE leaves the state untouched.
Whether to auto-register assets referenced dynamically at runtime that are not statically declared in inputs or outputs.
The assets consumed as inputs.
io.kestra.core.models.assets.AssetIdentifier
1The assets produced as outputs.
io.kestra.plugin.ee.assets.Dataset
1150{}1150io.kestra.plugin.ee.assets.File
1150{}1150io.kestra.plugin.ee.assets.Table
1150{}1150io.kestra.plugin.ee.assets.VM
1150{}1150io.kestra.core.models.assets.External
1150{}1150io.kestra.core.models.assets.Custom
11501Custom asset type
{}1150host string
PostHog host
The PostHog ingestion host, e.g. https://us.i.posthog.com (US Cloud), https://eu.i.posthog.com (EU Cloud) or a self-hosted URL. Defaults to US Cloud when empty.
Outputs
enabled boolean
Whether the flag is enabled
True for an enabled boolean flag or a multivariate flag with a variant. False for a disabled flag, and for a flag that PostHog did not return.
value booleanstring
Flag value
The value of the flag: a boolean for a boolean flag, the variant name for a multivariate flag, or null if PostHog did not return the flag.
variant string
Variant
The variant name of a multivariate flag, or null for a boolean flag or a flag that PostHog did not return.