import { CredentialType } from '@bubblelab/shared-schemas'; import { ServiceBubble } from '../../../types/service-bubble-class.js'; import type { BubbleContext } from '../../../types/bubble.js'; import { type PosthogParamsInput, type PosthogResult } from './posthog.schema.js'; /** * PosthogBubble - Integration with PostHog product analytics * * Provides read operations for retrieving analytics data from PostHog: * - List events with filtering by event type, person, and date range * - Execute HogQL queries for custom analytics * - Look up person profiles and properties * - Retrieve saved insight results * * @example * ```typescript * // List recent pageview events * const result = await new PosthogBubble({ * operation: 'list_events', * project_id: '12345', * event: '$pageview', * limit: 50, * }).action(); * * // Execute a HogQL query * const queryResult = await new PosthogBubble({ * operation: 'query', * project_id: '12345', * query: 'SELECT event, count() FROM events GROUP BY event ORDER BY count() DESC LIMIT 10', * }).action(); * * // Look up a person by distinct ID * const person = await new PosthogBubble({ * operation: 'get_person', * project_id: '12345', * distinct_id: 'user_123', * }).action(); * ``` */ export declare class PosthogBubble extends ServiceBubble> { static readonly service = "posthog"; static readonly authType: "apikey"; static readonly bubbleName: "posthog"; static readonly type: "service"; static readonly schema: import("zod").ZodDiscriminatedUnion<"operation", [import("zod").ZodObject<{ operation: import("zod").ZodLiteral<"list_projects">; host: import("zod").ZodDefault>; limit: import("zod").ZodDefault>; credentials: import("zod").ZodOptional, import("zod").ZodString>>; }, "strip", import("zod").ZodTypeAny, { operation: "list_projects"; limit: number; host: string; credentials?: Partial> | undefined; }, { operation: "list_projects"; credentials?: Partial> | undefined; limit?: number | undefined; host?: string | undefined; }>, import("zod").ZodObject<{ operation: import("zod").ZodLiteral<"list_events">; project_id: import("zod").ZodString; host: import("zod").ZodDefault>; event: import("zod").ZodOptional; person_id: import("zod").ZodOptional; distinct_id: import("zod").ZodOptional; after: import("zod").ZodOptional; before: import("zod").ZodOptional; properties: import("zod").ZodOptional; limit: import("zod").ZodDefault>; credentials: import("zod").ZodOptional, import("zod").ZodString>>; }, "strip", import("zod").ZodTypeAny, { operation: "list_events"; limit: number; project_id: string; host: string; properties?: string | undefined; credentials?: Partial> | undefined; event?: string | undefined; person_id?: string | undefined; after?: string | undefined; before?: string | undefined; distinct_id?: string | undefined; }, { operation: "list_events"; project_id: string; properties?: string | undefined; credentials?: Partial> | undefined; limit?: number | undefined; event?: string | undefined; person_id?: string | undefined; after?: string | undefined; before?: string | undefined; host?: string | undefined; distinct_id?: string | undefined; }>, import("zod").ZodObject<{ operation: import("zod").ZodLiteral<"query">; project_id: import("zod").ZodString; host: import("zod").ZodDefault>; query: import("zod").ZodString; credentials: import("zod").ZodOptional, import("zod").ZodString>>; }, "strip", import("zod").ZodTypeAny, { query: string; operation: "query"; project_id: string; host: string; credentials?: Partial> | undefined; }, { query: string; operation: "query"; project_id: string; credentials?: Partial> | undefined; host?: string | undefined; }>, import("zod").ZodObject<{ operation: import("zod").ZodLiteral<"get_person">; project_id: import("zod").ZodString; host: import("zod").ZodDefault>; distinct_id: import("zod").ZodOptional; search: import("zod").ZodOptional; limit: import("zod").ZodDefault>; credentials: import("zod").ZodOptional, import("zod").ZodString>>; }, "strip", import("zod").ZodTypeAny, { operation: "get_person"; limit: number; project_id: string; host: string; credentials?: Partial> | undefined; search?: string | undefined; distinct_id?: string | undefined; }, { operation: "get_person"; project_id: string; credentials?: Partial> | undefined; search?: string | undefined; limit?: number | undefined; host?: string | undefined; distinct_id?: string | undefined; }>, import("zod").ZodObject<{ operation: import("zod").ZodLiteral<"get_insight">; project_id: import("zod").ZodString; host: import("zod").ZodDefault>; insight_id: import("zod").ZodNumber; credentials: import("zod").ZodOptional, import("zod").ZodString>>; }, "strip", import("zod").ZodTypeAny, { operation: "get_insight"; project_id: string; host: string; insight_id: number; credentials?: Partial> | undefined; }, { operation: "get_insight"; project_id: string; insight_id: number; credentials?: Partial> | undefined; host?: string | undefined; }>]>; static readonly resultSchema: import("zod").ZodDiscriminatedUnion<"operation", [import("zod").ZodObject<{ operation: import("zod").ZodLiteral<"list_projects">; success: import("zod").ZodBoolean; projects: import("zod").ZodOptional; name: import("zod").ZodString; organization: import("zod").ZodOptional; created_at: import("zod").ZodOptional; timezone: import("zod").ZodOptional; is_demo: import("zod").ZodOptional; }, "strip", import("zod").ZodTypeAny, { name: string; id: number; uuid?: string | undefined; created_at?: string | undefined; timezone?: string | undefined; organization?: string | undefined; is_demo?: boolean | undefined; }, { name: string; id: number; uuid?: string | undefined; created_at?: string | undefined; timezone?: string | undefined; organization?: string | undefined; is_demo?: boolean | undefined; }>, "many">>; next: import("zod").ZodNullable>; error: import("zod").ZodString; }, "strip", import("zod").ZodTypeAny, { error: string; success: boolean; operation: "list_projects"; projects?: { name: string; id: number; uuid?: string | undefined; created_at?: string | undefined; timezone?: string | undefined; organization?: string | undefined; is_demo?: boolean | undefined; }[] | undefined; next?: string | null | undefined; }, { error: string; success: boolean; operation: "list_projects"; projects?: { name: string; id: number; uuid?: string | undefined; created_at?: string | undefined; timezone?: string | undefined; organization?: string | undefined; is_demo?: boolean | undefined; }[] | undefined; next?: string | null | undefined; }>, import("zod").ZodObject<{ operation: import("zod").ZodLiteral<"list_events">; success: import("zod").ZodBoolean; events: import("zod").ZodOptional; uuid: import("zod").ZodOptional; event: import("zod").ZodString; distinct_id: import("zod").ZodString; properties: import("zod").ZodOptional>; timestamp: import("zod").ZodOptional; created_at: import("zod").ZodOptional; elements: import("zod").ZodOptional>; elements_chain: import("zod").ZodOptional; }, "strip", import("zod").ZodTypeAny, { event: string; distinct_id: string; properties?: Record | undefined; id?: string | undefined; uuid?: string | undefined; elements?: unknown[] | undefined; timestamp?: string | undefined; created_at?: string | undefined; elements_chain?: string | undefined; }, { event: string; distinct_id: string; properties?: Record | undefined; id?: string | undefined; uuid?: string | undefined; elements?: unknown[] | undefined; timestamp?: string | undefined; created_at?: string | undefined; elements_chain?: string | undefined; }>, "many">>; next: import("zod").ZodNullable>; error: import("zod").ZodString; }, "strip", import("zod").ZodTypeAny, { error: string; success: boolean; operation: "list_events"; events?: { event: string; distinct_id: string; properties?: Record | undefined; id?: string | undefined; uuid?: string | undefined; elements?: unknown[] | undefined; timestamp?: string | undefined; created_at?: string | undefined; elements_chain?: string | undefined; }[] | undefined; next?: string | null | undefined; }, { error: string; success: boolean; operation: "list_events"; events?: { event: string; distinct_id: string; properties?: Record | undefined; id?: string | undefined; uuid?: string | undefined; elements?: unknown[] | undefined; timestamp?: string | undefined; created_at?: string | undefined; elements_chain?: string | undefined; }[] | undefined; next?: string | null | undefined; }>, import("zod").ZodObject<{ operation: import("zod").ZodLiteral<"query">; success: import("zod").ZodBoolean; columns: import("zod").ZodOptional>; results: import("zod").ZodOptional, "many">>; types: import("zod").ZodOptional]>, "many">>; hasMore: import("zod").ZodOptional>; error: import("zod").ZodString; }, "strip", import("zod").ZodTypeAny, { error: string; success: boolean; operation: "query"; types?: (string | string[])[] | undefined; hasMore?: boolean | null | undefined; results?: unknown[][] | undefined; columns?: string[] | undefined; }, { error: string; success: boolean; operation: "query"; types?: (string | string[])[] | undefined; hasMore?: boolean | null | undefined; results?: unknown[][] | undefined; columns?: string[] | undefined; }>, import("zod").ZodObject<{ operation: import("zod").ZodLiteral<"get_person">; success: import("zod").ZodBoolean; persons: import("zod").ZodOptional; distinct_ids: import("zod").ZodArray; properties: import("zod").ZodOptional>; created_at: import("zod").ZodOptional; }, "strip", import("zod").ZodTypeAny, { id: string; distinct_ids: string[]; properties?: Record | undefined; uuid?: string | undefined; created_at?: string | undefined; }, { id: string; distinct_ids: string[]; properties?: Record | undefined; uuid?: string | undefined; created_at?: string | undefined; }>, "many">>; next: import("zod").ZodNullable>; error: import("zod").ZodString; }, "strip", import("zod").ZodTypeAny, { error: string; success: boolean; operation: "get_person"; next?: string | null | undefined; persons?: { id: string; distinct_ids: string[]; properties?: Record | undefined; uuid?: string | undefined; created_at?: string | undefined; }[] | undefined; }, { error: string; success: boolean; operation: "get_person"; next?: string | null | undefined; persons?: { id: string; distinct_ids: string[]; properties?: Record | undefined; uuid?: string | undefined; created_at?: string | undefined; }[] | undefined; }>, import("zod").ZodObject<{ operation: import("zod").ZodLiteral<"get_insight">; success: import("zod").ZodBoolean; insight: import("zod").ZodOptional; name: import("zod").ZodNullable>; description: import("zod").ZodNullable>; result: import("zod").ZodOptional; filters: import("zod").ZodOptional>; created_at: import("zod").ZodOptional; last_refresh: import("zod").ZodNullable>; last_modified_at: import("zod").ZodOptional; }, "strip", import("zod").ZodTypeAny, { id: number; result?: unknown; description?: string | null | undefined; name?: string | null | undefined; created_at?: string | undefined; filters?: Record | undefined; short_id?: string | undefined; last_refresh?: string | null | undefined; last_modified_at?: string | undefined; }, { id: number; result?: unknown; description?: string | null | undefined; name?: string | null | undefined; created_at?: string | undefined; filters?: Record | undefined; short_id?: string | undefined; last_refresh?: string | null | undefined; last_modified_at?: string | undefined; }>>; error: import("zod").ZodString; }, "strip", import("zod").ZodTypeAny, { error: string; success: boolean; operation: "get_insight"; insight?: { id: number; result?: unknown; description?: string | null | undefined; name?: string | null | undefined; created_at?: string | undefined; filters?: Record | undefined; short_id?: string | undefined; last_refresh?: string | null | undefined; last_modified_at?: string | undefined; } | undefined; }, { error: string; success: boolean; operation: "get_insight"; insight?: { id: number; result?: unknown; description?: string | null | undefined; name?: string | null | undefined; created_at?: string | undefined; filters?: Record | undefined; short_id?: string | undefined; last_refresh?: string | null | undefined; last_modified_at?: string | undefined; } | undefined; }>]>; static readonly shortDescription = "PostHog product analytics for events, persons, and insights"; static readonly longDescription = "\n PostHog is an open-source product analytics platform.\n This bubble provides read operations for retrieving analytics data:\n - List and filter captured events (pageviews, custom events, etc.)\n - Execute HogQL queries for advanced custom analytics\n - Look up person profiles and their properties\n - Retrieve saved insight results\n\n Authentication:\n - Uses a Personal API Key via Bearer token\n - Supports US Cloud, EU Cloud, and self-hosted instances via configurable host URL\n\n Use Cases:\n - Pull analytics data into automated workflows\n - Query event data with HogQL for custom reports\n - Look up user profiles and their properties\n - Retrieve computed insight results for dashboards\n "; static readonly alias = "posthog-analytics"; constructor(params?: T, context?: BubbleContext); /** * Choose the appropriate credential for PostHog API */ protected chooseCredential(): string | undefined; /** * Test if the credential is valid by listing projects */ testCredential(): Promise; /** * Perform the PostHog operation */ protected performAction(context?: BubbleContext): Promise>; /** * Make an authenticated GET request to the PostHog API */ private makePosthogGetRequest; /** * Make an authenticated POST request to the PostHog API */ private makePosthogPostRequest; /** * List all projects accessible with the API key */ private listProjects; /** * List events with optional filtering */ private listEvents; /** * Execute a HogQL query */ private executeQuery; /** * Get person profiles */ private getPerson; /** * Get a saved insight's results */ private getInsight; } //# sourceMappingURL=posthog.d.ts.map