PostHog
The PostHog block connects your workflows to PostHog product analytics — capture events, identify users and groups, evaluate feature flags, and read data back with HogQL queries.
Analytics In, Analytics Out: Track what happens inside your workflows (orders, sign-ups, bot conversations), branch on feature flags, and pull analytics results into agents and reports.
Key Features
- Event Capture: Send custom events with properties from any workflow step
- User Identity: Identify users, merge aliases, and set person properties
- Feature Flags: Evaluate flags per user and branch your workflow on the result
- Data Read-back: Run HogQL queries and list events, persons, insights, and cohorts
- Annotations: Mark releases or incidents on your PostHog charts
Operations
Capture & Identity
| Operation | Description |
|---|---|
| Capture Event | Send an event for a distinct ID with optional JSON properties and timestamp |
| Identify User | Set person properties ($set), with optional set-once properties ($set_once) |
| Create Alias | Merge another distinct ID into the same user |
| Group Identify | Set properties on a group (e.g. group type company, key acme-inc) |
Feature Flags
| Operation | Description |
|---|---|
| Evaluate Feature Flags | Evaluate all flags for a user, or one flag key → returns enabled, value, payload |
| Get Feature Flag Payload | Fetch the payload attached to a flag |
| List Feature Flags | List the project's feature flags |
Analytics & Persons
| Operation | Description |
|---|---|
| Query (HogQL) | Run a HogQL SQL query → returns columns, results, records, count |
| List Events | List recent events, filterable by name, distinct ID, and time range |
| List Insights | List saved insights |
| List Cohorts | List cohorts |
| Create Annotation | Add an annotation (text + date) to your project |
| List Persons | List persons, with search |
| Get Person | Fetch one person by person ID or distinct ID |
| Delete Person | Permanently delete a person |
Configuration
| Parameter | Type | Required | Description |
|---|---|---|---|
| Credentials | Select | Yes | Your saved PostHog connection |
| Action | Select | Yes | One of the operations above |
| Distinct ID | Text | For capture/identity/flags | The user identifier — supports {{variables}} |
| Event Name | Text | For Capture Event | e.g. order_completed |
| Properties | JSON | No | Event or person properties, e.g. {"amount": 49, "channel": "whatsapp"} |
| Flag Key | Text | For flag ops | The feature flag to evaluate |
| Query | Text | For HogQL | The HogQL SQL query |
| Limit / Offset / Search / Before / After | Text | No | Filters for list operations |
Connecting your PostHog account
- In Indite, add the PostHog block and click Connect new.
- Fill in the credential fields:
| Field | Where to find it | Needed for |
|---|---|---|
| Host | https://us.i.posthog.com, https://eu.i.posthog.com, or your self-hosted URL | Everything |
Project API Key (phc_...) | PostHog → Project Settings | Capture, identify, alias, group identify, feature flags |
Personal API Key (phx_...) | PostHog → Account → Personal API Keys | HogQL, events, persons, insights, cohorts, annotations |
| Project ID | The numeric ID in Project Settings | Same operations as the Personal API Key |
⚠️
The Personal API Key and Project ID are optional, but without them the private-API operations (HogQL, persons, insights, cohorts, annotations, list flags) will fail. Capture and flag evaluation work with just the Project API Key.
Output
Reference fields in later blocks with {{<blockId>.<field>}}.
| Operation | Output |
|---|---|
| Capture / Identify / Alias / Group Identify | The PostHog API acknowledgment |
| Evaluate Feature Flags (one key) | flagKey, enabled (boolean), value, payload |
| Evaluate Feature Flags (all) | featureFlags, featureFlagPayloads objects |
| Query (HogQL) | columns, results (rows), records (rows as objects), count |
| Get Person / list operations | The person object or an array of results |
Example: track WhatsApp orders
- WhatsApp Trigger — a customer completes an order in your bot.
- PostHog → Capture Event — Distinct ID
{{whatsapp.from}}, Event Nameorder_completed, Properties{"amount": {{order.total}}, "channel": "whatsapp"}. - PostHog → Evaluate Feature Flags — flag key
new-upsellfor the same distinct ID. - Condition — if
{{posthog.enabled}}istrue, send the new upsell message; otherwise send the standard confirmation.