View as Markdown
PostHog icon

PostHog ACTION

Capture Event

Captures a given event within the PostHog system. See the documentation
  • Action
  • Writes data
  • API key
  • SDK
  • MCP

IMPLEMENTATION

Call this tool

Connect a user's PostHog account once, then configure and run Capture Event from your backend or agent.

import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "posthog-capture-event",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    posthog: { authProvisionId: "apn_xxxxxxx" },
    projectApiKey: "Project API Key",
    organizationId: "Organization ID",
  },
})

console.log(result)

SCHEMA

Inputs

Pipedream supplies the connected account. Your application provides the operation-specific values below. Dynamic inputs are resolved against that user's account.

Capture Event inputs
Property Type Description
projectApiKey Project API Key string
The Project API Key in your Project Settings. This key can only create new events. It can't read events or any of your other data stored with PostHog, so it's safe to use in public apps.
Required
organizationId Organization ID string
Identifier of an organization
Required Dynamic
projectId Project ID string
Identifier of a project
Required Dynamic
event Event string
The event type to capture
Required Dynamic
properties Properties object
The properties to include in the event
Optional

REFERENCE

Tool details

Behavior hints are published with the component in the Pipedream registry and surface as MCP tool annotations, so an agent can reason about a tool before it calls it.

Registry key
posthog-capture-event
Version
0.0.6
App
PostHog
Authentication
API key
Read-only
No
Destructive
No
Open world
Yes