> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stackone.com/llms.txt
> Use this file to discover all available pages before exploring further.

# PostHog Webhook Setup Guide

> Configure PostHog to deliver events to StackOne.

## Prerequisites

Before continuing, you should have already completed the following for this connector:

<Steps>
  <Step title="Configure the Connector">
    Enable the connector and set up its connector profile in your project. See <a href="/guides/explore-connectors">Managing Connectors</a>.

    <Columns cols={2}>
      <Card title="Connector Profile" href="/connectors/posthog/guides/connector-profile/api-key" icon="https://stackone-logos.com/api/posthog/filled/png" horizontal>
        PostHog - API Key
      </Card>
    </Columns>
  </Step>

  <Step title="Link an Account">
    Connect an account using <a href="/guides/embedding-stackone-hub">StackOne Hub</a> or <a href="/guides/auth-link">Auth Link</a>.

    <Columns cols={2}>
      <Card title="Link Account" href="/connectors/posthog/guides/link-account/api-key" icon="https://stackone-logos.com/api/posthog/filled/png" horizontal>
        PostHog - API Key
      </Card>
    </Columns>
  </Step>
</Steps>

<section data-guide-section data-guide-scopes="">
  <h2>Setting Up PostHog Webhook Destination</h2>

  <p>To receive real-time PostHog event notifications (e.g., page views, user sign-ups, feature flag evaluations), you need to configure a webhook destination in PostHog.</p>

  <Steps>
    <Step title="Copy the Native Webhook URL from StackOne">
      <div data-guide-step data-guide-scopes="" data-guide-display-scopes-list="">
        <p>The <strong>Native Webhook URL</strong> is available on the <strong>Link Account</strong> form or by editing the linked account in the <strong>StackOne Hub</strong>.</p>

        <ul>
          <li>Copy the full URL and keep it ready for the next step</li>
        </ul>
      </div>
    </Step>

    <Step title="Create a Webhook Destination in PostHog">
      <div data-guide-step data-guide-scopes="" data-guide-display-scopes-list="">
        <p>In PostHog, navigate to <strong>Data</strong> > <strong>Pipelines</strong> > <strong>Destinations</strong> > <strong>+ New Destination</strong> > search <strong>HTTP Webhook</strong> > <strong>+ Create</strong>.</p>
      </div>
    </Step>

    <Step title="Configure the Webhook">
      <div data-guide-step data-guide-scopes="" data-guide-display-scopes-list="">
        <p>Configure the destination with the following settings.</p>

        <ul>
          <li>Paste the <strong>Native Webhook URL</strong> into the <strong>Webhook URL</strong> field</li>
          <li>Method: <code>POST</code> (default)</li>
          <li>In <strong>Headers</strong>, click <strong>+ Add entry</strong> and set key <code>x-posthog-project-token</code> with your <strong>Project Token</strong> value (format: <code>phc\_xxxxxxxxxxxxxxxxxxxxxxxxxxxx</code>)</li>
          <li>Keep the default <strong>JSON Body</strong>: <code>\{"event": "\{event}", "person": "\{person}"}</code> — do not modify this</li>
        </ul>
      </div>
    </Step>

    <Step title="Configure Event Filters">
      <div data-guide-step data-guide-scopes="" data-guide-display-scopes-list="">
        <p>Add filters to control which events are sent. Without filters, PostHog sends all events.</p>

        <ul>
          <li>In <strong>Filters</strong>, click <strong>Add filter</strong> or <strong>Match event</strong></li>
          <li>Add event names to forward: <code>$identify</code>, <code>$pageview</code>, <code>$feature_flag_called</code>, <code>$exception</code>, or custom events like <code>user\_signed\_up</code>. Check next step to create custom events in PostHog.</li>
          <li>To send all events, leave filters empty</li>
        </ul>
      </div>
    </Step>

    <Step title="Custom Events">
      <div data-guide-step data-guide-scopes="" data-guide-display-scopes-list="">
        <p>Custom events are created automatically in PostHog when first captured. You can create them using StackOne's <strong>capture\_event</strong> action or the PostHog SDK.</p>

        <ul>
          <li>Use StackOne's <code>capture\_event</code> action to send a custom event to PostHog — the event will be auto-created on first capture</li>
          <li>Add the exact event name to your webhook filter — names are case-sensitive (e.g., <code>user\_signed\_up</code> and <code>User\_Signed\_Up</code> are treated as different events)</li>
        </ul>
      </div>
    </Step>

    <Step title="Save and Test">
      <div data-guide-step data-guide-scopes="" data-guide-display-scopes-list="">
        <p>Click <strong>Create & Enable</strong> to activate. To test, use the <strong>Testing</strong> section in the destination page.</p>

        <ul>
          <li>If test shows <strong>"Destination was skipped"</strong>, this means the sample event didn't match your filters. You can temporarily remove the applied filters to test connectivity, then re-add them.</li>
          <li>Check the <strong>Logs</strong> tab for <code>200 OK</code> responses</li>
        </ul>
      </div>
    </Step>
  </Steps>
</section>

<section data-guide-section data-guide-scopes="">
  <h2>Supported Event Types</h2>

  <p>System events with dedicated handlers, plus a catch-all for custom events.</p>

  <Steps>
    <Step title="System Events">
      <div data-guide-step data-guide-scopes="" data-guide-display-scopes-list="">
        <p>PostHog system events are prefixed with <code>$</code>. To find and add them in your webhook destination, go to the <strong>Filters</strong> section, click <strong>Add filter</strong>, and type <code>$</code> to search available system events by name.</p>

        <ul>
          <li><code>$pageview</code> — Page view (web)</li>   <li><code>$pageleave</code> — Page leave (web)</li>
          <li><code>$screen</code> — Screen view (mobile)</li>   <li><code>$identify</code> — User identified</li>
          <li><code>$set</code> — Person properties set</li>   <li><code>$feature\_flag\_called</code> — Feature flag evaluated</li>
          <li><code>$autocapture</code> — Auto-captured interaction</li>   <li><code>$group</code> — Group event</li>
          <li><code>$groupidentify</code> — Group identified</li>   <li><code>$exception</code> — Error tracked</li>
        </ul>
      </div>
    </Step>

    <Step title="Custom Events">
      <div data-guide-step data-guide-scopes="" data-guide-display-scopes-list="">
        <p>Any non-system event is handled by the catch-all handler. The original event name is preserved.</p>
      </div>
    </Step>
  </Steps>
</section>

<section data-guide-section data-guide-scopes="">
  <h2>Troubleshooting</h2>

  <p>If events are not appearing after setup, use the steps below to diagnose the issue.</p>

  <Steps>
    <Step title="Common Issues">
      <div data-guide-step data-guide-scopes="" data-guide-display-scopes-list="">
        <p>Check the following common problems and their solutions.</p>

        <ul>
          <li><strong>No events:</strong> Verify destination is enabled under Status widget in destination configuration page.</li>
          <li><strong>404:</strong> Native Webhook URL is incorrect — re-copy from StackOne Hub</li>
          <li><strong>401/403:</strong> Linked account may not be fully configured</li>
          <li><strong>Events filtered out:</strong> Check filter list includes expected events</li>
          <li><strong>Wrong payload:</strong> Reset JSON body to default <code>\{"event": "\{event}", "person": "\{person}"}</code></li>
        </ul>
      </div>
    </Step>
  </Steps>
</section>

## Verify

Your Connector should now be able to receive and process events. Try triggering an event and you should see an Event appear in the Connector logs.
