Agent skill

Posthog Webhooks Events

by jeremylongshore in jeremylongshore/tons-of-skills-marketplace

Build and verify PostHog realtime webhook destinations and bounded private-API or HogQL event queries.

MITAuto-check passedBackend & APIs

Install Posthog Webhooks Events

skills CLI
$ npx skills add jeremylongshore/tons-of-skills-marketplace --skill posthog-webhooks-events -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install jeremylongshore/tons-of-skills-marketplace posthog-webhooks-events --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/jeremylongshore/tons-of-skills-marketplace.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/.curated/posthog-webhooks-events .claude/skills/posthog-webhooks-events && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
posthog-webhooks-events
GitHub stars
2.8k
Token cost
~2.2k tokens
SKILL.md length
357 words
Files
4 (incl. references)
Skills in repo
3,342
Repo updated
First seen
Licence
MIT

At a glance

Build and verify PostHog realtime webhook destinations and bounded private-API or HogQL event queries.

  • Works in 5 steps: Create a Webhook Destination via API → Receive and Process Webhooks → Query Events via the API → …
  • Delivering selected events to another system
  • SKILL.md covers Overview, Prerequisites, Instructions and Error Handling, plus 4 more sections
  • Calls curl and jq; reaches us.posthog.com and api.hubspot.com; needs POSTHOG_PERSONAL_API_KEY and WEBHOOK_SECRET

What it does

Posthog Webhooks Events is an agent skill from jeremylongshore/tons-of-skills-marketplace. Build and verify PostHog realtime webhook destinations and bounded private-API or HogQL event queries. Use when delivering selected events to another system or investigating event data. Trigger with "PostHog webhook", "PostHog destination", or "PostHog HogQL query".

Its SKILL.md is about 2.2k tokens, which your agent loads only when the skill is triggered. The skill folder holds 4 other files, including reference files (for example `references/implementation-guide.md`, `references/implementation.md` and `references/official-docs.md`). Compatibility notes: Designed for Claude Code

It sits in Backend & APIs, covering Webhooks. It works with PostHog and Slack. The repository describes itself as: Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com. The licence is MIT.

When your agent uses it

  • Delivering selected events to another system
  • Investigating event data
  • With PostHog webhook
  • PostHog destination

Example prompts

  • “PostHog webhook”
  • “PostHog destination”
  • “PostHog HogQL query”
  • “/posthog-webhooks-events”

Requirements

  • A credential in POSTHOG_PERSONAL_API_KEY
  • A credential in WEBHOOK_SECRET
  • Compatibility (from SKILL.md): Designed for Claude Code
  • Pre-approved tools (allowed-tools): Read, Write, Edit, Bash(curl:*)

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. Create a Webhook Destination via API
  2. Receive and Process Webhooks
  3. Query Events via the API
  4. Query Events with HogQL
  5. Set Up Slack Webhook Destination (UI)

What it can do on your machine

Read from SKILL.md and the folder at commit cfae287. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Write
    • Edit
    • Bash(curl:*)

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • curl
    • jq

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • us.posthog.com
    • api.hubspot.com

    Also links to:

    • posthog.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • POSTHOG_PERSONAL_API_KEY
    • WEBHOOK_SECRET
    • POSTHOG_WEBHOOK_SECRET
    • HUBSPOT_KEY

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Designed for Claude Code

    From compatibility in the SKILL.md frontmatter.

Context cost

Posthog Webhooks Events loads about 2.2k tokens when it runs, and up to ~3.6k if it reads all its reference files. Until then it costs about 73 tokens; SKILL.md has 357 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~73
When it runs · the whole SKILL.md, loaded when a task matches
~2.2k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~3.6k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from jeremylongshore/tons-of-skills-marketplace at commit cfae287, republished under its MIT licence (© jeremylongshore). 357 words, ~2,204 tokens.

Download SKILL.mdSave it as .claude/skills/posthog-webhooks-events/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.
name
posthog-webhooks-events
description
Build and verify PostHog realtime webhook destinations and bounded private-API or HogQL event queries. Use when delivering selected events to another system or investigating event data. Trigger with "PostHog webhook", "PostHog destination", or "PostHog HogQL query".
allowed-tools
Read, Write, Edit, Bash(curl:*)
compatibility
Designed for Claude Code
argument-hint
[project] [destination-or-query]
version
1.14.0
license
MIT
author
Jeremy Longshore <jeremy@intentsolutions.io>
tags
saas, posthog, webhooks

PostHog Webhooks & Events

Overview

PostHog sends webhooks via its CDP (Customer Data Platform) Destinations feature. You configure a Destination that fires when matching events are captured, sending an HTTP POST to your endpoint. This skill covers webhook destination setup, receiving and processing webhook payloads, querying events via the API, and using HogQL for custom event analysis.

Prerequisites

  • PostHog project with personal API key (phx_...)
  • HTTPS endpoint to receive webhooks
  • Events being captured in PostHog

Instructions

Tool discipline

Use Read to inspect the relevant configuration and implementation before proposing changes. Use Write only for a new, explicitly requested artifact inside the target project. Use Edit for minimal changes to existing project files after the evidence pass.

Step 1: Create a Webhook Destination via API
bash
set -euo pipefail
# Create a webhook destination that fires on specific events
curl -X POST "https://us.posthog.com/api/projects/$POSTHOG_PROJECT_ID/pipeline_destinations/" \
  -H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Signup Notifications",
    "description": "Send webhook when user signs up",
    "config": {
      "url": "https://your-app.com/webhooks/posthog",
      "method": "POST",
      "headers": {
        "X-Webhook-Secret": "your-webhook-secret"
      },
      "body": {
        "event": "{event}",
        "distinct_id": "{distinct_id}",
        "person": "{person}",
        "properties": "{properties}",
        "timestamp": "{timestamp}"
      }
    },
    "filters": {
      "events": [
        {"id": "user_signed_up", "type": "events"},
        {"id": "subscription_started", "type": "events"}
      ]
    }
  }'
Step 2: Receive and Process Webhooks
typescript
// api/webhooks/posthog.ts
import { NextResponse } from 'next/server';
import crypto from 'crypto';

const WEBHOOK_SECRET = process.env.POSTHOG_WEBHOOK_SECRET!;

// Verify webhook authenticity
function verifySignature(payload: string, signature: string): boolean {
  const expected = crypto.createHmac('sha256', WEBHOOK_SECRET)
    .update(payload)
    .digest('hex');
  return crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(expected));
}

interface PostHogWebhookPayload {
  event: string;
  distinct_id: string;
  properties: Record<string, any>;
  person: {
    properties: Record<string, any>;
  };
  timestamp: string;
}

export async function POST(request: Request) {
  const body = await request.text();
  const signature = request.headers.get('x-webhook-secret') || '';

  // Verify webhook is from PostHog
  if (WEBHOOK_SECRET && signature !== WEBHOOK_SECRET) {
    return NextResponse.json({ error: 'Invalid signature' }, { status: 401 });
  }

  const payload: PostHogWebhookPayload = JSON.parse(body);

  // Route to handlers based on event type
  switch (payload.event) {
    case 'user_signed_up':
      await onUserSignup(payload);
      break;
    case 'subscription_started':
      await onSubscriptionStarted(payload);
      break;
    case 'subscription_canceled':
      await onSubscriptionCanceled(payload);
      break;
    default:
      console.log(`Unhandled PostHog event: ${payload.event}`);
  }

  return NextResponse.json({ received: true });
}

async function onUserSignup(payload: PostHogWebhookPayload) {
  const { distinct_id, properties, person } = payload;
  console.log(`New signup: ${distinct_id}`);

  // Sync to CRM
  await fetch('https://api.hubspot.com/contacts/v1/contact/', {
    method: 'POST',
    headers: { Authorization: `Bearer ${process.env.HUBSPOT_KEY}` },
    body: JSON.stringify({
      properties: [
        { property: 'email', value: person.properties.email },
        { property: 'posthog_id', value: distinct_id },
      ],
    }),
  });

  // Notify Slack
  await fetch(process.env.SLACK_WEBHOOK_URL!, {
    method: 'POST',
    body: JSON.stringify({
      text: `New signup: ${person.properties.email || distinct_id} (${properties.source || 'unknown'})`,
    }),
  });
}

async function onSubscriptionStarted(payload: PostHogWebhookPayload) {
  console.log(`New subscription: ${payload.distinct_id}, plan: ${payload.properties.plan}`);
}

async function onSubscriptionCanceled(payload: PostHogWebhookPayload) {
  console.log(`Cancellation: ${payload.distinct_id}`);
}
Step 3: Query Events via the API
bash
set -euo pipefail
# List recent events by type
curl "https://us.posthog.com/api/projects/$POSTHOG_PROJECT_ID/events/?event=user_signed_up&limit=10&orderBy=-timestamp" \
  -H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" | \
  jq '.results[] | {
    distinct_id,
    event,
    timestamp,
    properties: (.properties | {source, plan, referrer: ."$referrer"})
  }'

# Get events for a specific person
curl "https://us.posthog.com/api/projects/$POSTHOG_PROJECT_ID/events/?distinct_id=user-123&limit=20" \
  -H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" | \
  jq '.results[] | {event, timestamp}'
Step 4: Query Events with HogQL
typescript
// Complex event analysis with HogQL (PostHog's SQL dialect)
async function queryPostHog(hogql: string) {
  const response = await fetch(
    `https://us.posthog.com/api/projects/${process.env.POSTHOG_PROJECT_ID}/query/`,
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        Authorization: `Bearer ${process.env.POSTHOG_PERSONAL_API_KEY}`,
      },
      body: JSON.stringify({
        query: { kind: 'HogQLQuery', query: hogql },
      }),
    }
  );
  return response.json();
}

// Example: Signup funnel analysis
const funnelData = await queryPostHog(`
  SELECT
    properties.$referrer AS referrer,
    count() AS signups,
    uniq(distinct_id) AS unique_users
  FROM events
  WHERE event = 'user_signed_up'
    AND timestamp > now() - interval 30 day
  GROUP BY referrer
  ORDER BY signups DESC
  LIMIT 20
`);

// Example: Feature adoption by plan
const adoptionData = await queryPostHog(`
  SELECT
    person.properties.plan AS plan,
    properties.feature_name AS feature,
    count() AS usage_count,
    uniq(distinct_id) AS unique_users
  FROM events
  WHERE event = 'feature_used'
    AND timestamp > now() - interval 7 day
  GROUP BY plan, feature
  ORDER BY usage_count DESC
  LIMIT 50
`);
Step 5: Set Up Slack Webhook Destination (UI)

PostHog has built-in Slack integration via Data Pipelines > Destinations:

  1. Go to Data Pipelines > Destinations > New Destination
  2. Select "Slack" or "Webhook"
  3. Configure event filters (which events trigger the notification)
  4. Set the webhook URL and message template
  5. Test with a sample event
Show full SKILL.md (162 more words)Show less

Error Handling

IssueCauseSolution
Webhook not firingNo matching destination filterCheck event name matches filter exactly
Duplicate webhooksEvent matches multiple destinationsNarrow destination filters
Webhook timeoutHandler too slowAcknowledge with 200 immediately, process async
HogQL query timeoutUnfiltered table scanAdd timestamp > filter and LIMIT
429 on events APIToo many queriesCache results, reduce polling frequency

Output

  • Webhook destination configured for specific events
  • Express/Next.js webhook handler with event routing
  • Event queries via REST API and HogQL
  • Slack/CRM integration on user lifecycle events

Examples

For a webhook destination, define the filtered event set, minimal payload, receiver authentication, idempotency key, retry behavior, and response logging; then use the built-in test flow before enabling it. For queries, use the regional private API with a scoped credential and a bounded time range.

Resources

See official PostHog references for current authority and verification boundaries.

Next Steps

For deployment setup, see posthog-deploy-integration.

© jeremylongshore, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 3 other files (references) in skills/.curated/posthog-webhooks-events of jeremylongshore/tons-of-skills-marketplace.

  • SKILL.md
  • references/implementation-guide.md
  • references/implementation.md
  • references/official-docs.md

Open the folder on GitHubat commit cfae287

Compare with similar skills

Posthog Webhooks Events next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Posthog Webhooks Events compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Posthog Webhooks Events this skilljeremylongshore/tons-of-skills-marketplace2.8k—~2.2kAutomated safety check: PassMIT
Authoring Error Tracking AlertsPostHog/posthog40k—~2.8kAutomated safety check: PassCustom licence
Channel Debug Corevercel-labs/vercel-openclaw-archived117—~2kAutomated safety check: NotesMIT
Frontmcp Channelsagentfront/frontmcp146—~3.7kAutomated safety check: PassApache-2.0
Add OAuth Integrationrome-os/rome748—~3.6kAutomated safety check: PassMIT
Chat SDK Botslobehub/lobehub83k—~1.5kAutomated safety check: PassCustom licence

Similar skills

  • Official

    Author error tracking alerts that fire when an issue is created, reopened, or starts spiking.

    40k GitHub stars~2.8k tokensUpdated yesterday
    Backend & APIsAuto-check passed
  • Channel Debug Core

    vercel-labs/vercel-openclaw-archived

    Official

    Channel webhook triage for vercel-openclaw Slack/Telegram/Discord/WhatsApp issues: prove deployment state, collect admin readiness endpoints, build evidence-first handoff before fixes.

    117 GitHub stars~2k tokensUpdated 4 mo ago
    Backend & APIsAuto-check: notes
  • Frontmcp Channels

    agentfront/frontmcp

    A skill your agent uses when pushing real-time notifications or events into Claude Code (or another MCP client) sessions, or building two-way chat bridges.

    146 GitHub stars~3.7k tokensUpdated today
    Backend & APIsAuto-check passed
  • Add a new Rome-managed OAuth integration for a third-party service so a user can delegate access by clicking Connect, and Rome can act on the service with the delegated token (the GitHub/Slack model…

    748 GitHub stars~3.6k tokensUpdated today
    Backend & APIsAuto-check passed
  • Chat SDK Bots

    lobehub/lobehub

    Builds chat bots once for Slack, Teams, Google Chat, Discord, GitHub and Linear with the Chat SDK, covering event handlers, cards, modals, streaming and state adapters.

    83k GitHub stars~1.5k tokensUpdated today
    Backend & APIsAuto-check passed
  • Workspace API

    friday-platform/friday-studio

    Create, list, update, delete, and clean up workspaces via the daemon HTTP API at $FRIDAYDURL.

    104 GitHub stars~9.3k tokensUpdated 1 mo ago
    Backend & APIsAuto-check: notes

More from jeremylongshore/tons-of-skills-marketplace

All 3,342 skills in this repo
  • Performing Security Code Review

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to conduct a security-focused code review using the security-agent plugin.

    2.8k GitHub starsUsed in 2 repos~1.3k tokens
    Auto-check: notes
  • Adapting Transfer Learning Models

    jeremylongshore/tons-of-skills-marketplace

    Build this skill automates the adaptation of pre-trained machine learning models using transfer learning techniques.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Agent Context Loader

    jeremylongshore/tons-of-skills-marketplace

    Execute proactive auto-loading: automatically detects and loads agents.md files.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Aggregating Performance Metrics

    jeremylongshore/tons-of-skills-marketplace

    Aggregate and centralize performance metrics from applications, systems, databases, caches, and services.

    2.8k GitHub stars~1.2k tokensUpdated today
    Auto-check passed
  • Analyzing Capacity Planning

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to analyze capacity requirements and plan for future growth.

    2.8k GitHub stars~947 tokensUpdated today
    Auto-check passed
  • Analyzing Database Indexes

    jeremylongshore/tons-of-skills-marketplace

    Process use when you need to work with database indexing. An agent skill from jeremylongshore/tons-of-skills-marketplace.

    2.8k GitHub stars~2k tokensUpdated today
    Auto-check passed

Works with

Categories

Questions about Posthog Webhooks Events

What does Posthog Webhooks Events do?

Build and verify PostHog realtime webhook destinations and bounded private-API or HogQL event queries. Posthog Webhooks Events is an agent skill from jeremylongshore/tons-of-skills-marketplace. Build and verify PostHog realtime webhook destinations and bounded private-API or HogQL event queries.

When should I use Posthog Webhooks Events?

Posthog Webhooks Events fits situations like: delivering selected events to another system; investigating event data; with PostHog webhook; postHog destination.

How do I install Posthog Webhooks Events in Claude Code?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill posthog-webhooks-events -a claude-code`. Or copy the skill folder (skills/.curated/posthog-webhooks-events in jeremylongshore/tons-of-skills-marketplace) into .claude/skills/posthog-webhooks-events in your project. Claude Code loads it when a task matches its description.

How do I install Posthog Webhooks Events in Codex?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill posthog-webhooks-events -a codex`. Or copy the skill folder (skills/.curated/posthog-webhooks-events in jeremylongshore/tons-of-skills-marketplace) into .agents/skills/posthog-webhooks-events in your project. Codex loads it when a task matches its description.

Can I use Posthog Webhooks Events in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill posthog-webhooks-events -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/posthog-webhooks-events, .gemini/skills/posthog-webhooks-events, .github/skills/posthog-webhooks-events and .opencode/skills/posthog-webhooks-events in your project.

What does Posthog Webhooks Events need to run?

Going by SKILL.md and its folder, Posthog Webhooks Events needs the command-line tools its instructions call (curl and jq) and credentials named POSTHOG_PERSONAL_API_KEY, WEBHOOK_SECRET, POSTHOG_WEBHOOK_SECRET and HUBSPOT_KEY. Our summary lists: A credential in POSTHOG_PERSONAL_API_KEY; A credential in WEBHOOK_SECRET. Its frontmatter pre-approves these tools: Read, Write, Edit, Bash(curl:*). Compatibility (from SKILL.md): Designed for Claude Code.

Does Posthog Webhooks Events access the network?

SKILL.md names 3 domains. In commands or code: us.posthog.com and api.hubspot.com; the agent is likely to contact these when it follows the instructions. As links in the text: posthog.com. This is read from the text; nothing was executed.

Is Posthog Webhooks Events safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Posthog Webhooks Events use?

Posthog Webhooks Events is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Posthog Webhooks Events use?

About 2.2k tokens (SKILL.md is roughly 8.8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 1.4k tokens, read only when the agent opens those files.

What are the alternatives to Posthog Webhooks Events?

Skills that share tags, products or a category with Posthog Webhooks Events: Authoring Error Tracking Alerts (PostHog/posthog, 40k stars), Channel Debug Core (vercel-labs/vercel-openclaw-archived, 117 stars), Frontmcp Channels (agentfront/frontmcp, 146 stars) and Add OAuth Integration (rome-os/rome, 748 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Posthog Webhooks Events?

jeremylongshore (a GitHub user) maintains it in jeremylongshore/tons-of-skills-marketplace, which has 2,827 GitHub stars. The repository holds 3,342 skills in this directory. The repository was last updated on October 10, 2026.

Source: jeremylongshore/tons-of-skills-marketplace on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.