: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
import { NativeTemplate } from '~/cdp/types'
export const template: NativeTemplate = {
free: false,
status: 'hidden',
type: 'destination',
id: 'native-webhook',
name: 'Native HTTP Webhook',
description: 'Sends a native webhook templated by the incoming event data',
icon_url: '/static/posthog-icon.svg',
category: ['Custom'],
perform: (request, { payload }) => {
try {
return request(payload.url, {
method: payload.method,
headers: payload.headers,
json: payload.body,
})
} catch (error) {
throw new Error(error.message)
}
},
inputs_schema: [
{
key: 'url',
type: 'string',
label: 'Webhook URL',
secret: false,
required: true,
description: 'Endpoint URL to send event data to.',
},
{
key: 'method',
type: 'choice',
label: 'Method',
secret: false,
choices: [
{
label: 'POST',
value: 'POST',
},
{
label: 'PUT',
value: 'PUT',
},
{
label: 'PATCH',
value: 'PATCH',
},
{
label: 'GET',
value: 'GET',
},
{
label: 'DELETE',
value: 'DELETE',
},
],
default: 'POST',
required: false,
description: 'HTTP method to use for the request.',
},
{
key: 'body',
type: 'json',
label: 'JSON Body',
default: { event: '{event}', person: '{person}' },
secret: false,
required: false,
description: 'JSON payload to send in the request body.',
},
{
key: 'headers',
type: 'dictionary',
label: 'Headers',
secret: false,
required: false,
default: { 'Content-Type': 'application/json' },
description: 'HTTP headers to send in the request.',
},
{
key: 'debug',
type: 'boolean',
label: 'Log responses',
description: 'Logs the response of http calls for debugging.',
secret: false,
required: false,
default: false,
},
],
}