Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

12.4 KB
Raw Blame
import { DESTINATION_PLUGINS, TRANSFORMATION_PLUGINS } from '../legacy-plugins'
import { SEGMENT_DESTINATIONS } from '../segment/segment-templates'
import { HogFunctionTemplate, NativeTemplate } from '../types'
import { template as accoilTemplate } from './_destinations/accoil/accoil.template'
import { template as appcuesTemplate } from './_destinations/appcues/appcues.template'
import { template as beehiivTemplate } from './_destinations/beehiiv/beehiiv.template'
import { template as clickupTemplate } from './_destinations/clickup/clickup.template'
import { template as closeTemplate } from './_destinations/close/close.template'
import { allComingSoonTemplates } from './_destinations/coming-soon/coming-soon-destinations.template'
import { template as emailTemplate } from './_destinations/email/email.template'
import { template as githubTemplate } from './_destinations/github/github.template'
import { template as gitlabTemplate } from './_destinations/gitlab/gitlab.template'
import { template as googleTagManagerTemplate } from './_destinations/google-tag-manager/google-tag-manager.template'
import { template as googleAdsTemplate } from './_destinations/google_ads/google.template'
import { template as googleSheetsTemplate } from './_destinations/google_sheets/google_sheets.template'
import { template as hubspotCompanyTemplate } from './_destinations/hubspot/hubspot.template'
import { template as klimeTemplate } from './_destinations/klime/klime.template'
import { template as linearTemplate } from './_destinations/linear/linear.template'
import { template as linkedinAdsTemplate } from './_destinations/linkedin_ads/linkedin.template'
import { template as metaAdsTemplate } from './_destinations/meta_ads/meta.template'
import { template as microsoftAdsTemplate } from './_destinations/microsoft_ads/microsoft.template'
import { template as nativeWebhookTemplate } from './_destinations/native_webhook/webhook.template'
import { template as openaiAdsTemplate } from './_destinations/openai_ads/openai.template'
import { template as pagerdutyTemplate } from './_destinations/pagerduty/pagerduty.template'
import { template as pinterestAdsTemplate } from './_destinations/pinterest_ads/pinterest.template'
import { template as posthogCaptureTemplate } from './_destinations/posthog_capture/posthog-capture.template'
import { template as posthogGroupIdentifyTemplate } from './_destinations/posthog_capture/posthog-group-identify.template'
import { template as posthogUpdatePersonPropertiesTemplate } from './_destinations/posthog_capture/posthog-update-person-properties.template'
import { template as posthogGetTicketTemplate } from './_destinations/posthog_conversations/posthog-get-ticket.template'
import { template as posthogSendTicketMessageTemplate } from './_destinations/posthog_conversations/posthog-send-ticket-message.template'
import { template as posthogUpdateTicketTemplate } from './_destinations/posthog_conversations/posthog-update-ticket.template'
import { template as posthogCreateAccountTemplate } from './_destinations/posthog_customer_analytics/posthog-create-account.template'
import { template as posthogCreateCustomerTaskTemplate } from './_destinations/posthog_customer_analytics/posthog-create-customer-task.template'
import { template as posthogGetAccountTemplate } from './_destinations/posthog_customer_analytics/posthog-get-account.template'
import { template as posthogTagAccountTemplate } from './_destinations/posthog_customer_analytics/posthog-tag-account.template'
import { template as posthogUpdateAccountPropertyTemplate } from './_destinations/posthog_customer_analytics/posthog-update-account-property.template'
import { template as posthogUpdateAccountRelationshipsTemplate } from './_destinations/posthog_customer_analytics/posthog-update-account-relationships.template'
import { template as posthogUpdateAccountTemplate } from './_destinations/posthog_customer_analytics/posthog-update-account.template'
import { template as posthogReplayVisionTemplate } from './_destinations/posthog_replay_vision/posthog-replay-vision.template'
import { template as posthogRunScoutTemplate } from './_destinations/posthog_signals/posthog-run-scout.template'
import { template as posthogShowSurveyTemplate } from './_destinations/posthog_surveys/posthog-show-survey.template'
import { template as posthogCreateTaskTemplate } from './_destinations/posthog_tasks/posthog-create-task.template'
import { template as posthogAddToStaticCohortTemplate } from './_destinations/posthog_workflows/posthog-add-to-static-cohort.template'
import { template as posthogClassifyTemplate } from './_destinations/posthog_workflows/posthog-classify.template'
import { template as posthogOptOutOfMessagesTemplate } from './_destinations/posthog_workflows/posthog-opt-out-of-messages.template'
import { template as posthogSetHogflowVariableTemplate } from './_destinations/posthog_workflows/posthog-set-variable.template'
import { template as pushTemplate } from './_destinations/push/push.template'
import { template as redditAdsTemplate } from './_destinations/reddit_ads/reddit.template'
import { template as retainTemplate } from './_destinations/retain/retain.template'
import { template as slackTemplate } from './_destinations/slack/slack.template'
import { template as snapchatAdsTemplate } from './_destinations/snapchat_ads/snapchat.template'
import { template as tiktokAdsTemplate } from './_destinations/tiktok_ads/tiktok.template'
import { template as twilioTemplate } from './_destinations/twilio/twilio.template'
import { template as unifyTemplate } from './_destinations/unify/unify.template'
import { template as webhookTemplate } from './_destinations/webhook/webhook.template'
import { template as whatsappTemplate } from './_destinations/whatsapp/whatsapp.template'
import { template as pixelTemplate } from './_sources/pixel/pixel.template'
import { template as stripeWebhookTemplate } from './_sources/stripe/stripe_webhook.template'
import { template as vercelLogDrainTemplate } from './_sources/vercel/vercel_log_drain.template'
import { template as incomingWebhookTemplate } from './_sources/webhook/incoming_webhook.template'
import { template as botDetectionTemplate } from './_transformations/bot-detection/bot-detection.template'
import { template as defaultTransformationTemplate } from './_transformations/default/default.template'
import { template as downsamplingTemplate } from './_transformations/downsampling/downsampling.template'
import { template as dropEventsTemplate } from './_transformations/drop-events/drop-events.template'
import { template as filterPropertiesTemplate } from './_transformations/filter-properties/filter-properties.template'
import { template as flattenPropertiesTemplate } from './_transformations/flatten-properties/flatten-properties.template'
import { template as geoipTemplate } from './_transformations/geoip/geoip.template'
import { template as hashPropertiesTemplate } from './_transformations/hash-properties/hash-properties.template'
import { template as ipAnonymizationTemplate } from './_transformations/ip-anonymization/ip-anonymization.template'
import { template as piiHashingTemplate } from './_transformations/pii-hashing/pii-hashing.template'
import { template as removeNullPropertiesTemplate } from './_transformations/remove-null-properties/remove-null-properties.template'
import { template as semverFlattenerTemplate } from './_transformations/semver-flattener/semver-flattener.template'
import { template as taxonomyTemplate } from './_transformations/taxonomy/taxonomy.template'
import { template as timestampParserTemplate } from './_transformations/timestamp-parser/timestamp-parser.template'
import { template as urlMaskingTemplate } from './_transformations/url-masking/url-masking.template'
import { template as urlNormalizationTemplate } from './_transformations/url-normalization/url-normalization.template'
import { template as urlParametersToPropertiesTemplate } from './_transformations/url-parameters-to-properties/url-parameters-to-properties.template'
import { template as userAgentTemplate } from './_transformations/user-agent/user-agent.template'
import { template as logDefaultTemplate } from './_transformations_log/default/default.template'
import { template as logDropBySeverityTemplate } from './_transformations_log/drop-by-severity/drop-by-severity.template'
import { template as logPiiScrubTemplate } from './_transformations_log/pii-scrub/pii-scrub.template'
import { template as logRedactAttributesTemplate } from './_transformations_log/redact-attributes/redact-attributes.template'

export const HOG_FUNCTION_TEMPLATES_COMING_SOON: HogFunctionTemplate[] = allComingSoonTemplates

export const HOG_FUNCTION_TEMPLATES_DESTINATIONS: HogFunctionTemplate[] = [
    slackTemplate,
    webhookTemplate,
    pagerdutyTemplate,
    tiktokAdsTemplate,
    snapchatAdsTemplate,
    linearTemplate,
    githubTemplate,
    gitlabTemplate,
    googleAdsTemplate,
    metaAdsTemplate,
    linkedinAdsTemplate,
    microsoftAdsTemplate,
    openaiAdsTemplate,
    redditAdsTemplate,
    pinterestAdsTemplate,
    twilioTemplate,
    whatsappTemplate,
    googleSheetsTemplate,
    googleTagManagerTemplate,
    emailTemplate,
    pushTemplate,
    beehiivTemplate,
    clickupTemplate,
    posthogCaptureTemplate,
    posthogGroupIdentifyTemplate,
    posthogUpdatePersonPropertiesTemplate,
    posthogSetHogflowVariableTemplate,
    posthogGetTicketTemplate,
    posthogSendTicketMessageTemplate,
    posthogUpdateTicketTemplate,
    posthogCreateTaskTemplate,
    posthogRunScoutTemplate,
    posthogShowSurveyTemplate,
    posthogClassifyTemplate,
    posthogAddToStaticCohortTemplate,
    posthogOptOutOfMessagesTemplate,
    posthogReplayVisionTemplate,
    posthogCreateAccountTemplate,
    posthogCreateCustomerTaskTemplate,
    posthogGetAccountTemplate,
    posthogTagAccountTemplate,
    posthogUpdateAccountRelationshipsTemplate,
    posthogUpdateAccountTemplate,
    posthogUpdateAccountPropertyTemplate,
    hubspotCompanyTemplate,
    accoilTemplate,
    appcuesTemplate,
    klimeTemplate,
    unifyTemplate,
    closeTemplate,
    retainTemplate,
]

export const HOG_FUNCTION_TEMPLATES_TRANSFORMATIONS: HogFunctionTemplate[] = [
    defaultTransformationTemplate,
    geoipTemplate,
    ipAnonymizationTemplate,
    removeNullPropertiesTemplate,
    urlMaskingTemplate,
    piiHashingTemplate,
    botDetectionTemplate,
    dropEventsTemplate,
    filterPropertiesTemplate,
    hashPropertiesTemplate,
    urlNormalizationTemplate,
    semverFlattenerTemplate,
    timestampParserTemplate,
    downsamplingTemplate,
    urlParametersToPropertiesTemplate,
    taxonomyTemplate,
    userAgentTemplate,
    flattenPropertiesTemplate,
]

export const HOG_FUNCTION_TEMPLATES_TRANSFORMATIONS_LOG: HogFunctionTemplate[] = [
    logDefaultTemplate,
    logPiiScrubTemplate,
    logDropBySeverityTemplate,
    logRedactAttributesTemplate,
]

export const NATIVE_HOG_FUNCTIONS: (HogFunctionTemplate & NativeTemplate)[] = [nativeWebhookTemplate].map((plugin) => ({
    ...plugin,
    code_language: 'javascript',
    code: 'return event;',
    inputs_schema: [
        ...plugin.inputs_schema,
        {
            key: 'debug_mode',
            label: 'Debug Mode',
            type: 'boolean',
            description: 'Will log configuration and request details',
            default: false,
        },
    ],
}))

export const HOG_FUNCTION_TEMPLATES_SOURCES: HogFunctionTemplate[] = [
    incomingWebhookTemplate,
    stripeWebhookTemplate,
    vercelLogDrainTemplate,
    pixelTemplate,
]

export const HOG_FUNCTION_TEMPLATES_DESTINATIONS_DEPRECATED: HogFunctionTemplate[] = DESTINATION_PLUGINS.map(
    (x) => x.template
)

export const HOG_FUNCTION_TEMPLATES_SEGMENT_DESTINATIONS: HogFunctionTemplate[] = SEGMENT_DESTINATIONS.map(
    (x) => x.template
)

export const HOG_FUNCTION_TEMPLATES_TRANSFORMATIONS_DEPRECATED: HogFunctionTemplate[] = TRANSFORMATION_PLUGINS.map(
    (x) => x.template
)

export const NATIVE_HOG_FUNCTIONS_BY_ID = NATIVE_HOG_FUNCTIONS.reduce(
    (acc, plugin) => {
        acc[plugin.id] = plugin
        return acc
    },
    {} as Record<string, NativeTemplate>
)

export const HOG_FUNCTION_TEMPLATES: HogFunctionTemplate[] = [
    ...HOG_FUNCTION_TEMPLATES_DESTINATIONS,
    ...HOG_FUNCTION_TEMPLATES_SEGMENT_DESTINATIONS,
    ...HOG_FUNCTION_TEMPLATES_DESTINATIONS_DEPRECATED,
    ...HOG_FUNCTION_TEMPLATES_TRANSFORMATIONS,
    ...HOG_FUNCTION_TEMPLATES_TRANSFORMATIONS_DEPRECATED,
    ...HOG_FUNCTION_TEMPLATES_TRANSFORMATIONS_LOG,
    ...HOG_FUNCTION_TEMPLATES_SOURCES,
    ...HOG_FUNCTION_TEMPLATES_COMING_SOON,
    ...NATIVE_HOG_FUNCTIONS,
]