Skip to main content
The PostHog integration connects your PostHog instance to the Modem Agent. Once connected, the agent can query your product analytics, check feature flag states, review experiment results, and search error tracking data from chat.
PostHog is a query-based integration. Modem does not sync or store PostHog data. Instead, the agent queries your PostHog instance on demand when you ask a question.

Prerequisites

  • Admin or Owner role in your Modem organization
  • A PostHog account with a Personal API key

Setup

1

Generate a PostHog API key

In PostHog, go to SettingsPersonal API Keys and create a new key. The key should start with phx_.
2

Connect in Modem

Go to SettingsIntegrationsPostHog in your Modem dashboard.
  1. Select your Region (US Cloud or EU Cloud) to match your PostHog instance
  2. Paste your Personal API key
  3. Click Connect
Modem validates the connection by reaching your PostHog instance. If validation fails, double-check your region and API key.
3

Start asking questions

The agent can now query your PostHog data. Try it from the dashboard or Slack.
Your API key is encrypted at rest and never exposed in API responses. You can test the connection or rotate your key at any time from the integration settings page.

What the Agent Can Access

CategoryExamples
Product analyticsEvent counts, funnels, retention, trends via HogQL queries
Feature flagsFlag states, rollout percentages, targeting filters
ExperimentsA/B test results with statistical significance
Error trackingError rates, types, and affected users
The agent cannot access session recordings, PostHog billing settings, or team member information.

What the Agent Can Do

With PostHog connected, you can ask the agent to:
  • Query product usage metrics (signups, active users, conversion rates)
  • Check feature flag rollout states and targeting rules
  • Analyze A/B experiment results
  • Search error tracking data for patterns
  • Generate HogQL queries from natural language questions
  • Cross-reference PostHog analytics with feedback from your other data sources

Example Prompts

These work from the dashboard, Slack DMs, or by mentioning @modem in a channel. Simple: Advanced:

Troubleshooting

  • Verify your API key starts with phx_ and hasn’t been revoked in PostHog
  • Confirm you selected the correct region (US or EU) matching your PostHog instance
  • The connection timeout is 15 seconds. If your PostHog instance is behind a slow network, the test may time out.
  • Check that PostHog is connected in SettingsIntegrationsPostHog
  • Try running Test Connection to verify the connection is still valid
  • If your API key was rotated in PostHog, disconnect and reconnect with the new key
  • Start with a broad query and a recent time range to confirm data exists
  • Check that the events or properties you’re asking about match what’s in your PostHog project
  • PostHog Personal API keys can be scoped to a single project. If yours is, the agent can only access data within that project.
PostHog queries over large date ranges or without filters can take time. Ask the agent to narrow the time range or add filters. Starting with the last 7 days is a good default.

Disconnecting

To disconnect PostHog:
  1. Go to SettingsIntegrationsPostHog
  2. Click Disconnect and confirm
The agent will no longer be able to query your PostHog data. No data is deleted from PostHog. You can reconnect at any time with the same or a different API key.
https://mintcdn.com/modem-844d7a4a/Wr2r4IRr97lNQiQb/icons/bot.svg?fit=max&auto=format&n=Wr2r4IRr97lNQiQb&q=85&s=2496f9106cb54fa9f4e27ad1f8f3a171

The Modem Agent

See what else the agent can do with your connected tools.
https://mintcdn.com/modem-844d7a4a/Wr2r4IRr97lNQiQb/icons/link.svg?fit=max&auto=format&n=Wr2r4IRr97lNQiQb&q=85&s=e774d33588635d44c6c935b78ed55f13

Integrations Overview

All available integrations and how they fit together.