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.

feat(cdp): add internal event filter source (#86672)

Ben White9b0ee17fb738
diff --git a/frontend/src/scenes/hog-functions/configuration/hogFunctionConfigurationLogic.test.ts b/frontend/src/scenes/hog-functions/configuration/hogFunctionConfigurationLogic.test.ts
index 8db785ab13ae..305f7ff48835 100644
--- a/frontend/src/scenes/hog-functions/configuration/hogFunctionConfigurationLogic.test.ts
+++ b/frontend/src/scenes/hog-functions/configuration/hogFunctionConfigurationLogic.test.ts
@@ -319,4 +319,34 @@ describe('hogFunctionConfigurationLogic', () => {
await expectLogic(logic).toDispatchActions(['loadHogFunction', 'loadHogFunctionFailure'])
})
})
+
+ describe('internal destination without a trigger', () => {
+ const INTERNAL_DESTINATION: HogFunctionType = {
+ ...HOG_FUNCTION,
+ type: 'internal_destination',
+ filters: {},
+ }
+
+ beforeEach(() => {
+ initKeaTests()
+ mockApi.get.mockReturnValue(Promise.resolve(INTERNAL_DESTINATION))
+ mockApi.update.mockReturnValue(Promise.resolve(INTERNAL_DESTINATION))
+ logic = hogFunctionConfigurationLogic({ id: INTERNAL_DESTINATION.id })
+ logic.mount()
+ })
+
+ it('blocks the save client-side, since the backend requires an explicit event', async () => {
+ // A legacy internal destination stores no events at all, so the rule has to catch an
+ // absent list and not just an empty one — otherwise the form posts a payload the
+ // backend rejects, and the user gets no feedback.
+ await expectLogic(logic).toDispatchActions(['loadHogFunction', 'loadHogFunctionSuccess'])
+
+ await expectLogic(logic, () => {
+ logic.actions.submitConfiguration()
+ }).toDispatchActions(['submitConfigurationFailure'])
+
+ expect(logic.values.configurationErrors.filters).toBe('You must choose a filter')
+ expect(mockApi.update).not.toHaveBeenCalled()
+ })
+ })
})
diff --git a/frontend/src/scenes/hog-functions/configuration/hogFunctionConfigurationLogic.tsx b/frontend/src/scenes/hog-functions/configuration/hogFunctionConfigurationLogic.tsx
index c0ccd36be262..33839630639b 100644
--- a/frontend/src/scenes/hog-functions/configuration/hogFunctionConfigurationLogic.tsx
+++ b/frontend/src/scenes/hog-functions/configuration/hogFunctionConfigurationLogic.tsx
@@ -105,9 +105,7 @@ const VALIDATION_RULES = {
? 'You must add at least one mapping'
: undefined,
INTERNAL_DESTINATION_REQUIRES_FILTERS: (data: HogFunctionConfigurationType) =>
- data.type === 'internal_destination' && data.filters?.events?.length === 0
- ? 'You must choose a filter'
- : undefined,
+ data.type === 'internal_destination' && !data.filters?.events?.length ? 'You must choose a filter' : undefined,
} as const
const NEW_FUNCTION_TEMPLATE: HogFunctionTemplateType = {
@@ -190,12 +188,15 @@ export function sanitizeInputs(
export function sanitizeConfiguration(data: HogFunctionConfigurationType): HogFunctionConfigurationType {
const filters = data.filters ?? {}
- filters.source = filters.source ?? 'events'
+ filters.source = data.type === 'internal_destination' ? 'internal-events' : (filters.source ?? 'events')
if (filters.source === 'person-updates' || Array.isArray(data?.mappings)) {
// Ensure we aren't passing in values that aren't supported
delete filters.actions
delete filters.events
+ } else if (filters.source === 'internal-events') {
+ delete filters.actions
+ delete filters.data_warehouse
}
const payload: HogFunctionConfigurationType = {
@@ -1985,8 +1986,11 @@ export const hogFunctionConfigurationLogic = kea<hogFunctionConfigurationLogicTy
},
})
} else {
+ // A nested attr names a path inside a form field (`filters__events`), and the
+ // form only has a manual-error slot for the field itself — anchoring the
+ // message at the leaf renders nothing at all.
actions.setConfigurationManualErrors({
- [maybeValidationError.attr]: maybeValidationError.detail,
+ [maybeValidationError.attr.split('__')[0]]: maybeValidationError.detail,
})
}
}, 1)
diff --git a/frontend/src/scenes/hog-functions/filters/HogFunctionFiltersInternal.tsx b/frontend/src/scenes/hog-functions/filters/HogFunctionFiltersInternal.tsx
index caf2cb14c66b..b7b786c1822c 100644
--- a/frontend/src/scenes/hog-functions/filters/HogFunctionFiltersInternal.tsx
+++ b/frontend/src/scenes/hog-functions/filters/HogFunctionFiltersInternal.tsx
@@ -181,6 +181,7 @@ const setSimpleFilterValue = (
contextId: HogFunctionConfigurationContextId
): CyclotronJobFiltersType => {
const next: CyclotronJobFiltersType = {
+ source: 'internal-events',
events: [
{
name: options.find((option) => option.value === value)?.label,
diff --git a/frontend/src/scenes/hog-functions/sub-templates/sub-templates.ts b/frontend/src/scenes/hog-functions/sub-templates/sub-templates.ts
index 0bdc10972ea0..fde39ca53ab1 100644
--- a/frontend/src/scenes/hog-functions/sub-templates/sub-templates.ts
+++ b/frontend/src/scenes/hog-functions/sub-templates/sub-templates.ts
@@ -136,13 +136,14 @@ export const HOG_FUNCTION_SUB_TEMPLATE_COMMON_PROPERTIES: Record<
sub_template_id: 'activity-log',
type: 'internal_destination',
context_id: 'activity-log',
- filters: { events: [{ id: '$activity_log_entry_created', type: 'events' }] },
+ filters: { source: 'internal-events', events: [{ id: '$activity_log_entry_created', type: 'events' }] },
},
'feature-flag-change': {
sub_template_id: 'feature-flag-change',
type: 'internal_destination',
context_id: 'activity-log',
filters: {
+ source: 'internal-events',
events: [
{
id: '$activity_log_entry_created',
@@ -163,79 +164,79 @@ export const HOG_FUNCTION_SUB_TEMPLATE_COMMON_PROPERTIES: Record<
sub_template_id: 'discussion-mention',
type: 'internal_destination',
context_id: 'discussion-mention',
- filters: { events: [{ id: '$discussion_mention_created', type: 'events' }] },
+ filters: { source: 'internal-events', events: [{ id: '$discussion_mention_created', type: 'events' }] },
},
'error-tracking-issue-created': {
sub_template_id: 'error-tracking-issue-created',
type: 'internal_destination',
context_id: 'error-tracking',
- filters: { events: [{ id: '$error_tracking_issue_created', type: 'events' }] },
+ filters: { source: 'internal-events', events: [{ id: '$error_tracking_issue_created', type: 'events' }] },
},
'error-tracking-issue-reopened': {
sub_template_id: 'error-tracking-issue-reopened',
type: 'internal_destination',
context_id: 'error-tracking',
- filters: { events: [{ id: '$error_tracking_issue_reopened', type: 'events' }] },
+ filters: { source: 'internal-events', events: [{ id: '$error_tracking_issue_reopened', type: 'events' }] },
},
'error-tracking-issue-spiking': {
sub_template_id: 'error-tracking-issue-spiking',
type: 'internal_destination',
context_id: 'error-tracking',
- filters: { events: [{ id: '$error_tracking_issue_spiking', type: 'events' }] },
+ filters: { source: 'internal-events', events: [{ id: '$error_tracking_issue_spiking', type: 'events' }] },
},
[INSIGHT_ALERT_FIRING_SUB_TEMPLATE_ID]: {
sub_template_id: INSIGHT_ALERT_FIRING_SUB_TEMPLATE_ID,
type: 'internal_destination',
context_id: 'insight-alerts',
- filters: { events: [{ id: '$insight_alert_firing', type: 'events' }] },
+ filters: { source: 'internal-events', events: [{ id: '$insight_alert_firing', type: 'events' }] },
},
'experiment-significant': {
sub_template_id: 'experiment-significant',
type: 'internal_destination',
context_id: 'experiment-alerts',
- filters: { events: [{ id: '$experiment_metric_significant', type: 'events' }] },
+ filters: { source: 'internal-events', events: [{ id: '$experiment_metric_significant', type: 'events' }] },
},
'logs-alert-firing': {
sub_template_id: 'logs-alert-firing',
type: 'internal_destination',
context_id: 'logs-alerting',
- filters: { events: [{ id: '$logs_alert_firing', type: 'events' }] },
+ filters: { source: 'internal-events', events: [{ id: '$logs_alert_firing', type: 'events' }] },
},
'logs-alert-resolved': {
sub_template_id: 'logs-alert-resolved',
type: 'internal_destination',
context_id: 'logs-alerting',
- filters: { events: [{ id: '$logs_alert_resolved', type: 'events' }] },
+ filters: { source: 'internal-events', events: [{ id: '$logs_alert_resolved', type: 'events' }] },
},
'logs-alert-auto-disabled': {
sub_template_id: 'logs-alert-auto-disabled',
type: 'internal_destination',
context_id: 'logs-alerting',
- filters: { events: [{ id: '$logs_alert_auto_disabled', type: 'events' }] },
+ filters: { source: 'internal-events', events: [{ id: '$logs_alert_auto_disabled', type: 'events' }] },
},
'logs-alert-errored': {
sub_template_id: 'logs-alert-errored',
type: 'internal_destination',
context_id: 'logs-alerting',
- filters: { events: [{ id: '$logs_alert_errored', type: 'events' }] },
+ filters: { source: 'internal-events', events: [{ id: '$logs_alert_errored', type: 'events' }] },
},
'health-check-firing': {
sub_template_id: 'health-check-firing',
type: 'internal_destination',
context_id: 'health-alerts',
- filters: { events: [{ id: '$health_check_issue_firing', type: 'events' }] },
+ filters: { source: 'internal-events', events: [{ id: '$health_check_issue_firing', type: 'events' }] },
},
'health-check-resolved': {
sub_template_id: 'health-check-resolved',
type: 'internal_destination',
context_id: 'health-alerts',
- filters: { events: [{ id: '$health_check_issue_resolved', type: 'events' }] },
+ filters: { source: 'internal-events', events: [{ id: '$health_check_issue_resolved', type: 'events' }] },
},
'batch-export-run-failed': {
sub_template_id: 'batch-export-run-failed',
type: 'internal_destination',
context_id: 'batch-export-alerts',
- filters: { events: [{ id: '$batch_export_run_failed', type: 'events' }] },
+ filters: { source: 'internal-events', events: [{ id: '$batch_export_run_failed', type: 'events' }] },
masking: {
hash: BATCH_EXPORT_ALERT_MASKING_HASH,
ttl: BATCH_EXPORT_ALERT_MASKING_TTL_SECONDS,
diff --git a/frontend/src/types.ts b/frontend/src/types.ts
index 5771311a2252..847719a4989a 100644
--- a/frontend/src/types.ts
+++ b/frontend/src/types.ts
@@ -7370,7 +7370,7 @@ export type CyclotronJobFilterPropertyFilter =
| FlagPropertyFilter
export interface CyclotronJobFiltersType {
- source?: 'events' | 'person-updates' | 'data-warehouse-table' | 'data-warehouse-view'
+ source?: 'events' | 'internal-events' | 'person-updates' | 'data-warehouse-table' | 'data-warehouse-view'
events?: CyclotronJobFilterEvents[]
data_warehouse?: CyclotronJobFilterDataWarehouse[]
actions?: CyclotronJobFilterActions[]
diff --git a/nodejs/src/cdp/consumers/cdp-cyclotron-worker-hogflow.test.ts b/nodejs/src/cdp/consumers/cdp-cyclotron-worker-hogflow.test.ts
index 5b501a8335e7..5c77e232af36 100644
--- a/nodejs/src/cdp/consumers/cdp-cyclotron-worker-hogflow.test.ts
+++ b/nodejs/src/cdp/consumers/cdp-cyclotron-worker-hogflow.test.ts
@@ -231,7 +231,15 @@ describe('CdpCyclotronWorkerHogFlow', () => {
.withTeamId(team.id)
.withStatus('active')
.withSimpleWorkflow({
- trigger: { type: 'github-event', filters: { properties: [], bytecode: ['_h', 29] } } as any,
+ trigger: {
+ type: 'internal-event',
+ filters: {
+ source: 'internal-events',
+ events: [{ id: '$github_event_received', type: 'events' }],
+ properties: [],
+ bytecode: ['_h', 29],
+ },
+ } as any,
})
.build()
)
diff --git a/nodejs/src/cdp/consumers/cdp-internal-event.consumer.ts b/nodejs/src/cdp/consumers/cdp-internal-event.consumer.ts
index 3cf8be474557..5f2f5fb7fb7e 100644
--- a/nodejs/src/cdp/consumers/cdp-internal-event.consumer.ts
+++ b/nodejs/src/cdp/consumers/cdp-internal-event.consumer.ts
@@ -21,11 +21,33 @@ import { counterParseError } from './metrics'
const SLACK_MESSAGE_RECEIVED_EVENT = '$slack_message_received'
const GITHUB_EVENT_RECEIVED_EVENT = '$github_event_received'
-// The event that starts each trigger type. Type alone would match every other signal on this topic.
-const INTERNAL_EVENT_TRIGGER_EVENTS = new Map([
- ['slack-message', SLACK_MESSAGE_RECEIVED_EVENT],
- ['github-event', GITHUB_EVENT_RECEIVED_EVENT],
-])
+function getInternalEventFilterEventIds(filters: unknown): string[] | null {
+ if (!filters || typeof filters !== 'object') {
+ return null
+ }
+
+ const { source, events, actions, data_warehouse } = filters as {
+ source?: unknown
+ events?: unknown
+ actions?: unknown
+ data_warehouse?: unknown
+ }
+ const hasUnsupportedFilters =
+ (actions !== undefined && (!Array.isArray(actions) || actions.length > 0)) ||
+ (data_warehouse !== undefined && (!Array.isArray(data_warehouse) || data_warehouse.length > 0))
+ if (source !== 'internal-events' || !Array.isArray(events) || !events.length || hasUnsupportedFilters) {
+ return null
+ }
+
+ const eventIds = events.map((event) => (event && typeof event === 'object' ? (event as { id?: unknown }).id : null))
+ return eventIds.every((eventId): eventId is string => typeof eventId === 'string' && eventId.trim().length > 0)
+ ? eventIds
+ : null
+}
+
+function hasMatchingInternalEventFilter(filters: unknown, eventName: string): boolean {
+ return getInternalEventFilterEventIds(filters)?.includes(eventName) ?? false
+}
/**
* Whether a GitHub delivery is a write PostHog's own GitHub App made, resolved from the `own_app`
@@ -102,8 +124,16 @@ export class CdpInternalEventsConsumer extends CdpConsumerBase {
const [hogInvocations, hogflowInvocations] = await Promise.all([
this.hogFunctionPipeline.buildInvocations(invocationGlobals, {
hogTypes: this.hogTypes,
- filterFn: () => true,
+ filterFn: (fn) => {
+ if (fn.filters?.source === 'internal-events') {
+ return getInternalEventFilterEventIds(fn.filters) !== null
+ }
+ return (fn.filters?.source ?? 'events') === 'events'
+ },
invocationFilterFn: (fn, globals) => {
+ if (fn.filters?.source === 'internal-events') {
+ return hasMatchingInternalEventFilter(fn.filters, globals.event.event)
+ }
if (!isManagedAlertInternalEvent(globals.event.event)) {
return true
}
@@ -123,7 +153,8 @@ export class CdpInternalEventsConsumer extends CdpConsumerBase {
}),
this.hogFlowPipeline.buildInvocations(invocationGlobals, {
eligibilityFn: (flow, globals) =>
- INTERNAL_EVENT_TRIGGER_EVENTS.get(flow.trigger.type) === globals.event.event &&
+ flow.trigger.type === 'internal-event' &&
+ hasMatchingInternalEventFilter(flow.trigger.filters, globals.event.event) &&
!ownSlackMessages.has(globals) &&
!isOwnGithubEvent(globals),
}),
diff --git a/nodejs/src/cdp/consumers/cdp-internal-events-consumer.test.ts b/nodejs/src/cdp/consumers/cdp-internal-events-consumer.test.ts
index f88113fb2ff4..5c035dd9f2e3 100644
--- a/nodejs/src/cdp/consumers/cdp-internal-events-consumer.test.ts
+++ b/nodejs/src/cdp/consumers/cdp-internal-events-consumer.test.ts
@@ -292,14 +292,81 @@ describe('CDP Internal Events Consumer', () => {
expect(invocations.map((invocation) => invocation.functionId)).toEqual([fn.id])
})
+
+ it('invokes canonical destinations with a matching explicit event filter', async () => {
+ const fn = await insertHogFunction({
+ ...HOG_EXAMPLES.simple_fetch,
+ ...HOG_INPUTS_EXAMPLES.simple_fetch,
+ filters: {
+ source: 'internal-events',
+ events: [{ id: '$billing_alert_firing', type: 'events' as const }],
+ bytecode: ['_H', 1, 32, '$billing_alert_firing', 32, 'event', 1, 1, 11],
+ },
+ })
+ const event = createInternalEvent(team.id, {})
+ event.event.event = '$billing_alert_firing'
+
+ const globals = await processor._parseKafkaBatch([createKafkaMessage(event)])
+ const { invocations } = await processor.processBatch(globals)
+
+ expect(invocations.map((invocation) => invocation.functionId)).toEqual([fn.id])
+ })
+
+ const invalidCanonicalFilters: [string, NonNullable<HogFunctionType['filters']>][] = [
+ ['no events', { source: 'internal-events' }],
+ ['an empty event id', { source: 'internal-events', events: [{ id: '', type: 'events' }] }],
+ [
+ 'only a different event',
+ { source: 'internal-events', events: [{ id: '$another_internal_event', type: 'events' }] },
+ ],
+ [
+ 'an action filter',
+ {
+ source: 'internal-events',
+ events: [{ id: '$internal_event', type: 'events' }],
+ actions: [{ id: '1', type: 'actions' }],
+ },
+ ],
+ [
+ 'a data warehouse filter',
+ {
+ source: 'internal-events',
+ events: [{ id: '$internal_event', type: 'events' }],
+ data_warehouse: [{ table_name: 'events' }],
+ },
+ ],
+ ]
+
+ it.each(invalidCanonicalFilters)('does not invoke canonical destinations with %s', async (_name, filters) => {
+ await insertHogFunction({
+ ...HOG_EXAMPLES.simple_fetch,
+ ...HOG_INPUTS_EXAMPLES.simple_fetch,
+ filters,
+ })
+
+ const globals = await processor._parseKafkaBatch([createKafkaMessage(createInternalEvent(team.id, {}))])
+ const { invocations } = await processor.processBatch(globals)
+
+ expect(invocations).toHaveLength(0)
+ })
})
describe('hog flow invocations', () => {
const buildHogFlow = (teamId: number, trigger: any): HogFlow =>
new FixtureHogFlowBuilder()
.withTeamId(teamId)
- // Always-true bytecode (return true), so the test is about eligibility, not filters
- .withSimpleWorkflow({ trigger: { ...trigger, filters: { properties: [], bytecode: ['_h', 29] } } })
+ .withSimpleWorkflow({
+ trigger: {
+ ...trigger,
+ filters: {
+ source: 'internal-events',
+ events: [{ id: '$slack_message_received', type: 'events' }],
+ properties: [],
+ bytecode: ['_h', 29],
+ ...trigger.filters,
+ },
+ },
+ })
.build()
const slackMessage = (teamId: number, properties: Record<string, any> = {}) =>
@@ -324,8 +391,13 @@ describe('CDP Internal Events Consumer', () => {
},
})
- it('should start a workflow whose trigger is a slack message', async () => {
- const hogFlow = await _insertHogFlow(hub.postgres, buildHogFlow(team.id, { type: 'slack-message' }))
+ const githubTrigger = {
+ type: 'internal-event',
+ filters: { events: [{ id: '$github_event_received', type: 'events' }] },
+ }
+
+ it('should start an internal-event workflow for a matching Slack message', async () => {
+ const hogFlow = await _insertHogFlow(hub.postgres, buildHogFlow(team.id, { type: 'internal-event' }))
const globals = await processor._parseKafkaBatch([createKafkaMessage(slackMessage(team.id))])
expect(globals).toHaveLength(1)
@@ -336,12 +408,8 @@ describe('CDP Internal Events Consumer', () => {
expect(hogFlowInvocations[0].functionId).toBe(hogFlow.id)
})
- it('should not start a slack workflow from another signal on this topic', async () => {
- // Eligibility has to match the event as well as the trigger type. Error tracking, alerts
- // and activity logs all arrive here, and a workflow whose stored filters are empty (which
- // the API accepts) matches whatever it is handed — so trigger type alone fires on all of
- // them, with no channel or ts for a reply step to use.
- await _insertHogFlow(hub.postgres, buildHogFlow(team.id, { type: 'slack-message' }))
+ it('should not start an internal-event workflow from another signal on this topic', async () => {
+ await _insertHogFlow(hub.postgres, buildHogFlow(team.id, { type: 'internal-event' }))
const globals = await processor._parseKafkaBatch([
createKafkaMessage(
@@ -361,6 +429,38 @@ describe('CDP Internal Events Consumer', () => {
expect(invocations.filter((i: any) => i.hogFlow)).toHaveLength(0)
})
+ it.each([
+ ['no events', { source: 'internal-events', events: [] }],
+ ['an empty event id', { source: 'internal-events', events: [{ id: '', type: 'events' }] }],
+ [
+ 'only a different event',
+ { source: 'internal-events', events: [{ id: '$another_internal_event', type: 'events' }] },
+ ],
+ [
+ 'an action filter',
+ {
+ source: 'internal-events',
+ events: [{ id: '$slack_message_received', type: 'events' }],
+ actions: [{ id: '1', type: 'actions' }],
+ },
+ ],
+ [
+ 'a data warehouse filter',
+ {
+ source: 'internal-events',
+ events: [{ id: '$slack_message_received', type: 'events' }],
+ data_warehouse: [{ table_name: 'events' }],
+ },
+ ],
+ ])('does not start an internal-event workflow with %s', async (_name, filters) => {
+ await _insertHogFlow(hub.postgres, buildHogFlow(team.id, { type: 'internal-event', filters }))
+
+ const globals = await processor._parseKafkaBatch([createKafkaMessage(slackMessage(team.id))])
+ const { invocations } = await processor.processBatch(globals)
+
+ expect(invocations.filter((invocation: any) => invocation.hogFlow)).toHaveLength(0)
+ })
+
it('should not start an event-triggered workflow', async () => {
// Internal events share this topic with error tracking and activity log signals. An
// event-triggered workflow expects those from analytics capture, so widening eligibility
@@ -385,7 +485,7 @@ describe('CDP Internal Events Consumer', () => {
kind: 'slack',
config: { app_id: 'A0POSTHOG' },
})
- await _insertHogFlow(hub.postgres, buildHogFlow(team.id, { type: 'slack-message' }))
+ await _insertHogFlow(hub.postgres, buildHogFlow(team.id, { type: 'internal-event' }))
const globals = await processor._parseKafkaBatch([
createKafkaMessage(slackMessage(team.id, { app_id: appId, integration_id: integration.id })),
@@ -396,7 +496,7 @@ describe('CDP Internal Events Consumer', () => {
})
it('should start a workflow whose trigger is a github event', async () => {
- const hogFlow = await _insertHogFlow(hub.postgres, buildHogFlow(team.id, { type: 'github-event' }))
+ const hogFlow = await _insertHogFlow(hub.postgres, buildHogFlow(team.id, githubTrigger))
const globals = await processor._parseKafkaBatch([createKafkaMessage(githubEvent(team.id))])
const { invocations } = await processor.processBatch(globals)
@@ -415,7 +515,7 @@ describe('CDP Internal Events Consumer', () => {
// A workflow that comments back on an issue sees its own comment arrive on this topic.
// The guard is part of eligibility, not the trigger's stored filters, so a workflow
// created through the API or MCP still has it.
- await _insertHogFlow(hub.postgres, buildHogFlow(team.id, { type: 'github-event' }))
+ await _insertHogFlow(hub.postgres, buildHogFlow(team.id, githubTrigger))
const globals = await processor._parseKafkaBatch([
createKafkaMessage(githubEvent(team.id, { own_app: ownApp })),
@@ -427,9 +527,9 @@ describe('CDP Internal Events Consumer', () => {
)
it('should parse a message for a team that has a hog flow but no hog functions', async () => {
- // The parse step used to drop any team with no internal_destination functions, which
- // would discard the event before the flow pipeline ever saw it.
- await _insertHogFlow(hub.postgres, buildHogFlow(team.id, { type: 'slack-message' }))
+ // The parse step must retain a team that has a flow but no internal destination, or it
+ // would discard the event before the flow pipeline sees it.
+ await _insertHogFlow(hub.postgres, buildHogFlow(team.id, { type: 'internal-event' }))
const globals = await processor._parseKafkaBatch([createKafkaMessage(slackMessage(team.id))])
diff --git a/nodejs/src/cdp/schema/hogflow.ts b/nodejs/src/cdp/schema/hogflow.ts
index fbaf57d6fa72..36e767a9e3ad 100644
--- a/nodejs/src/cdp/schema/hogflow.ts
+++ b/nodejs/src/cdp/schema/hogflow.ts
@@ -94,10 +94,10 @@ const HogFlowTriggerSchema = z.discriminatedUnion('type', [
key_property: z.string().optional(),
}),
z.object({
- type: z.literal('slack-message'),
+ type: z.literal('internal-event'),
filters: z.object({
- // Message-property filters only. Channel is one of these rather than a field of its own,
- // so it composes with poster and text conditions instead of being matched separately.
+ source: z.literal('internal-events'),
+ events: z.array(z.any()).min(1),
properties: z.array(z.any()).optional(),
}),
}),
@@ -112,14 +112,6 @@ const HogFlowTriggerSchema = z.discriminatedUnion('type', [
// Optional row column used as the masking / dedup key in place of distinct_id
key_property: z.string().optional(),
}),
- z.object({
- type: z.literal('github-event'),
- filters: z.object({
- // Delivery-property filters only, on the same footing as slack-message: repository,
- // event type and actor are all properties rather than fields of their own.
- properties: z.array(z.any()).optional(),
- }),
- }),
])
export const HogFlowActionSchema = z.discriminatedUnion('type', [
@@ -361,7 +353,7 @@ export const HogFlowSchema = z.object({
export type RowScopedTrigger = Extract<
HogFlow['trigger'],
- { type: 'data-warehouse-table' | 'data-warehouse-view' | 'slack-message' | 'github-event' }
+ { type: 'data-warehouse-table' | 'data-warehouse-view' | 'internal-event' }
>
/**
@@ -373,8 +365,7 @@ export function isRowScopedTrigger(trigger: HogFlow['trigger']): trigger is RowS
return (
trigger?.type === 'data-warehouse-table' ||
trigger?.type === 'data-warehouse-view' ||
- trigger?.type === 'slack-message' ||
- trigger?.type === 'github-event'
+ trigger?.type === 'internal-event'
)
}
diff --git a/nodejs/src/cdp/services/hogflows/hogflow-executor.service.ts b/nodejs/src/cdp/services/hogflows/hogflow-executor.service.ts
index 18bb526b7ebf..326209fc3c75 100644
--- a/nodejs/src/cdp/services/hogflows/hogflow-executor.service.ts
+++ b/nodejs/src/cdp/services/hogflows/hogflow-executor.service.ts
@@ -186,8 +186,7 @@ export class HogFlowExecutorService {
const trigger = hogFlow.trigger
// Defensive: only the trigger types that carry `filters` make it through eligibility.
- // isRowScopedTrigger now covers slack-message and github-event too, alongside the two
- // warehouse types.
+ // isRowScopedTrigger covers internal-event too, alongside the two warehouse types.
if (trigger.type !== 'event' && !isRowScopedTrigger(trigger)) {
continue
}
diff --git a/nodejs/src/cdp/types.ts b/nodejs/src/cdp/types.ts
index 800838d02d9a..6306b33c1d69 100644
--- a/nodejs/src/cdp/types.ts
+++ b/nodejs/src/cdp/types.ts
@@ -49,7 +49,7 @@ export type HogFunctionFilterDataWarehouse = {
}
export interface HogFunctionFilters {
- source?: 'events' | 'person-updates' | 'data-warehouse-table' | 'data-warehouse-view' // Special case to identify what kind of thing this filters on
+ source?: 'events' | 'internal-events' | 'person-updates' | 'data-warehouse-table' | 'data-warehouse-view' // Special case to identify what kind of thing this filters on
events?: HogFunctionFilterEvent[]
actions?: HogFunctionFilterAction[]
// Warehouse tables this function is subscribed to. Never compiled into bytecode, so the
diff --git a/posthog/cdp/test/test_validation.py b/posthog/cdp/test/test_validation.py
index 94f9aff635df..65804edb6425 100644
--- a/posthog/cdp/test/test_validation.py
+++ b/posthog/cdp/test/test_validation.py
@@ -945,6 +945,44 @@ class TestHogFunctionValidation(ClickhouseTestMixin, APIBaseTest, QueryMatchingT
"bytecode": ["_H", 1, 32, "[email protected]", 32, "email", 32, "properties", 32, "person", 1, 3, 11],
}
+ def test_internal_destination_filters_are_normalized_to_internal_events(self):
+ serializer = HogFunctionFiltersSerializer(
+ data={"events": [{"id": "$internal_event", "type": "events"}]},
+ context={**self.filters_context, "function_type": "internal_destination"},
+ )
+
+ serializer.is_valid(raise_exception=True)
+
+ assert serializer.validated_data["source"] == "internal-events"
+
+ @parameterized.expand(
+ [
+ ("no_events", {"source": "internal-events"}),
+ ("empty_event_id", {"source": "internal-events", "events": [{"id": "", "type": "events"}]}),
+ (
+ "actions",
+ {
+ "source": "internal-events",
+ "events": [{"id": "$internal_event", "type": "events"}],
+ "actions": [{"id": "1", "type": "actions"}],
+ },
+ ),
+ (
+ "data_warehouse",
+ {
+ "source": "internal-events",
+ "events": [{"id": "$internal_event", "type": "events"}],
+ "data_warehouse": [{"id": "1"}],
+ },
+ ),
+ ]
+ )
+ def test_internal_event_filters_require_explicit_events(self, _name, filters):
+ serializer = HogFunctionFiltersSerializer(data=filters, context=self.filters_context)
+
+ with self.assertRaises(ValidationError):
+ serializer.is_valid(raise_exception=True)
+
@parameterized.expand(
[
("valid_dotted", "{person.properties.email}", False),
diff --git a/posthog/cdp/validation.py b/posthog/cdp/validation.py
index 73369e5eac7a..55b0b5d3f90c 100644
--- a/posthog/cdp/validation.py
+++ b/posthog/cdp/validation.py
@@ -908,7 +908,9 @@ def _contains_behavioral_property(filters: dict) -> bool:
class HogFunctionFiltersSerializer(serializers.Serializer):
source = serializers.ChoiceField(
- choices=["events", "person-updates", *DATA_WAREHOUSE_SOURCES], required=False, default="events"
+ choices=["events", "internal-events", "person-updates", *DATA_WAREHOUSE_SOURCES],
+ required=False,
+ default="events",
) # type: ignore
actions = serializers.ListField(child=serializers.DictField(), required=False)
events = serializers.ListField(child=serializers.DictField(), required=False)
@@ -937,6 +939,9 @@ class HogFunctionFiltersSerializer(serializers.Serializer):
"Use a cohort to filter on past behavior."
)
+ if function_type == "internal_destination":
+ data["source"] = "internal-events"
+
if function_type == "transformation_log":
# Filter bytecode is compiled against event-shaped globals, which log records
# don't have — silently accepting filters would mis-evaluate at ingestion time.
@@ -956,6 +961,27 @@ class HogFunctionFiltersSerializer(serializers.Serializer):
# Don't allow events or actions for person-updates
data.pop("data_warehouse", None)
+ if data.get("source") == "internal-events":
+ disallowed = [key for key in ("actions", "data_warehouse") if data.get(key)]
+ if disallowed:
+ raise serializers.ValidationError(
+ dict.fromkeys(disallowed, "This filter is not supported for internal events.")
+ )
+ data.pop("actions", None)
+ data.pop("data_warehouse", None)
+ events = data.get("events")
+ if (
+ not isinstance(events, list)
+ or not events
+ or any(
+ not isinstance(event, dict) or not isinstance(event.get("id"), str) or not event["id"].strip()
+ for event in events
+ )
+ ):
+ raise serializers.ValidationError(
+ {"events": "Internal event filters require at least one event with a non-empty id."}
+ )
+
if data.get("source") == "person-updates":
# Don't allow events or actions for person-updates
data.pop("events", None)
diff --git a/products/alerts/backend/destination_configs.py b/products/alerts/backend/destination_configs.py
index e7751895d177..883245b0f71e 100644
--- a/products/alerts/backend/destination_configs.py
+++ b/products/alerts/backend/destination_configs.py
@@ -75,6 +75,7 @@ def clip_hog_function_name(name: str) -> str:
def destination_filter(alert_id: str, event_id: str) -> dict[str, Any]:
return {
+ "source": "internal-events",
"events": [{"id": event_id, "type": "events"}],
"properties": [
{
diff --git a/products/cdp/backend/api/test/test_hog_function.py b/products/cdp/backend/api/test/test_hog_function.py
index 689a08fd8d77..5b99dafad5bd 100644
--- a/products/cdp/backend/api/test/test_hog_function.py
+++ b/products/cdp/backend/api/test/test_hog_function.py
@@ -167,9 +167,11 @@ class TestHogFunctionAPIWithoutAvailableFeature(ClickhouseTestMixin, APIBaseTest
"slack_workspace": {"value": 1},
"channel": {"value": "#general"},
},
+ "filters": {"events": [{"id": "$activity_log_entry_created", "type": "events"}]},
},
)
self.assertEqual(response.status_code, status.HTTP_201_CREATED, response.json())
+ self.assertEqual(response.json()["filters"]["source"], "internal-events")
function_id = response.json()["id"]
# Update it
diff --git a/products/cdp/backend/api/test/test_hog_function_drafts.py b/products/cdp/backend/api/test/test_hog_function_drafts.py
index 619376cd46f1..31bdf5768892 100644
--- a/products/cdp/backend/api/test/test_hog_function_drafts.py
+++ b/products/cdp/backend/api/test/test_hog_function_drafts.py
@@ -1,3 +1,5 @@
+from typing import Any
+
from posthog.test.base import APIBaseTest
from unittest.mock import patch
@@ -416,7 +418,10 @@ class TestHogFunctionDrafts(DraftTestCase):
]
)
def test_create_as_enabled(self, _name: str, from_agent: bool, function_type: str, expected: int):
- payload = {**BASE_FUNCTION, "type": function_type}
+ payload: dict[str, Any] = {**BASE_FUNCTION, "type": function_type}
+ if function_type == "internal_destination":
+ # Internal destinations have to name the event they subscribe to.
+ payload["filters"] = {"events": [{"id": "$activity_log_entry_created", "type": "events"}]}
headers = {"x-posthog-client": "mcp"} if from_agent else {}
response = self.client.post(self._url(), data=payload, headers=headers)
diff --git a/products/cdp/frontend/generated/api.schemas.ts b/products/cdp/frontend/generated/api.schemas.ts
index f73727b1cd89..2f6ad86c3341 100644
--- a/products/cdp/frontend/generated/api.schemas.ts
+++ b/products/cdp/frontend/generated/api.schemas.ts
@@ -333,6 +333,7 @@ export interface InputsSchemaItemApi {
/**
* * `events` - events
+ * * `internal-events` - internal-events
* * `person-updates` - person-updates
* * `data-warehouse-table` - data-warehouse-table
* * `data-warehouse-view` - data-warehouse-view
@@ -342,6 +343,7 @@ export type HogFunctionFiltersSourceEnumApi =
export const HogFunctionFiltersSourceEnumApi = {
Events: 'events',
+ InternalEvents: 'internal-events',
PersonUpdates: 'person-updates',
DataWarehouseTable: 'data-warehouse-table',
DataWarehouseView: 'data-warehouse-view',
diff --git a/products/cdp/frontend/generated/api.zod.ts b/products/cdp/frontend/generated/api.zod.ts
index 2f78d18e9435..e147300d99a2 100644
--- a/products/cdp/frontend/generated/api.zod.ts
+++ b/products/cdp/frontend/generated/api.zod.ts
@@ -122,9 +122,9 @@ export const HogFunctionsCreateBody = /* @__PURE__ */ zod.object({
filters: zod
.object({
source: zod
- .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view'])
+ .enum(['events', 'internal-events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view'])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(hogFunctionsCreateBodyFiltersOneSourceDefault),
actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),
@@ -232,9 +232,15 @@ export const HogFunctionsCreateBody = /* @__PURE__ */ zod.object({
filters: zod
.object({
source: zod
- .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view'])
+ .enum([
+ 'events',
+ 'internal-events',
+ 'person-updates',
+ 'data-warehouse-table',
+ 'data-warehouse-view',
+ ])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(hogFunctionsCreateBodyMappingsItemFiltersSourceDefault),
actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),
@@ -385,9 +391,9 @@ export const HogFunctionsUpdateBody = /* @__PURE__ */ zod.object({
filters: zod
.object({
source: zod
- .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view'])
+ .enum(['events', 'internal-events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view'])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(hogFunctionsUpdateBodyFiltersOneSourceDefault),
actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),
@@ -495,9 +501,15 @@ export const HogFunctionsUpdateBody = /* @__PURE__ */ zod.object({
filters: zod
.object({
source: zod
- .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view'])
+ .enum([
+ 'events',
+ 'internal-events',
+ 'person-updates',
+ 'data-warehouse-table',
+ 'data-warehouse-view',
+ ])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(hogFunctionsUpdateBodyMappingsItemFiltersSourceDefault),
actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),
@@ -648,9 +660,9 @@ export const HogFunctionsPartialUpdateBody = /* @__PURE__ */ zod.object({
filters: zod
.object({
source: zod
- .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view'])
+ .enum(['events', 'internal-events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view'])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(hogFunctionsPartialUpdateBodyFiltersOneSourceDefault),
actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),
@@ -758,9 +770,15 @@ export const HogFunctionsPartialUpdateBody = /* @__PURE__ */ zod.object({
filters: zod
.object({
source: zod
- .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view'])
+ .enum([
+ 'events',
+ 'internal-events',
+ 'person-updates',
+ 'data-warehouse-table',
+ 'data-warehouse-view',
+ ])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(hogFunctionsPartialUpdateBodyMappingsItemFiltersSourceDefault),
actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),
@@ -915,9 +933,9 @@ export const HogFunctionsEnableBackfillsCreateBody = /* @__PURE__ */ zod.object(
filters: zod
.object({
source: zod
- .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view'])
+ .enum(['events', 'internal-events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view'])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(hogFunctionsEnableBackfillsCreateBodyFiltersOneSourceDefault),
actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),
@@ -1031,9 +1049,15 @@ export const HogFunctionsEnableBackfillsCreateBody = /* @__PURE__ */ zod.object(
filters: zod
.object({
source: zod
- .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view'])
+ .enum([
+ 'events',
+ 'internal-events',
+ 'person-updates',
+ 'data-warehouse-table',
+ 'data-warehouse-view',
+ ])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(hogFunctionsEnableBackfillsCreateBodyMappingsItemFiltersSourceDefault),
actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),
@@ -1263,9 +1287,15 @@ export const HogFunctionsInvocationsCreateBody = /* @__PURE__ */ zod.object({
filters: zod
.object({
source: zod
- .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view'])
+ .enum([
+ 'events',
+ 'internal-events',
+ 'person-updates',
+ 'data-warehouse-table',
+ 'data-warehouse-view',
+ ])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(hogFunctionsInvocationsCreateBodyConfigurationOneFiltersOneSourceDefault),
actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),
@@ -1379,9 +1409,15 @@ export const HogFunctionsInvocationsCreateBody = /* @__PURE__ */ zod.object({
filters: zod
.object({
source: zod
- .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view'])
+ .enum([
+ 'events',
+ 'internal-events',
+ 'person-updates',
+ 'data-warehouse-table',
+ 'data-warehouse-view',
+ ])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(
hogFunctionsInvocationsCreateBodyConfigurationOneMappingsItemFiltersSourceDefault
diff --git a/products/workflows/backend/api/hog_flow.py b/products/workflows/backend/api/hog_flow.py
index 47204427c4d7..f92af0a10881 100644
--- a/products/workflows/backend/api/hog_flow.py
+++ b/products/workflows/backend/api/hog_flow.py
@@ -135,6 +135,7 @@ from products.workflows.backend.models.hog_flow.hog_flow import (
ROW_SCOPED_TRIGGER_TYPES,
SUPPORTED_ACTION_TYPES,
TRIGGER_TYPES,
+ WORKFLOW_SAFE_INTERNAL_EVENTS,
HogFlow,
)
from products.workflows.backend.models.hog_flow_batch_job import HogFlowBatchJob
@@ -1163,17 +1164,18 @@ class HogFlowActionSerializer(serializers.Serializer):
config = HogFlowActionConfigField(
help_text=(
"Type-specific config keyed by action type. "
- "trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|slack-message|github-event, "
+ "trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|internal-event, "
"filters?}. "
- "slack-message runs once per message posted in a connected Slack channel, and takes only "
- "filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, "
- "subtype, is_thread_reply). Runs are person-less, so person-dependent steps are rejected. "
- "github-event runs once per matching GitHub delivery, and takes only filters: "
- "{properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, "
- "bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, "
- "repository_visibility). repository and event_type are required, each with an exact-match filter; "
- "without them the trigger runs on every delivery from every connected repository. Runs are "
- "person-less, so person-dependent steps are rejected. "
+ "internal-event requires filters.events naming one or more allowed event ids, and runs once "
+ "for each matching event on the internal-events stream. Runs are person-less, so "
+ "person-dependent steps are rejected. "
+ "$slack_message_received takes filters: {properties: [<cond>]} over the message properties "
+ "(channel, user, bot_id, text, subtype, is_thread_reply), and requires an exact-match channel "
+ "filter; without one it runs on every message in every connected channel. "
+ "$github_event_received takes filters: {properties: [<cond>]} over the delivery properties "
+ "(repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, "
+ "title, body, review_state, branch, repository_visibility), and requires exact-match repository "
+ "and event_type filters; without them it runs on every delivery from every connected repository. "
"webhook and "
"manual triggers also require template_id: 'template-source-webhook', and tracking_pixel "
"requires template_id: 'template-source-webhook-pixel'. "
@@ -1475,59 +1477,65 @@ class HogFlowActionSerializer(serializers.Serializer):
else:
serializer.is_valid(raise_exception=True)
data["config"]["filters"] = serializer.validated_data
- elif data.get("config", {}).get("type") == "slack-message":
- # Everything the trigger selects on — channel, poster, text, thread — is a property
- # of the Slack message, so there is no config beyond the filters. The event name is
- # fixed, which is what makes an events/actions entry here meaningless.
+ elif data.get("config", {}).get("type") == "internal-event":
filters = data.get("config", {}).get("filters", {}) or {}
if not isinstance(filters, dict):
raise serializers.ValidationError({"filters": "Filters must be a dictionary."})
- filters.pop("events", None)
- filters.pop("actions", None)
- _normalize_slack_channel_filters(filters)
- if not is_draft and not _has_slack_channel_filter(filters):
- raise serializers.ValidationError(
- {
- "filters": "Pick a Slack channel for this trigger. Without one it runs on every message in every channel the Slack bot is in."
- }
- )
- # Left on the default "events" source: the internal event is event-shaped, so
- # property filters compile against event.properties.* with no special casing.
- serializer = HogFunctionFiltersSerializer(data=filters, context=self.context)
- if is_draft:
- if serializer.is_valid():
- data["config"]["filters"] = serializer.validated_data
- else:
- serializer.is_valid(raise_exception=True)
- data["config"]["filters"] = serializer.validated_data
- elif data.get("config", {}).get("type") == "github-event":
- # Repository, event type and actor are all properties of the delivery rather than
- # fields of their own, so there is no config beyond the filters - same shape as
- # slack-message.
- filters = data.get("config", {}).get("filters", {}) or {}
- if not isinstance(filters, dict):
- raise serializers.ValidationError({"filters": "Filters must be a dictionary."})
- filters.pop("events", None)
- filters.pop("actions", None)
- if not is_draft and not _has_exact_string_filter(filters, "repository"):
+ filters["source"] = "internal-events"
+ # HogFunctionFiltersSerializer below rejects a non-list events with a 400. Guard the
+ # scan so a malformed value (null, a number) reaches that check instead of raising
+ # TypeError here, which would escape DRF and 500 the request.
+ events = filters.get("events")
+ # Starting a workflow needs only hog_flow:write, while the events on this stream
+ # carry data their own products gate behind narrower scopes. Allowlist rather than
+ # blocklist, so a newly emitted internal event is unreachable until someone decides
+ # it is safe to expose.
+ disallowed = sorted(
+ {
+ event["id"]
+ for event in (events if isinstance(events, list) else [])
+ if isinstance(event, dict)
+ and isinstance(event.get("id"), str)
+ and event["id"] not in WORKFLOW_SAFE_INTERNAL_EVENTS
+ }
+ )
+ if disallowed:
raise serializers.ValidationError(
{
- "filters": "Pick a repository for this trigger. Without one it runs on every delivery from every repository the GitHub app is installed on."
+ "filters": f"These events cannot trigger a workflow: {', '.join(disallowed)}. "
+ "They belong to another product, which controls who can read them."
}
)
- if not is_draft and not _has_exact_string_filter(filters, "event_type"):
- raise serializers.ValidationError(
- {"filters": "Pick at least one event, or the trigger will never fire."}
+
+ def _subscribes_to(event_id: str) -> bool:
+ return isinstance(events, list) and any(
+ isinstance(event, dict) and event.get("id") == event_id for event in events
)
- # Left on the default "events" source: the internal event is event-shaped, so
- # property filters compile against event.properties.* with no special casing.
+
+ # Each internal event keeps the scoping invariant its own product needs. Without it
+ # the trigger fires on everything that product emits, for every workspace it reaches.
+ if _subscribes_to("$slack_message_received"):
+ _normalize_slack_channel_filters(filters)
+ if not is_draft and not _has_slack_channel_filter(filters):
+ raise serializers.ValidationError(
+ {
+ "filters": "Pick a Slack channel for this trigger. Without one it runs on every message in every channel the Slack bot is in."
+ }
+ )
+ if _subscribes_to("$github_event_received"):
+ if not is_draft and not _has_exact_string_filter(filters, "repository"):
+ raise serializers.ValidationError(
+ {
+ "filters": "Pick a repository for this trigger. Without one it runs on every delivery from every repository the GitHub app is installed on."
+ }
+ )
+ if not is_draft and not _has_exact_string_filter(filters, "event_type"):
+ raise serializers.ValidationError(
+ {"filters": "Pick at least one event, or the trigger will never fire."}
+ )
serializer = HogFunctionFiltersSerializer(data=filters, context=self.context)
- if is_draft:
- if serializer.is_valid():
- data["config"]["filters"] = serializer.validated_data
- else:
- serializer.is_valid(raise_exception=True)
- data["config"]["filters"] = serializer.validated_data
+ serializer.is_valid(raise_exception=True)
+ data["config"]["filters"] = serializer.validated_data
else:
if strict:
raise serializers.ValidationError({"config": "Invalid trigger type"})
diff --git a/products/workflows/backend/api/test/test_hog_flow.py b/products/workflows/backend/api/test/test_hog_flow.py
index 967e7eb50108..c1e3ebddd4a7 100644
--- a/products/workflows/backend/api/test/test_hog_flow.py
+++ b/products/workflows/backend/api/test/test_hog_flow.py
@@ -2414,7 +2414,7 @@ class TestHogFlowAPI(APIBaseTest):
response = self.client.post(f"/api/projects/{self.team.id}/hog_flows", hog_flow)
assert response.status_code == 201, response.json()
- def test_hog_flow_slack_trigger_stores_the_bare_channel_id(self):
+ def test_hog_flow_internal_event_trigger_stores_the_bare_slack_channel_id(self):
# The channel picker identifies a channel as `C123|#name`, but the event carries `C123`, so
# storing the composite compiles a filter that never matches and the workflow never runs.
trigger_action = {
@@ -2422,8 +2422,9 @@ class TestHogFlowAPI(APIBaseTest):
"name": "trigger_1",
"type": "trigger",
"config": {
- "type": "slack-message",
+ "type": "internal-event",
"filters": {
+ "events": [{"id": "$slack_message_received", "type": "events"}],
"properties": [
{
"key": "channel",
@@ -2431,7 +2432,7 @@ class TestHogFlowAPI(APIBaseTest):
"operator": "exact",
"type": "event",
}
- ]
+ ],
},
},
}
@@ -2440,6 +2441,7 @@ class TestHogFlowAPI(APIBaseTest):
response = self.client.post(f"/api/projects/{self.team.id}/hog_flows", hog_flow)
assert response.status_code == 201, response.json()
+ assert response.json()["trigger"]["filters"]["source"] == "internal-events"
stored = response.json()["trigger"]["filters"]["properties"][0]["value"]
assert stored == ["C0ALERTS"]
@@ -2449,7 +2451,14 @@ class TestHogFlowAPI(APIBaseTest):
"id": "trigger_node",
"name": "trigger_1",
"type": "trigger",
- "config": {"type": "slack-message", "filters": {"properties": properties}},
+ "config": {
+ "type": "internal-event",
+ "filters": {
+ "source": "internal-events",
+ "events": [{"id": "$slack_message_received", "type": "events"}],
+ "properties": properties,
+ },
+ },
}
@parameterized.expand(
@@ -2507,18 +2516,115 @@ class TestHogFlowAPI(APIBaseTest):
response = self.client.post(f"/api/projects/{self.team.id}/hog_flows", hog_flow)
assert response.status_code == 201, response.json()
+ @parameterized.expand(
+ [
+ ("replay_vision", "$replay_vision_action_ready"),
+ ("activity_log", "$activity_log_entry_created"),
+ ("error_tracking", "$error_tracking_issue_created"),
+ ("discussion", "$discussion_mention_created"),
+ ("logs_alert", "$logs_alert_firing"),
+ ("insight_alert", "$insight_alert_firing"),
+ ]
+ )
+ def test_hog_flow_internal_event_trigger_rejects_events_it_does_not_own(self, _name, event_id):
+ # Starting a workflow needs only hog_flow:write, while these events carry data their own
+ # products gate behind narrower scopes - recording content, exception detail, activity
+ # detail, alert bodies. Without the allowlist a workflow author reads all of it.
+ trigger_action = {
+ "id": "trigger_node",
+ "name": "trigger_1",
+ "type": "trigger",
+ "config": {
+ "type": "internal-event",
+ "filters": {"source": "internal-events", "events": [{"id": event_id, "type": "events"}]},
+ },
+ }
+ hog_flow = {"name": "Scraping flow", "status": "active", "actions": [trigger_action]}
+
+ response = self.client.post(f"/api/projects/{self.team.id}/hog_flows", hog_flow)
+
+ assert response.status_code == 400, response.json()
+ assert event_id in response.json()["detail"]
+
+ def test_hog_flow_internal_event_trigger_rejects_a_disallowed_event_alongside_an_allowed_one(self):
+ # Checking only the first event would let a second one smuggle the payload out.
+ trigger_action = {
+ "id": "trigger_node",
+ "name": "trigger_1",
+ "type": "trigger",
+ "config": {
+ "type": "internal-event",
+ "filters": {
+ "source": "internal-events",
+ "events": [
+ {"id": "$slack_message_received", "type": "events"},
+ {"id": "$replay_vision_action_ready", "type": "events"},
+ ],
+ "properties": [{"key": "channel", "value": ["C0ALERTS"], "operator": "exact", "type": "event"}],
+ },
+ },
+ }
+ hog_flow = {"name": "Mixed flow", "status": "active", "actions": [trigger_action]}
+
+ response = self.client.post(f"/api/projects/{self.team.id}/hog_flows", hog_flow)
+
+ assert response.status_code == 400, response.json()
+ assert "$replay_vision_action_ready" in response.json()["detail"]
+
+ def test_hog_flow_internal_event_trigger_requires_an_explicit_event_even_when_draft(self):
+ trigger_action = {
+ "id": "trigger_node",
+ "name": "trigger_1",
+ "type": "trigger",
+ "config": {"type": "internal-event", "filters": {}},
+ }
+ hog_flow = {"name": "Incomplete internal event flow", "status": "draft", "actions": [trigger_action]}
+
+ response = self.client.post(f"/api/projects/{self.team.id}/hog_flows", hog_flow)
+
+ assert response.status_code == 400, response.json()
+ assert "events" in str(response.json())
+
+ @parameterized.expand(
+ [
+ ("null", None),
+ ("number", 5),
+ ("boolean", True),
+ ]
+ )
+ def test_hog_flow_internal_event_trigger_rejects_non_list_events(self, _name, events_value):
+ trigger_action = {
+ "id": "trigger_node",
+ "name": "trigger_1",
+ "type": "trigger",
+ "config": {"type": "internal-event", "filters": {"events": events_value}},
+ }
+ hog_flow = {"name": "Malformed internal event flow", "status": "active", "actions": [trigger_action]}
+
+ response = self.client.post(f"/api/projects/{self.team.id}/hog_flows", hog_flow)
+
+ assert response.status_code == 400, response.json()
+ assert "events" in str(response.json())
+
@staticmethod
def _github_trigger_action(properties: list[dict]) -> dict:
return {
"id": "trigger_node",
"name": "trigger_1",
"type": "trigger",
- "config": {"type": "github-event", "filters": {"properties": properties}},
+ "config": {
+ "type": "internal-event",
+ "filters": {
+ "source": "internal-events",
+ "events": [{"id": "$github_event_received", "type": "events"}],
+ "properties": properties,
+ },
+ },
}
def test_hog_flow_github_trigger_saves_and_compiles_filters(self):
- # Before this branch existed, github-event fell through to "Invalid trigger type" on every
- # non-draft save, so the trigger this registers in the frontend could never activate.
+ # A GitHub trigger stores its event in the filters like every other internal event, and
+ # still has to compile its repository and event type filters on a non-draft save.
properties = [
{"key": "repository", "value": ["PostHog/posthog"], "operator": "exact", "type": "event"},
{"key": "event_type", "value": ["issues"], "operator": "exact", "type": "event"},
diff --git a/products/workflows/backend/models/hog_flow/hog_flow.py b/products/workflows/backend/models/hog_flow/hog_flow.py
index 8093a21c47e0..1f81837443b0 100644
--- a/products/workflows/backend/models/hog_flow/hog_flow.py
+++ b/products/workflows/backend/models/hog_flow/hog_flow.py
@@ -52,11 +52,18 @@ TRIGGER_TYPES: Final[frozenset[str]] = frozenset(
"webhook",
"data-warehouse-table",
"data-warehouse-view",
- "slack-message",
- "github-event",
+ "internal-event",
}
)
+# The internal events a workflow may subscribe to. The internal-events stream carries payloads
+# that each owning product gates behind its own scopes — recording content, exception detail,
+# activity detail, alert bodies — while starting a workflow needs only hog_flow:write. An
+# allowlist keeps that gap closed by default, so adding a trigger means answering the
+# authorization question for that event. Pair a new entry with a tile in
+# products/workflows/frontend/Workflows/hogflows/registry/triggers/.
+WORKFLOW_SAFE_INTERNAL_EVENTS: Final[frozenset[str]] = frozenset({"$slack_message_received", "$github_event_received"})
+
# Billable action types that are subject to rate limiting and quota tracking
# These action types incur costs and are counted against customer quotas
BILLABLE_ACTION_TYPES: Final[set[str]] = {
@@ -90,8 +97,7 @@ PERSON_DEPENDENT_ACTION_TYPES: Final[set[str]] = {
ROW_SCOPED_TRIGGER_TYPES: Final[set[str]] = {
"data-warehouse-table",
"data-warehouse-view",
- "slack-message",
- "github-event",
+ "internal-event",
}
diff --git a/products/workflows/frontend/Workflows/hogflows/hogFlowEditorLogic.tsx b/products/workflows/frontend/Workflows/hogflows/hogFlowEditorLogic.tsx
index 85aa667e7607..13e3056cf3b5 100644
--- a/products/workflows/frontend/Workflows/hogflows/hogFlowEditorLogic.tsx
+++ b/products/workflows/frontend/Workflows/hogflows/hogFlowEditorLogic.tsx
@@ -732,15 +732,11 @@ export interface hogFlowEditorLogicActions {
}
| {
filters: {
+ events: any[]
properties?: any[] | undefined
+ source: 'internal-events'
}
- type: 'github-event'
- }
- | {
- filters: {
- properties?: any[] | undefined
- }
- type: 'slack-message'
+ type: 'internal-event'
}
| {
filters: {
@@ -901,15 +897,11 @@ export interface hogFlowEditorLogicActions {
}
| {
filters: {
+ events: any[]
properties?: any[] | undefined
+ source: 'internal-events'
}
- type: 'github-event'
- }
- | {
- filters: {
- properties?: any[] | undefined
- }
- type: 'slack-message'
+ type: 'internal-event'
}
| {
filters: {
@@ -1591,15 +1583,11 @@ export interface hogFlowEditorLogicActions {
}
| {
filters: {
+ events: any[]
properties?: any[] | undefined
+ source: 'internal-events'
}
- type: 'github-event'
- }
- | {
- filters: {
- properties?: any[] | undefined
- }
- type: 'slack-message'
+ type: 'internal-event'
}
| {
filters: {
@@ -1760,15 +1748,11 @@ export interface hogFlowEditorLogicActions {
}
| {
filters: {
+ events: any[]
properties?: any[] | undefined
+ source: 'internal-events'
}
- type: 'github-event'
- }
- | {
- filters: {
- properties?: any[] | undefined
- }
- type: 'slack-message'
+ type: 'internal-event'
}
| {
filters: {
diff --git a/products/workflows/frontend/Workflows/hogflows/panel/testing/hogFlowEditorTestLogic.ts b/products/workflows/frontend/Workflows/hogflows/panel/testing/hogFlowEditorTestLogic.ts
index ff28e28bbe00..df4fdd254839 100644
--- a/products/workflows/frontend/Workflows/hogflows/panel/testing/hogFlowEditorTestLogic.ts
+++ b/products/workflows/frontend/Workflows/hogflows/panel/testing/hogFlowEditorTestLogic.ts
@@ -332,15 +332,11 @@ export interface hogFlowEditorTestLogicMeta {
}
| {
filters: {
+ events: any[]
properties?: any[] | undefined
+ source: 'internal-events'
}
- type: 'github-event'
- }
- | {
- filters: {
- properties?: any[] | undefined
- }
- type: 'slack-message'
+ type: 'internal-event'
}
| {
filters: {
@@ -468,15 +464,11 @@ export interface hogFlowEditorTestLogicMeta {
}
| {
filters: {
+ events: any[]
properties?: any[] | undefined
+ source: 'internal-events'
}
- type: 'github-event'
- }
- | {
- filters: {
- properties?: any[] | undefined
- }
- type: 'slack-message'
+ type: 'internal-event'
}
| {
filters: {
diff --git a/products/workflows/frontend/Workflows/hogflows/registry/triggers/github.test.ts b/products/workflows/frontend/Workflows/hogflows/registry/triggers/github.test.ts
index 03f2e61b13f9..2a4fac551d89 100644
--- a/products/workflows/frontend/Workflows/hogflows/registry/triggers/github.test.ts
+++ b/products/workflows/frontend/Workflows/hogflows/registry/triggers/github.test.ts
@@ -93,7 +93,14 @@ describe('github event trigger', () => {
valid: true,
},
])('validate returns valid=$valid for $name', ({ properties, valid }) => {
- const result = getTriggerType().validate!({ type: 'github-event', filters: { properties } } as any)
+ const result = getTriggerType().validate!({
+ type: 'internal-event',
+ filters: {
+ source: 'internal-events',
+ events: [{ id: '$github_event_received', type: 'events' }],
+ properties,
+ },
+ } as any)
expect(result?.valid).toBe(valid)
})
diff --git a/products/workflows/frontend/Workflows/hogflows/registry/triggers/github.tsx b/products/workflows/frontend/Workflows/hogflows/registry/triggers/github.tsx
index c3952b537215..f3080909ba1d 100644
--- a/products/workflows/frontend/Workflows/hogflows/registry/triggers/github.tsx
+++ b/products/workflows/frontend/Workflows/hogflows/registry/triggers/github.tsx
@@ -16,28 +16,16 @@ import { HogFlowPropertyFilters } from 'products/workflows/frontend/Workflows/ho
import { registerTriggerType } from 'products/workflows/frontend/Workflows/hogflows/registry/triggers/triggerTypeRegistry'
import { workflowLogic } from 'products/workflows/frontend/Workflows/workflowLogic'
-import { HogFlowAction } from '../../types'
import {
GITHUB_ACTOR_MODE_OPTIONS,
GITHUB_EVENT_TYPE_OPTIONS,
GithubActorMode,
decodeGithubFilters,
encodeGithubFilters,
+ InternalEventGithubTriggerConfig,
+ isGithubEventTriggerConfig,
} from './githubTriggerFilters'
-export type GithubEventTriggerConfig = {
- type: 'github-event'
- filters: {
- properties?: any[]
- }
-}
-
-export function isGithubEventTriggerConfig(
- config: Extract<HogFlowAction, { type: 'trigger' }>['config']
-): config is GithubEventTriggerConfig {
- return config.type === 'github-event'
-}
-
// GitHub deliveries never reach ClickHouse, so the advanced list has no stored values to
// autocomplete from and the properties have to be declared.
const ADVANCED_PROPERTIES: { key: string; type: PropertyType }[] = [
@@ -65,15 +53,19 @@ function StepTriggerConfigurationGithubEvent({ node }: { node: any }): JSX.Eleme
const { actionValidationErrorsById } = useValues(workflowLogic)
const { integrations, integrationsLoading } = useValues(integrationsLogic)
- const config = node.data.config as GithubEventTriggerConfig
+ const config = node.data.config as InternalEventGithubTriggerConfig
const filters = decodeGithubFilters(config.filters?.properties)
const validationResult = actionValidationErrorsById[node.data.id]
const githubIntegrations = (integrations ?? []).filter((integration) => integration.kind === 'github')
const update = (changes: Partial<typeof filters>): void => {
setWorkflowActionConfig(node.data.id, {
- type: 'github-event',
- filters: { properties: encodeGithubFilters({ ...filters, ...changes }) },
+ type: 'internal-event',
+ filters: {
+ source: 'internal-events',
+ events: [{ id: '$github_event_received', type: 'events' }],
+ properties: encodeGithubFilters({ ...filters, ...changes }),
+ },
})
}
@@ -198,6 +190,8 @@ function StepTriggerConfigurationGithubEvent({ node }: { node: any }): JSX.Eleme
}
registerTriggerType({
+ // The tile's own identity, not the stored config type: `internal-event` carries every internal
+ // event, so naming the tile after it would make the GitHub tile claim all of them.
value: 'github-event',
label: 'GitHub activity',
icon: <IconGithub />,
@@ -206,8 +200,10 @@ registerTriggerType({
featureFlag: 'github-workflow-triggers',
matchConfig: (config) => isGithubEventTriggerConfig(config),
buildConfig: () => ({
- type: 'github-event',
+ type: 'internal-event',
filters: {
+ source: 'internal-events',
+ events: [{ id: '$github_event_received', type: 'events' }],
properties: encodeGithubFilters({
repository: null,
eventTypes: [],
@@ -218,7 +214,7 @@ registerTriggerType({
},
}),
validate: (config): { valid: boolean; errors: Record<string, string> } | null => {
- if (config.type !== 'github-event') {
+ if (!isGithubEventTriggerConfig(config)) {
return null
}
const filters = decodeGithubFilters(config.filters?.properties)
diff --git a/products/workflows/frontend/Workflows/hogflows/registry/triggers/githubTriggerFilters.ts b/products/workflows/frontend/Workflows/hogflows/registry/triggers/githubTriggerFilters.ts
index 4a862f179484..7aa4936e3e88 100644
--- a/products/workflows/frontend/Workflows/hogflows/registry/triggers/githubTriggerFilters.ts
+++ b/products/workflows/frontend/Workflows/hogflows/registry/triggers/githubTriggerFilters.ts
@@ -1,5 +1,39 @@
import { PropertyFilterType, PropertyOperator } from '~/types'
+/** pinned: analytics event name emitted by the GitHub trigger */
+const GITHUB_EVENT_RECEIVED_EVENT = '$github_event_received'
+
+/** The stored trigger config a GitHub workflow uses. */
+export type InternalEventGithubTriggerConfig = {
+ type: 'internal-event'
+ filters: {
+ source: 'internal-events'
+ events: { id: string; type: 'events' }[]
+ properties?: any[]
+ }
+}
+
+// Callers pass whatever trigger a workflow carries, including malformed shapes, so every level is
+// checked before it is read.
+export function isGithubEventTriggerConfig(config: unknown): config is InternalEventGithubTriggerConfig {
+ if (!config || typeof config !== 'object') {
+ return false
+ }
+ const { type, filters } = config as { type?: unknown; filters?: unknown }
+ if (type !== 'internal-event' || !filters || typeof filters !== 'object') {
+ return false
+ }
+ const { source, events } = filters as { source?: unknown; events?: unknown }
+ return (
+ source === 'internal-events' &&
+ Array.isArray(events) &&
+ events.some(
+ (event) =>
+ event && typeof event === 'object' && (event as { id?: unknown }).id === GITHUB_EVENT_RECEIVED_EVENT
+ )
+ )
+}
+
/** Who is allowed to start a run. Each mode compiles to exactly one property filter. */
export type GithubActorMode = 'write_access' | 'anyone' | 'people' | 'specific_people'
diff --git a/products/workflows/frontend/Workflows/hogflows/registry/triggers/slack.test.ts b/products/workflows/frontend/Workflows/hogflows/registry/triggers/slack.test.ts
index 3ae2aca40992..48a165940c04 100644
--- a/products/workflows/frontend/Workflows/hogflows/registry/triggers/slack.test.ts
+++ b/products/workflows/frontend/Workflows/hogflows/registry/triggers/slack.test.ts
@@ -99,11 +99,18 @@ describe('slack message trigger', () => {
{ name: 'channel filter present', properties: [{ key: 'channel', value: ['C0ALERTS'] }], valid: true },
{ name: 'other filters alone', properties: [{ key: 'text', value: ['fire'] }], valid: false },
])('validate returns valid=$valid for $name', ({ properties, valid }) => {
- const result = getTriggerType().validate!({ type: 'slack-message', filters: { properties } } as any)
+ const result = getTriggerType().validate!({
+ type: 'internal-event',
+ filters: {
+ source: 'internal-events',
+ events: [{ id: '$slack_message_received', type: 'events' }],
+ properties,
+ },
+ } as any)
expect(result?.valid).toBe(valid)
})
- it('validate returns null for a non slack-message config', () => {
+ it('validate returns null for a non-Slack internal-event config', () => {
expect(getTriggerType().validate!({ type: 'event', filters: {} } as any)).toBeNull()
})
@@ -111,10 +118,26 @@ describe('slack message trigger', () => {
expect(getTriggerType().featureFlag).toBe('slack-workflow-triggers')
})
+ it('does not claim an internal-event config for a different event', () => {
+ // The tile is one of several that can own an `internal-event` config, so it identifies
+ // itself by its own value. Naming it after the config type made it match every internal
+ // event, and a non-Slack trigger rendered with the Slack icon and Slack config panel.
+ expect(getTriggerType().value).not.toBe('internal-event')
+ expect(
+ getTriggerType().matchConfig!({
+ type: 'internal-event',
+ filters: {
+ source: 'internal-events',
+ events: [{ id: '$activity_log_entry_created', type: 'events' }],
+ },
+ } as any)
+ ).toBe(false)
+ })
+
it('buildConfig produces a config recognized by matchConfig', () => {
const triggerType = getTriggerType()
const config = triggerType.buildConfig()
- expect(config.type).toBe('slack-message')
+ expect(config.type).toBe('internal-event')
expect(triggerType.matchConfig!(config)).toBe(true)
})
diff --git a/products/workflows/frontend/Workflows/hogflows/registry/triggers/slack.tsx b/products/workflows/frontend/Workflows/hogflows/registry/triggers/slack.tsx
index 6305233652fd..bcb4bd1de572 100644
--- a/products/workflows/frontend/Workflows/hogflows/registry/triggers/slack.tsx
+++ b/products/workflows/frontend/Workflows/hogflows/registry/triggers/slack.tsx
@@ -16,27 +16,15 @@ import { HogFlowPropertyFilters } from 'products/workflows/frontend/Workflows/ho
import { registerTriggerType } from 'products/workflows/frontend/Workflows/hogflows/registry/triggers/triggerTypeRegistry'
import { workflowLogic } from 'products/workflows/frontend/Workflows/workflowLogic'
-import { HogFlowAction } from '../../types'
import {
SLACK_POSTER_MODE_OPTIONS,
SlackPosterMode,
decodeSlackFilters,
encodeSlackFilters,
+ InternalEventTriggerConfig,
+ isSlackMessageTriggerConfig,
} from './slackTriggerFilters'
-export type SlackMessageTriggerConfig = {
- type: 'slack-message'
- filters: {
- properties?: any[]
- }
-}
-
-export function isSlackMessageTriggerConfig(
- config: Extract<HogFlowAction, { type: 'trigger' }>['config']
-): config is SlackMessageTriggerConfig {
- return config.type === 'slack-message'
-}
-
// Slack messages never reach ClickHouse, so the advanced list has no stored values to
// autocomplete from and the properties have to be declared.
const ADVANCED_PROPERTIES: { key: string; type: PropertyType }[] = [
@@ -67,7 +55,7 @@ function StepTriggerConfigurationSlackMessage({ node }: { node: any }): JSX.Elem
const { actionValidationErrorsById } = useValues(workflowLogic)
const { slackIntegrations, integrationsLoading } = useValues(integrationsLogic)
- const config = node.data.config as SlackMessageTriggerConfig
+ const config = node.data.config as InternalEventTriggerConfig
const filters = decodeSlackFilters(config.filters?.properties)
const validationResult = actionValidationErrorsById[node.data.id]
const integrations = slackIntegrations ?? []
@@ -75,8 +63,12 @@ function StepTriggerConfigurationSlackMessage({ node }: { node: any }): JSX.Elem
const update = (changes: Partial<typeof filters>): void => {
setWorkflowActionConfig(node.data.id, {
- type: 'slack-message',
- filters: { properties: encodeSlackFilters({ ...filters, ...changes }) },
+ type: 'internal-event',
+ filters: {
+ source: 'internal-events',
+ events: [{ id: '$slack_message_received', type: 'events' }],
+ properties: encodeSlackFilters({ ...filters, ...changes }),
+ },
})
}
@@ -185,6 +177,8 @@ function StepTriggerConfigurationSlackMessage({ node }: { node: any }): JSX.Elem
}
registerTriggerType({
+ // The tile's own identity, not the stored config type: `internal-event` carries every internal
+ // event, so naming the tile after it would make the Slack tile claim all of them.
value: 'slack-message',
label: 'Slack message posted',
icon: <IconSlack />,
@@ -193,8 +187,10 @@ registerTriggerType({
featureFlag: 'slack-workflow-triggers',
matchConfig: (config) => isSlackMessageTriggerConfig(config),
buildConfig: () => ({
- type: 'slack-message',
+ type: 'internal-event',
filters: {
+ source: 'internal-events',
+ events: [{ id: '$slack_message_received', type: 'events' }],
properties: encodeSlackFilters({
channel: null,
posterMode: 'people',
@@ -205,7 +201,7 @@ registerTriggerType({
},
}),
validate: (config): { valid: boolean; errors: Record<string, string> } | null => {
- if (config.type !== 'slack-message') {
+ if (!isSlackMessageTriggerConfig(config)) {
return null
}
const filters = decodeSlackFilters(config.filters?.properties)
diff --git a/products/workflows/frontend/Workflows/hogflows/registry/triggers/slackTriggerFilters.ts b/products/workflows/frontend/Workflows/hogflows/registry/triggers/slackTriggerFilters.ts
index 87b1de2be41a..750b524ac72b 100644
--- a/products/workflows/frontend/Workflows/hogflows/registry/triggers/slackTriggerFilters.ts
+++ b/products/workflows/frontend/Workflows/hogflows/registry/triggers/slackTriggerFilters.ts
@@ -1,5 +1,39 @@
import { PropertyFilterType, PropertyOperator } from '~/types'
+/** pinned: analytics event name emitted by the Slack trigger */
+const SLACK_MESSAGE_RECEIVED_EVENT = '$slack_message_received'
+
+/** The stored trigger config a Slack message workflow uses. */
+export type InternalEventTriggerConfig = {
+ type: 'internal-event'
+ filters: {
+ source: 'internal-events'
+ events: { id: string; type: 'events' }[]
+ properties?: any[]
+ }
+}
+
+// Callers pass whatever trigger a workflow carries, including legacy and malformed shapes, so
+// every level is checked before it is read.
+export function isSlackMessageTriggerConfig(config: unknown): config is InternalEventTriggerConfig {
+ if (!config || typeof config !== 'object') {
+ return false
+ }
+ const { type, filters } = config as { type?: unknown; filters?: unknown }
+ if (type !== 'internal-event' || !filters || typeof filters !== 'object') {
+ return false
+ }
+ const { source, events } = filters as { source?: unknown; events?: unknown }
+ return (
+ source === 'internal-events' &&
+ Array.isArray(events) &&
+ events.some(
+ (event) =>
+ event && typeof event === 'object' && (event as { id?: unknown }).id === SLACK_MESSAGE_RECEIVED_EVENT
+ )
+ )
+}
+
/** Who is allowed to start a run. Each mode compiles to exactly one property filter. */
export type SlackPosterMode = 'anyone' | 'people' | 'specific_people' | 'apps' | 'specific_apps'
diff --git a/products/workflows/frontend/Workflows/hogflows/steps/StepTrigger.tsx b/products/workflows/frontend/Workflows/hogflows/steps/StepTrigger.tsx
index 2e67c4e2b896..3267b74291ec 100644
--- a/products/workflows/frontend/Workflows/hogflows/steps/StepTrigger.tsx
+++ b/products/workflows/frontend/Workflows/hogflows/steps/StepTrigger.tsx
@@ -83,9 +83,9 @@ type TriggerOptionItem = {
}
function getTriggerDisplayType(type: string, config: any): string {
- if (type !== 'event') {
- return type
- }
+ // Several tiles can share one config type (`event`, `internal-event`), so the tile is whichever
+ // one claims this config, not the type itself. Types owned by a single tile fall through to the
+ // type, which is that tile's value.
const match = getRegisteredTriggerTypes().find((t) => t.matchConfig?.(config))
return match ? match.value : type
}
diff --git a/products/workflows/frontend/Workflows/hogflows/steps/components/HogFlowFunctionConfiguration.test.ts b/products/workflows/frontend/Workflows/hogflows/steps/components/HogFlowFunctionConfiguration.test.ts
index c34efeeb579a..0a6073b686ff 100644
--- a/products/workflows/frontend/Workflows/hogflows/steps/components/HogFlowFunctionConfiguration.test.ts
+++ b/products/workflows/frontend/Workflows/hogflows/steps/components/HogFlowFunctionConfiguration.test.ts
@@ -1,17 +1,29 @@
import { buildSampleGlobals, filterInputsSchemaForTrigger } from './HogFlowFunctionConfiguration'
+// The stored shape a Slack message workflow carries. The trigger type alone no longer identifies
+// it, so every case below passes the whole config.
+const slackTrigger = {
+ type: 'internal-event',
+ filters: { source: 'internal-events', events: [{ id: '$slack_message_received', type: 'events' }] },
+}
+
+const githubTrigger = {
+ type: 'internal-event',
+ filters: { source: 'internal-events', events: [{ id: '$github_event_received', type: 'events' }] },
+}
+
describe('HogFlowFunctionConfiguration', () => {
describe('buildSampleGlobals', () => {
it.each([
- ['event', { event: true, person: true, groups: true, request: false }],
- ['batch', { event: true, person: true, groups: false, request: false }],
- ['webhook', { event: false, person: false, groups: false, request: true }],
+ ['event', { type: 'event' }, { event: true, person: true, groups: true, request: false }],
+ ['batch', { type: 'batch' }, { event: true, person: true, groups: false, request: false }],
+ ['webhook', { type: 'webhook' }, { event: false, person: false, groups: false, request: true }],
// Slack-triggered runs are person-less.
- ['slack-message', { event: true, person: false, groups: false, request: false }],
+ ['slack message', slackTrigger, { event: true, person: false, groups: false, request: false }],
// GitHub-triggered runs are person-less too.
- ['github-event', { event: true, person: false, groups: false, request: false }],
- ])('exposes the right globals for a %s trigger', (triggerType, present) => {
- const globals = buildSampleGlobals(triggerType, undefined)
+ ['github event', githubTrigger, { event: true, person: false, groups: false, request: false }],
+ ])('exposes the right globals for a %s trigger', (_name, trigger, present) => {
+ const globals = buildSampleGlobals(trigger, undefined)
Object.entries(present).forEach(([key, shouldExist]) => {
expect(key in globals).toBe(shouldExist)
})
@@ -20,13 +32,13 @@ describe('HogFlowFunctionConfiguration', () => {
// Batch runs have no external event, but the worker backfills event.distinct_id at dequeue, so the
// editor must expose event.distinct_id for batch or {event.distinct_id} wrongly warns as unknown.
it.each(['event', 'batch'])('exposes event.distinct_id for a %s trigger', (triggerType) => {
- expect(buildSampleGlobals(triggerType, undefined).event).toHaveProperty('distinct_id')
+ expect(buildSampleGlobals({ type: triggerType }, undefined).event).toHaveProperty('distinct_id')
})
// Locks the sample property names to what the Slack trigger emits, so hand-typed
// expressions like {event.properties.text} autocomplete instead of warning as unknown.
- it('exposes the Slack message properties for a slack-message trigger', () => {
- const properties = buildSampleGlobals('slack-message', undefined).event.properties
+ it('exposes the Slack message properties for a Slack message trigger', () => {
+ const properties = buildSampleGlobals(slackTrigger, undefined).event.properties
expect(properties).toMatchObject({
channel: expect.any(String),
text: expect.any(String),
@@ -40,8 +52,8 @@ describe('HogFlowFunctionConfiguration', () => {
// Locks the sample property names to what the GitHub trigger emits, so hand-typed
// expressions like {event.properties.actor_access} autocomplete instead of warning as unknown.
- it('exposes the GitHub event properties for a github-event trigger', () => {
- const properties = buildSampleGlobals('github-event', undefined).event.properties
+ it('exposes the GitHub event properties for a GitHub trigger', () => {
+ const properties = buildSampleGlobals(githubTrigger, undefined).event.properties
expect(properties).toMatchObject({
event_type: expect.any(String),
repository: expect.any(String),
@@ -69,16 +81,26 @@ describe('HogFlowFunctionConfiguration', () => {
const aiTaskSchema = [{ key: 'prompt' }, { key: 'reply_in_slack_thread' }]
it.each([
- ['slack-message', ['prompt', 'reply_in_slack_thread']],
- ['event', ['prompt']],
- [undefined, ['prompt']],
- ])('for the AI task step on a %s trigger shows %j', (triggerType, expectedKeys) => {
- const filtered = filterInputsSchemaForTrigger('template-posthog-create-task', triggerType, aiTaskSchema)
+ ['slack message', slackTrigger, ['prompt', 'reply_in_slack_thread']],
+ ['event', { type: 'event' }, ['prompt']],
+ ['undefined', undefined, ['prompt']],
+ // An internal-event trigger for some other event is not a Slack trigger.
+ [
+ 'other internal event',
+ { type: 'internal-event', filters: { source: 'internal-events', events: [{ id: '$other' }] } },
+ ['prompt'],
+ ],
+ // A stored trigger from before the rename must not resolve as a Slack trigger.
+ ['legacy slack-message', { type: 'slack-message', filters: {} }, ['prompt']],
+ ])('for the AI task step on a %s trigger shows %j', (_name, trigger, expectedKeys) => {
+ const filtered = filterInputsSchemaForTrigger('template-posthog-create-task', trigger, aiTaskSchema)
expect(filtered.map((s) => s.key)).toEqual(expectedKeys)
})
it('leaves other templates untouched', () => {
- expect(filterInputsSchemaForTrigger('template-email', 'event', aiTaskSchema)).toEqual(aiTaskSchema)
+ expect(filterInputsSchemaForTrigger('template-email', { type: 'event' }, aiTaskSchema)).toEqual(
+ aiTaskSchema
+ )
})
})
})
diff --git a/products/workflows/frontend/Workflows/hogflows/steps/components/HogFlowFunctionConfiguration.tsx b/products/workflows/frontend/Workflows/hogflows/steps/components/HogFlowFunctionConfiguration.tsx
index db331b9203dd..1416769ddb3b 100644
--- a/products/workflows/frontend/Workflows/hogflows/steps/components/HogFlowFunctionConfiguration.tsx
+++ b/products/workflows/frontend/Workflows/hogflows/steps/components/HogFlowFunctionConfiguration.tsx
@@ -14,6 +14,8 @@ import { urls } from 'scenes/urls'
import { CyclotronJobInputType, HogFunctionMappingType } from '~/types'
import { workflowLogic } from '../../../workflowLogic'
+import { isGithubEventTriggerConfig } from '../../registry/triggers/githubTriggerFilters'
+import { isSlackMessageTriggerConfig } from '../../registry/triggers/slackTriggerFilters'
import { HogFlowFunctionMappings } from './HogFlowFunctionMappings'
import { WorkflowAutoSaveIndicator } from './WorkflowAutoSaveIndicator'
@@ -22,9 +24,10 @@ import { WorkflowAutoSaveIndicator } from './WorkflowAutoSaveIndicator'
// but the worker backfills a real event.distinct_id at dequeue, so batch must expose `event` too or
// the editor wrongly flags {event.distinct_id} as unknown.
export function buildSampleGlobals(
- triggerType: string | undefined,
+ trigger: { type?: string; filters?: unknown } | undefined | null,
variables: Array<Record<string, any>> | undefined | null
): Record<string, any> {
+ const triggerType = trigger?.type
const workflowVariables: Record<string, any> = {}
variables?.forEach((variable) => {
// Use placeholder values based on variable type
@@ -86,7 +89,7 @@ export function buildSampleGlobals(
name: 'John Doe',
},
}
- } else if (triggerType === 'slack-message') {
+ } else if (isSlackMessageTriggerConfig(trigger)) {
// Property names mirror what the Slack trigger emits (slack_workflow_events.py). No
// person: Slack-triggered runs are person-less.
sampleGlobals.event = {
@@ -110,7 +113,7 @@ export function buildSampleGlobals(
},
timestamp: '2024-01-01T12:00:00Z',
}
- } else if (triggerType === 'github-event') {
+ } else if (isGithubEventTriggerConfig(trigger)) {
// Property names mirror what the GitHub trigger emits (github_workflow_events.py). No
// person: GitHub-triggered runs are person-less.
sampleGlobals.event = {
@@ -148,10 +151,10 @@ export function buildSampleGlobals(
// the workflow; on other triggers the runtime no-ops it, so hide it rather than explain it.
export function filterInputsSchemaForTrigger<T extends { key: string }>(
templateId: string,
- triggerType: string | undefined,
+ trigger: { type?: string; filters?: unknown } | undefined | null,
inputsSchema: T[]
): T[] {
- if (templateId === 'template-posthog-create-task' && triggerType !== 'slack-message') {
+ if (templateId === 'template-posthog-create-task' && !isSlackMessageTriggerConfig(trigger)) {
return inputsSchema.filter((schema) => schema.key !== 'reply_in_slack_thread')
}
return inputsSchema
@@ -210,12 +213,11 @@ export function HogFlowFunctionConfiguration({
return <TemplateNotFoundFallback templateId={templateId} />
}
- const triggerType = workflow?.trigger?.type
- const sampleGlobals = buildSampleGlobals(triggerType, workflow?.variables)
+ const sampleGlobals = buildSampleGlobals(workflow?.trigger, workflow?.variables)
// Native push carries a long tail of optional Android/iOS override fields. Keep the core message
// fields inline and tuck the platform-specific ones into collapsed sections so the form stays flat.
- const inputsSchema = filterInputsSchemaForTrigger(templateId, triggerType, template.inputs_schema ?? [])
+ const inputsSchema = filterInputsSchemaForTrigger(templateId, workflow?.trigger, template.inputs_schema ?? [])
const isPlatformInput = (key: string): boolean => key.startsWith('android_') || key.startsWith('ios_')
const coreInputsSchema = isPushStep ? inputsSchema.filter((s) => !isPlatformInput(s.key)) : inputsSchema
const androidInputsSchema = isPushStep ? inputsSchema.filter((s) => s.key.startsWith('android_')) : []
diff --git a/products/workflows/frontend/Workflows/hogflows/steps/stepDelayLogic.ts b/products/workflows/frontend/Workflows/hogflows/steps/stepDelayLogic.ts
index 33030637186d..0977ea5bcce8 100644
--- a/products/workflows/frontend/Workflows/hogflows/steps/stepDelayLogic.ts
+++ b/products/workflows/frontend/Workflows/hogflows/steps/stepDelayLogic.ts
@@ -218,15 +218,11 @@ export interface stepDelayLogicActions {
}
| {
filters: {
+ events: any[]
properties?: any[] | undefined
+ source: 'internal-events'
}
- type: 'github-event'
- }
- | {
- filters: {
- properties?: any[] | undefined
- }
- type: 'slack-message'
+ type: 'internal-event'
}
| {
condition: {
@@ -497,15 +493,11 @@ export interface stepDelayLogicActions {
}
| {
filters: {
+ events: any[]
properties?: any[] | undefined
+ source: 'internal-events'
}
- type: 'github-event'
- }
- | {
- filters: {
- properties?: any[] | undefined
- }
- type: 'slack-message'
+ type: 'internal-event'
}
| {
filters: {
diff --git a/products/workflows/frontend/Workflows/hogflows/steps/stepWaitUntilTimeWindowLogic.ts b/products/workflows/frontend/Workflows/hogflows/steps/stepWaitUntilTimeWindowLogic.ts
index 398d2f756ed8..b337d24f3ffe 100644
--- a/products/workflows/frontend/Workflows/hogflows/steps/stepWaitUntilTimeWindowLogic.ts
+++ b/products/workflows/frontend/Workflows/hogflows/steps/stepWaitUntilTimeWindowLogic.ts
@@ -143,15 +143,11 @@ export interface stepWaitUntilTimeWindowLogicActions {
}
| {
filters: {
+ events: any[]
properties?: any[] | undefined
+ source: 'internal-events'
}
- type: 'github-event'
- }
- | {
- filters: {
- properties?: any[] | undefined
- }
- type: 'slack-message'
+ type: 'internal-event'
}
| {
condition: {
@@ -423,15 +419,11 @@ export interface stepWaitUntilTimeWindowLogicActions {
}
| {
filters: {
+ events: any[]
properties?: any[] | undefined
+ source: 'internal-events'
}
- type: 'github-event'
- }
- | {
- filters: {
- properties?: any[] | undefined
- }
- type: 'slack-message'
+ type: 'internal-event'
}
| {
filters: {
diff --git a/products/workflows/frontend/Workflows/hogflows/steps/types.ts b/products/workflows/frontend/Workflows/hogflows/steps/types.ts
index f1f135d2744d..fb2209bd8990 100644
--- a/products/workflows/frontend/Workflows/hogflows/steps/types.ts
+++ b/products/workflows/frontend/Workflows/hogflows/steps/types.ts
@@ -190,9 +190,10 @@ export const HogFlowTriggerSchema = z.discriminatedUnion('type', [
key_property: z.string().optional(),
}),
z.object({
- type: z.literal('slack-message'),
+ type: z.literal('internal-event'),
filters: z.object({
- // Message properties only, channel included — see the trigger registry entry
+ source: z.literal('internal-events'),
+ events: z.array(z.any()).min(1),
properties: z.array(z.any()).optional(),
}),
}),
@@ -205,13 +206,6 @@ export const HogFlowTriggerSchema = z.discriminatedUnion('type', [
}),
key_property: z.string().optional(),
}),
- z.object({
- type: z.literal('github-event'),
- filters: z.object({
- // Delivery properties only, repository and event type included — see the registry entry
- properties: z.array(z.any()).optional(),
- }),
- }),
])
/** Trigger types that use HogFlowSchedule for recurring execution */
diff --git a/products/workflows/frontend/Workflows/workflowLogic.ts b/products/workflows/frontend/Workflows/workflowLogic.ts
index fe611cd2f8f9..3bc3cc54b4f0 100644
--- a/products/workflows/frontend/Workflows/workflowLogic.ts
+++ b/products/workflows/frontend/Workflows/workflowLogic.ts
@@ -113,14 +113,9 @@ export const NEW_WORKFLOW: HogFlow = {
export const PERSON_DEPENDENT_ACTION_TYPES = new Set(['wait_until_condition', 'random_cohort_branch'])
// Trigger types whose runs have no person attached: a synced warehouse row, a materialized view
-// row, and a Slack poster are all things no PostHog person is attached to. Keep in sync with the
-// backend's ROW_SCOPED_TRIGGER_TYPES, which is the authoritative check.
-export const ROW_SCOPED_TRIGGER_TYPES = new Set([
- 'data-warehouse-table',
- 'data-warehouse-view',
- 'slack-message',
- 'github-event',
-])
+// row, and an internal event are all things no PostHog person is attached to. Keep in sync with
+// the backend's ROW_SCOPED_TRIGGER_TYPES, which is the authoritative check.
+export const ROW_SCOPED_TRIGGER_TYPES = new Set(['data-warehouse-table', 'data-warehouse-view', 'internal-event'])
function getTemplatingError(value: string, templating?: 'liquid' | 'hog'): string | undefined {
if (templating === 'liquid' && typeof value === 'string') {
@@ -777,15 +772,11 @@ export interface workflowLogicActions {
}
| {
filters: {
+ events: any[]
properties?: any[] | undefined
+ source: 'internal-events'
}
- type: 'github-event'
- }
- | {
- filters: {
- properties?: any[] | undefined
- }
- type: 'slack-message'
+ type: 'internal-event'
}
| {
filters: {
@@ -1056,15 +1047,11 @@ export interface workflowLogicActions {
}
| {
filters: {
+ events: any[]
properties?: any[] | undefined
+ source: 'internal-events'
}
- type: 'github-event'
- }
- | {
- filters: {
- properties?: any[] | undefined
- }
- type: 'slack-message'
+ type: 'internal-event'
}
| {
filters: {
@@ -1636,15 +1623,11 @@ export interface workflowLogicActions {
}
| {
filters: {
+ events: any[]
properties?: any[] | undefined
+ source: 'internal-events'
}
- type: 'github-event'
- }
- | {
- filters: {
- properties?: any[] | undefined
- }
- type: 'slack-message'
+ type: 'internal-event'
}
| {
filters: {
@@ -1915,15 +1898,11 @@ export interface workflowLogicActions {
}
| {
filters: {
+ events: any[]
properties?: any[] | undefined
+ source: 'internal-events'
}
- type: 'github-event'
- }
- | {
- filters: {
- properties?: any[] | undefined
- }
- type: 'slack-message'
+ type: 'internal-event'
}
| {
filters: {
@@ -2102,15 +2081,11 @@ export interface workflowLogicActions {
}
| {
filters: {
+ events: any[]
properties?: any[] | undefined
+ source: 'internal-events'
}
- type: 'github-event'
- }
- | {
- filters: {
- properties?: any[] | undefined
- }
- type: 'slack-message'
+ type: 'internal-event'
}
| {
condition: {
@@ -2483,15 +2458,11 @@ export interface workflowLogicActions {
}
| {
filters: {
+ events: any[]
properties?: any[] | undefined
+ source: 'internal-events'
}
- type: 'github-event'
- }
- | {
- filters: {
- properties?: any[] | undefined
- }
- type: 'slack-message'
+ type: 'internal-event'
}
| {
condition: {
@@ -2880,15 +2851,11 @@ export interface workflowLogicMeta {
}
| {
filters: {
+ events: any[]
properties?: any[] | undefined
+ source: 'internal-events'
}
- type: 'github-event'
- }
- | {
- filters: {
- properties?: any[] | undefined
- }
- type: 'slack-message'
+ type: 'internal-event'
}
| {
filters: {
diff --git a/products/workflows/frontend/Workflows/workflowsLogic.ts b/products/workflows/frontend/Workflows/workflowsLogic.ts
index 69938c7ecb37..ab0064b35be3 100644
--- a/products/workflows/frontend/Workflows/workflowsLogic.ts
+++ b/products/workflows/frontend/Workflows/workflowsLogic.ts
@@ -33,7 +33,7 @@ export const WORKFLOW_TRIGGER_TYPE_OPTIONS: { value: WorkflowTriggerTypeFilter;
{ value: 'tracking_pixel', label: 'Tracking pixel' },
{ value: 'data-warehouse-table', label: 'Data warehouse table' },
{ value: 'data-warehouse-view', label: 'Data warehouse view' },
- { value: 'slack-message', label: 'Slack message' },
+ { value: 'internal-event', label: 'Internal event' },
]
const WORKFLOW_TRIGGER_TYPE_FILTERS = WORKFLOW_TRIGGER_TYPE_OPTIONS.map((option) => option.value)
diff --git a/products/workflows/frontend/generated/api.schemas.ts b/products/workflows/frontend/generated/api.schemas.ts
index ded130887cfd..b6cb900d1ce7 100644
--- a/products/workflows/frontend/generated/api.schemas.ts
+++ b/products/workflows/frontend/generated/api.schemas.ts
@@ -67,6 +67,7 @@ export const OnErrorEnumApi = {
/**
* * `events` - events
+ * * `internal-events` - internal-events
* * `person-updates` - person-updates
* * `data-warehouse-table` - data-warehouse-table
* * `data-warehouse-view` - data-warehouse-view
@@ -76,6 +77,7 @@ export type HogFunctionFiltersSourceEnumApi =
export const HogFunctionFiltersSourceEnumApi = {
Events: 'events',
+ InternalEvents: 'internal-events',
PersonUpdates: 'person-updates',
DataWarehouseTable: 'data-warehouse-table',
DataWarehouseView: 'data-warehouse-view',
@@ -443,7 +445,7 @@ export const HogFlowActionTypeEnumApi = {
} as const
/**
- * Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|slack-message|github-event, filters?}. slack-message runs once per message posted in a connected Slack channel, and takes only filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply). Runs are person-less, so person-dependent steps are rejected. github-event runs once per matching GitHub delivery, and takes only filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility). repository and event_type are required, each with an exact-match filter; without them the trigger runs on every delivery from every connected repository. Runs are person-less, so person-dependent steps are rejected. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open/click tracking, so opens and clicks are not recorded for that step (delivery/bounce/unsubscribe still are). Dictionary input values are template strings too — write booleans/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}.
+ * Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|internal-event, filters?}. internal-event requires filters.events naming one or more allowed event ids, and runs once for each matching event on the internal-events stream. Runs are person-less, so person-dependent steps are rejected. $slack_message_received takes filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply), and requires an exact-match channel filter; without one it runs on every message in every connected channel. $github_event_received takes filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility), and requires exact-match repository and event_type filters; without them it runs on every delivery from every connected repository. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open/click tracking, so opens and clicks are not recorded for that step (delivery/bounce/unsubscribe still are). Dictionary input values are template strings too — write booleans/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}.
*/
export type HogFlowActionApiConfig =
| { [key: string]: unknown }
@@ -504,7 +506,7 @@ export interface HogFlowActionApi {
* * `random_cohort_branch` - random_cohort_branch
* * `exit` - exit */
type: HogFlowActionTypeEnumApi
- /** Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|slack-message|github-event, filters?}. slack-message runs once per message posted in a connected Slack channel, and takes only filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply). Runs are person-less, so person-dependent steps are rejected. github-event runs once per matching GitHub delivery, and takes only filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility). repository and event_type are required, each with an exact-match filter; without them the trigger runs on every delivery from every connected repository. Runs are person-less, so person-dependent steps are rejected. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open/click tracking, so opens and clicks are not recorded for that step (delivery/bounce/unsubscribe still are). Dictionary input values are template strings too — write booleans/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}. */
+ /** Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|internal-event, filters?}. internal-event requires filters.events naming one or more allowed event ids, and runs once for each matching event on the internal-events stream. Runs are person-less, so person-dependent steps are rejected. $slack_message_received takes filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply), and requires an exact-match channel filter; without one it runs on every message in every connected channel. $github_event_received takes filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility), and requires exact-match repository and event_type filters; without them it runs on every delivery from every connected repository. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open/click tracking, so opens and clicks are not recorded for that step (delivery/bounce/unsubscribe still are). Dictionary input values are template strings too — write booleans/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}. */
config: HogFlowActionApiConfig
/** Output variable for downstream actions: {key, result_path?, spread?, label?} or a list of those. */
output_variable?: unknown
diff --git a/products/workflows/frontend/generated/api.zod.ts b/products/workflows/frontend/generated/api.zod.ts
index 42bb0a60de9f..910f76f0a711 100644
--- a/products/workflows/frontend/generated/api.zod.ts
+++ b/products/workflows/frontend/generated/api.zod.ts
@@ -93,9 +93,15 @@ export const HogFlowTemplatesCreateBody = /* @__PURE__ */ zod
.union([
zod.object({
source: zod
- .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view'])
+ .enum([
+ 'events',
+ 'internal-events',
+ 'person-updates',
+ 'data-warehouse-table',
+ 'data-warehouse-view',
+ ])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(hogFlowTemplatesCreateBodyActionsItemFiltersOneSourceDefault),
actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),
@@ -215,9 +221,15 @@ export const HogFlowTemplatesUpdateBody = /* @__PURE__ */ zod
.union([
zod.object({
source: zod
- .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view'])
+ .enum([
+ 'events',
+ 'internal-events',
+ 'person-updates',
+ 'data-warehouse-table',
+ 'data-warehouse-view',
+ ])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(hogFlowTemplatesUpdateBodyActionsItemFiltersOneSourceDefault),
actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),
@@ -345,12 +357,13 @@ export const HogFlowTemplatesPartialUpdateBody = /* @__PURE__ */ zod
source: zod
.enum([
'events',
+ 'internal-events',
'person-updates',
'data-warehouse-table',
'data-warehouse-view',
])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(hogFlowTemplatesPartialUpdateBodyActionsItemFiltersOneSourceDefault),
actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),
@@ -461,12 +474,13 @@ export const HogFlowsCreateBody = /* @__PURE__ */ zod
source: zod
.enum([
'events',
+ 'internal-events',
'person-updates',
'data-warehouse-table',
'data-warehouse-view',
])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(hogFlowsCreateBodyConversionOneEventsItemFiltersOneSourceDefault),
actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),
@@ -589,9 +603,15 @@ export const HogFlowsCreateBody = /* @__PURE__ */ zod
.union([
zod.object({
source: zod
- .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view'])
+ .enum([
+ 'events',
+ 'internal-events',
+ 'person-updates',
+ 'data-warehouse-table',
+ 'data-warehouse-view',
+ ])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(hogFlowsCreateBodyActionsItemFiltersOneSourceDefault),
actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),
@@ -644,12 +664,13 @@ export const HogFlowsCreateBody = /* @__PURE__ */ zod
source: zod
.enum([
'events',
+ 'internal-events',
'person-updates',
'data-warehouse-table',
'data-warehouse-view',
])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(
hogFlowsCreateBodyActionsItemConfigTwoConditionFiltersOneSourceDefault
@@ -692,12 +713,13 @@ export const HogFlowsCreateBody = /* @__PURE__ */ zod
source: zod
.enum([
'events',
+ 'internal-events',
'person-updates',
'data-warehouse-table',
'data-warehouse-view',
])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(
hogFlowsCreateBodyActionsItemConfigTwoEventsItemFiltersOneSourceDefault
@@ -743,7 +765,7 @@ export const HogFlowsCreateBody = /* @__PURE__ */ zod
),
])
.describe(
- "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|slack-message|github-event, filters?}. slack-message runs once per message posted in a connected Slack channel, and takes only filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply). Runs are person-less, so person-dependent steps are rejected. github-event runs once per matching GitHub delivery, and takes only filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility). repository and event_type are required, each with an exact-match filter; without them the trigger runs on every delivery from every connected repository. Runs are person-less, so person-dependent steps are rejected. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function\*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open\/click tracking, so opens and clicks are not recorded for that step (delivery\/bounce\/unsubscribe still are). Dictionary input values are template strings too — write booleans\/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person\/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."
+ "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|internal-event, filters?}. internal-event requires filters.events naming one or more allowed event ids, and runs once for each matching event on the internal-events stream. Runs are person-less, so person-dependent steps are rejected. $slack_message_received takes filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply), and requires an exact-match channel filter; without one it runs on every message in every connected channel. $github_event_received takes filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility), and requires exact-match repository and event_type filters; without them it runs on every delivery from every connected repository. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function\*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open\/click tracking, so opens and clicks are not recorded for that step (delivery\/bounce\/unsubscribe still are). Dictionary input values are template strings too — write booleans\/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person\/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."
),
output_variable: zod
.unknown()
@@ -839,12 +861,13 @@ export const HogFlowsUpdateBody = /* @__PURE__ */ zod
source: zod
.enum([
'events',
+ 'internal-events',
'person-updates',
'data-warehouse-table',
'data-warehouse-view',
])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(hogFlowsUpdateBodyConversionOneEventsItemFiltersOneSourceDefault),
actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),
@@ -967,9 +990,15 @@ export const HogFlowsUpdateBody = /* @__PURE__ */ zod
.union([
zod.object({
source: zod
- .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view'])
+ .enum([
+ 'events',
+ 'internal-events',
+ 'person-updates',
+ 'data-warehouse-table',
+ 'data-warehouse-view',
+ ])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(hogFlowsUpdateBodyActionsItemFiltersOneSourceDefault),
actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),
@@ -1022,12 +1051,13 @@ export const HogFlowsUpdateBody = /* @__PURE__ */ zod
source: zod
.enum([
'events',
+ 'internal-events',
'person-updates',
'data-warehouse-table',
'data-warehouse-view',
])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(
hogFlowsUpdateBodyActionsItemConfigTwoConditionFiltersOneSourceDefault
@@ -1070,12 +1100,13 @@ export const HogFlowsUpdateBody = /* @__PURE__ */ zod
source: zod
.enum([
'events',
+ 'internal-events',
'person-updates',
'data-warehouse-table',
'data-warehouse-view',
])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(
hogFlowsUpdateBodyActionsItemConfigTwoEventsItemFiltersOneSourceDefault
@@ -1121,7 +1152,7 @@ export const HogFlowsUpdateBody = /* @__PURE__ */ zod
),
])
.describe(
- "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|slack-message|github-event, filters?}. slack-message runs once per message posted in a connected Slack channel, and takes only filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply). Runs are person-less, so person-dependent steps are rejected. github-event runs once per matching GitHub delivery, and takes only filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility). repository and event_type are required, each with an exact-match filter; without them the trigger runs on every delivery from every connected repository. Runs are person-less, so person-dependent steps are rejected. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function\*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open\/click tracking, so opens and clicks are not recorded for that step (delivery\/bounce\/unsubscribe still are). Dictionary input values are template strings too — write booleans\/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person\/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."
+ "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|internal-event, filters?}. internal-event requires filters.events naming one or more allowed event ids, and runs once for each matching event on the internal-events stream. Runs are person-less, so person-dependent steps are rejected. $slack_message_received takes filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply), and requires an exact-match channel filter; without one it runs on every message in every connected channel. $github_event_received takes filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility), and requires exact-match repository and event_type filters; without them it runs on every delivery from every connected repository. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function\*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open\/click tracking, so opens and clicks are not recorded for that step (delivery\/bounce\/unsubscribe still are). Dictionary input values are template strings too — write booleans\/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person\/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."
),
output_variable: zod
.unknown()
@@ -1220,12 +1251,13 @@ export const HogFlowsPartialUpdateBody = /* @__PURE__ */ zod
source: zod
.enum([
'events',
+ 'internal-events',
'person-updates',
'data-warehouse-table',
'data-warehouse-view',
])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(
hogFlowsPartialUpdateBodyConversionOneEventsItemFiltersOneSourceDefault
@@ -1350,9 +1382,15 @@ export const HogFlowsPartialUpdateBody = /* @__PURE__ */ zod
.union([
zod.object({
source: zod
- .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view'])
+ .enum([
+ 'events',
+ 'internal-events',
+ 'person-updates',
+ 'data-warehouse-table',
+ 'data-warehouse-view',
+ ])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(hogFlowsPartialUpdateBodyActionsItemFiltersOneSourceDefault),
actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),
@@ -1405,12 +1443,13 @@ export const HogFlowsPartialUpdateBody = /* @__PURE__ */ zod
source: zod
.enum([
'events',
+ 'internal-events',
'person-updates',
'data-warehouse-table',
'data-warehouse-view',
])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(
hogFlowsPartialUpdateBodyActionsItemConfigTwoConditionFiltersOneSourceDefault
@@ -1453,12 +1492,13 @@ export const HogFlowsPartialUpdateBody = /* @__PURE__ */ zod
source: zod
.enum([
'events',
+ 'internal-events',
'person-updates',
'data-warehouse-table',
'data-warehouse-view',
])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(
hogFlowsPartialUpdateBodyActionsItemConfigTwoEventsItemFiltersOneSourceDefault
@@ -1504,7 +1544,7 @@ export const HogFlowsPartialUpdateBody = /* @__PURE__ */ zod
),
])
.describe(
- "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|slack-message|github-event, filters?}. slack-message runs once per message posted in a connected Slack channel, and takes only filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply). Runs are person-less, so person-dependent steps are rejected. github-event runs once per matching GitHub delivery, and takes only filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility). repository and event_type are required, each with an exact-match filter; without them the trigger runs on every delivery from every connected repository. Runs are person-less, so person-dependent steps are rejected. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function\*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open\/click tracking, so opens and clicks are not recorded for that step (delivery\/bounce\/unsubscribe still are). Dictionary input values are template strings too — write booleans\/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person\/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."
+ "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|internal-event, filters?}. internal-event requires filters.events naming one or more allowed event ids, and runs once for each matching event on the internal-events stream. Runs are person-less, so person-dependent steps are rejected. $slack_message_received takes filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply), and requires an exact-match channel filter; without one it runs on every message in every connected channel. $github_event_received takes filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility), and requires exact-match repository and event_type filters; without them it runs on every delivery from every connected repository. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function\*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open\/click tracking, so opens and clicks are not recorded for that step (delivery\/bounce\/unsubscribe still are). Dictionary input values are template strings too — write booleans\/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person\/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."
),
output_variable: zod
.unknown()
@@ -1845,12 +1885,13 @@ export const HogFlowsInvocationsCreateBody = /* @__PURE__ */ zod.object({
source: zod
.enum([
'events',
+ 'internal-events',
'person-updates',
'data-warehouse-table',
'data-warehouse-view',
])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(
hogFlowsInvocationsCreateBodyConfigurationOneConversionOneEventsItemFiltersOneSourceDefault
@@ -1984,12 +2025,13 @@ export const HogFlowsInvocationsCreateBody = /* @__PURE__ */ zod.object({
source: zod
.enum([
'events',
+ 'internal-events',
'person-updates',
'data-warehouse-table',
'data-warehouse-view',
])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(
hogFlowsInvocationsCreateBodyConfigurationOneActionsItemFiltersOneSourceDefault
@@ -2044,12 +2086,13 @@ export const HogFlowsInvocationsCreateBody = /* @__PURE__ */ zod.object({
source: zod
.enum([
'events',
+ 'internal-events',
'person-updates',
'data-warehouse-table',
'data-warehouse-view',
])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(
hogFlowsInvocationsCreateBodyConfigurationOneActionsItemConfigTwoConditionFiltersOneSourceDefault
@@ -2092,12 +2135,13 @@ export const HogFlowsInvocationsCreateBody = /* @__PURE__ */ zod.object({
source: zod
.enum([
'events',
+ 'internal-events',
'person-updates',
'data-warehouse-table',
'data-warehouse-view',
])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(
hogFlowsInvocationsCreateBodyConfigurationOneActionsItemConfigTwoEventsItemFiltersOneSourceDefault
@@ -2143,7 +2187,7 @@ export const HogFlowsInvocationsCreateBody = /* @__PURE__ */ zod.object({
),
])
.describe(
- "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|slack-message|github-event, filters?}. slack-message runs once per message posted in a connected Slack channel, and takes only filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply). Runs are person-less, so person-dependent steps are rejected. github-event runs once per matching GitHub delivery, and takes only filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility). repository and event_type are required, each with an exact-match filter; without them the trigger runs on every delivery from every connected repository. Runs are person-less, so person-dependent steps are rejected. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function\*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open\/click tracking, so opens and clicks are not recorded for that step (delivery\/bounce\/unsubscribe still are). Dictionary input values are template strings too — write booleans\/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person\/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."
+ "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|internal-event, filters?}. internal-event requires filters.events naming one or more allowed event ids, and runs once for each matching event on the internal-events stream. Runs are person-less, so person-dependent steps are rejected. $slack_message_received takes filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply), and requires an exact-match channel filter; without one it runs on every message in every connected channel. $github_event_received takes filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility), and requires exact-match repository and event_type filters; without them it runs on every delivery from every connected repository. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function\*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open\/click tracking, so opens and clicks are not recorded for that step (delivery\/bounce\/unsubscribe still are). Dictionary input values are template strings too — write booleans\/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person\/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."
),
output_variable: zod
.unknown()
@@ -2528,12 +2572,13 @@ export const HogFlowsBulkDeleteCreateBody = /* @__PURE__ */ zod
source: zod
.enum([
'events',
+ 'internal-events',
'person-updates',
'data-warehouse-table',
'data-warehouse-view',
])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(
hogFlowsBulkDeleteCreateBodyConversionOneEventsItemFiltersOneSourceDefault
@@ -2658,9 +2703,15 @@ export const HogFlowsBulkDeleteCreateBody = /* @__PURE__ */ zod
.union([
zod.object({
source: zod
- .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view'])
+ .enum([
+ 'events',
+ 'internal-events',
+ 'person-updates',
+ 'data-warehouse-table',
+ 'data-warehouse-view',
+ ])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(hogFlowsBulkDeleteCreateBodyActionsItemFiltersOneSourceDefault),
actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),
@@ -2713,12 +2764,13 @@ export const HogFlowsBulkDeleteCreateBody = /* @__PURE__ */ zod
source: zod
.enum([
'events',
+ 'internal-events',
'person-updates',
'data-warehouse-table',
'data-warehouse-view',
])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(
hogFlowsBulkDeleteCreateBodyActionsItemConfigTwoConditionFiltersOneSourceDefault
@@ -2761,12 +2813,13 @@ export const HogFlowsBulkDeleteCreateBody = /* @__PURE__ */ zod
source: zod
.enum([
'events',
+ 'internal-events',
'person-updates',
'data-warehouse-table',
'data-warehouse-view',
])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(
hogFlowsBulkDeleteCreateBodyActionsItemConfigTwoEventsItemFiltersOneSourceDefault
@@ -2812,7 +2865,7 @@ export const HogFlowsBulkDeleteCreateBody = /* @__PURE__ */ zod
),
])
.describe(
- "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|slack-message|github-event, filters?}. slack-message runs once per message posted in a connected Slack channel, and takes only filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply). Runs are person-less, so person-dependent steps are rejected. github-event runs once per matching GitHub delivery, and takes only filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility). repository and event_type are required, each with an exact-match filter; without them the trigger runs on every delivery from every connected repository. Runs are person-less, so person-dependent steps are rejected. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function\*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open\/click tracking, so opens and clicks are not recorded for that step (delivery\/bounce\/unsubscribe still are). Dictionary input values are template strings too — write booleans\/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person\/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."
+ "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|internal-event, filters?}. internal-event requires filters.events naming one or more allowed event ids, and runs once for each matching event on the internal-events stream. Runs are person-less, so person-dependent steps are rejected. $slack_message_received takes filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply), and requires an exact-match channel filter; without one it runs on every message in every connected channel. $github_event_received takes filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility), and requires exact-match repository and event_type filters; without them it runs on every delivery from every connected repository. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function\*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open\/click tracking, so opens and clicks are not recorded for that step (delivery\/bounce\/unsubscribe still are). Dictionary input values are template strings too — write booleans\/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person\/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."
),
output_variable: zod
.unknown()
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index c0271154af73..ae17d0e408c3 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -41656,6 +41656,7 @@ export namespace Schemas {
/**
* * `events` - events
+ * * `internal-events` - internal-events
* * `person-updates` - person-updates
* * `data-warehouse-table` - data-warehouse-table
* * `data-warehouse-view` - data-warehouse-view
@@ -41665,6 +41666,7 @@ export namespace Schemas {
export const HogFunctionFiltersSourceEnum = {
Events: 'events',
+ InternalEvents: 'internal-events',
PersonUpdates: 'person-updates',
DataWarehouseTable: 'data-warehouse-table',
DataWarehouseView: 'data-warehouse-view',
@@ -41806,7 +41808,7 @@ export namespace Schemas {
} as const;
/**
- * Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|slack-message|github-event, filters?}. slack-message runs once per message posted in a connected Slack channel, and takes only filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply). Runs are person-less, so person-dependent steps are rejected. github-event runs once per matching GitHub delivery, and takes only filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility). repository and event_type are required, each with an exact-match filter; without them the trigger runs on every delivery from every connected repository. Runs are person-less, so person-dependent steps are rejected. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open/click tracking, so opens and clicks are not recorded for that step (delivery/bounce/unsubscribe still are). Dictionary input values are template strings too — write booleans/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}.
+ * Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|internal-event, filters?}. internal-event requires filters.events naming one or more allowed event ids, and runs once for each matching event on the internal-events stream. Runs are person-less, so person-dependent steps are rejected. $slack_message_received takes filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply), and requires an exact-match channel filter; without one it runs on every message in every connected channel. $github_event_received takes filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility), and requires exact-match repository and event_type filters; without them it runs on every delivery from every connected repository. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open/click tracking, so opens and clicks are not recorded for that step (delivery/bounce/unsubscribe still are). Dictionary input values are template strings too — write booleans/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}.
*/
export type HogFlowActionConfig = { [key: string]: unknown } | {
/** Property-based wait condition; continues when the person matches. A condition with no property filters is ignored — the wait then relies on 'events' and the max_wait_duration timeout. */
@@ -41865,7 +41867,7 @@ export namespace Schemas {
* * `random_cohort_branch` - random_cohort_branch
* * `exit` - exit */
type: HogFlowActionTypeEnum;
- /** Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|slack-message|github-event, filters?}. slack-message runs once per message posted in a connected Slack channel, and takes only filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply). Runs are person-less, so person-dependent steps are rejected. github-event runs once per matching GitHub delivery, and takes only filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility). repository and event_type are required, each with an exact-match filter; without them the trigger runs on every delivery from every connected repository. Runs are person-less, so person-dependent steps are rejected. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open/click tracking, so opens and clicks are not recorded for that step (delivery/bounce/unsubscribe still are). Dictionary input values are template strings too — write booleans/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}. */
+ /** Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|internal-event, filters?}. internal-event requires filters.events naming one or more allowed event ids, and runs once for each matching event on the internal-events stream. Runs are person-less, so person-dependent steps are rejected. $slack_message_received takes filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply), and requires an exact-match channel filter; without one it runs on every message in every connected channel. $github_event_received takes filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility), and requires exact-match repository and event_type filters; without them it runs on every delivery from every connected repository. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open/click tracking, so opens and clicks are not recorded for that step (delivery/bounce/unsubscribe still are). Dictionary input values are template strings too — write booleans/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}. */
config: HogFlowActionConfig;
/** Output variable for downstream actions: {key, result_path?, spread?, label?} or a list of those. */
output_variable?: unknown;
diff --git a/services/mcp/src/generated/cdp_functions/api.ts b/services/mcp/src/generated/cdp_functions/api.ts
index 2865ba51d025..5e14927ad0f9 100644
--- a/services/mcp/src/generated/cdp_functions/api.ts
+++ b/services/mcp/src/generated/cdp_functions/api.ts
@@ -142,9 +142,9 @@ export const HogFunctionsCreateBody = /* @__PURE__ */ zod.object({
filters: zod
.object({
source: zod
- .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view'])
+ .enum(['events', 'internal-events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view'])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(hogFunctionsCreateBodyFiltersOneSourceDefault),
actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),
@@ -240,9 +240,15 @@ export const HogFunctionsCreateBody = /* @__PURE__ */ zod.object({
filters: zod
.object({
source: zod
- .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view'])
+ .enum([
+ 'events',
+ 'internal-events',
+ 'person-updates',
+ 'data-warehouse-table',
+ 'data-warehouse-view',
+ ])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(hogFunctionsCreateBodyMappingsItemFiltersSourceDefault),
actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),
@@ -395,9 +401,9 @@ export const HogFunctionsPartialUpdateBody = /* @__PURE__ */ zod.object({
filters: zod
.object({
source: zod
- .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view'])
+ .enum(['events', 'internal-events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view'])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(hogFunctionsPartialUpdateBodyFiltersOneSourceDefault),
actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),
@@ -493,9 +499,15 @@ export const HogFunctionsPartialUpdateBody = /* @__PURE__ */ zod.object({
filters: zod
.object({
source: zod
- .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view'])
+ .enum([
+ 'events',
+ 'internal-events',
+ 'person-updates',
+ 'data-warehouse-table',
+ 'data-warehouse-view',
+ ])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(hogFunctionsPartialUpdateBodyMappingsItemFiltersSourceDefault),
actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),
@@ -753,9 +765,15 @@ export const HogFunctionsInvocationsCreateBody = /* @__PURE__ */ zod.object({
filters: zod
.object({
source: zod
- .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view'])
+ .enum([
+ 'events',
+ 'internal-events',
+ 'person-updates',
+ 'data-warehouse-table',
+ 'data-warehouse-view',
+ ])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(hogFunctionsInvocationsCreateBodyConfigurationOneFiltersOneSourceDefault),
actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),
@@ -869,9 +887,15 @@ export const HogFunctionsInvocationsCreateBody = /* @__PURE__ */ zod.object({
filters: zod
.object({
source: zod
- .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view'])
+ .enum([
+ 'events',
+ 'internal-events',
+ 'person-updates',
+ 'data-warehouse-table',
+ 'data-warehouse-view',
+ ])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(
hogFunctionsInvocationsCreateBodyConfigurationOneMappingsItemFiltersSourceDefault
diff --git a/services/mcp/src/generated/error_tracking_alerts/api.ts b/services/mcp/src/generated/error_tracking_alerts/api.ts
index e40cdcc29597..91dfe46a228a 100644
--- a/services/mcp/src/generated/error_tracking_alerts/api.ts
+++ b/services/mcp/src/generated/error_tracking_alerts/api.ts
@@ -142,9 +142,9 @@ export const HogFunctionsCreateBody = /* @__PURE__ */ zod.object({
filters: zod
.object({
source: zod
- .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view'])
+ .enum(['events', 'internal-events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view'])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(hogFunctionsCreateBodyFiltersOneSourceDefault),
actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),
@@ -240,9 +240,15 @@ export const HogFunctionsCreateBody = /* @__PURE__ */ zod.object({
filters: zod
.object({
source: zod
- .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view'])
+ .enum([
+ 'events',
+ 'internal-events',
+ 'person-updates',
+ 'data-warehouse-table',
+ 'data-warehouse-view',
+ ])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(hogFunctionsCreateBodyMappingsItemFiltersSourceDefault),
actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),
@@ -386,9 +392,9 @@ export const HogFunctionsPartialUpdateBody = /* @__PURE__ */ zod.object({
filters: zod
.object({
source: zod
- .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view'])
+ .enum(['events', 'internal-events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view'])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(hogFunctionsPartialUpdateBodyFiltersOneSourceDefault),
actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),
@@ -484,9 +490,15 @@ export const HogFunctionsPartialUpdateBody = /* @__PURE__ */ zod.object({
filters: zod
.object({
source: zod
- .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view'])
+ .enum([
+ 'events',
+ 'internal-events',
+ 'person-updates',
+ 'data-warehouse-table',
+ 'data-warehouse-view',
+ ])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(hogFunctionsPartialUpdateBodyMappingsItemFiltersSourceDefault),
actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),
diff --git a/services/mcp/src/generated/workflows/api.ts b/services/mcp/src/generated/workflows/api.ts
index 12aa93dbb93a..ae0ce62e1153 100644
--- a/services/mcp/src/generated/workflows/api.ts
+++ b/services/mcp/src/generated/workflows/api.ts
@@ -124,12 +124,13 @@ export const HogFlowsCreateBody = /* @__PURE__ */ zod
source: zod
.enum([
'events',
+ 'internal-events',
'person-updates',
'data-warehouse-table',
'data-warehouse-view',
])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(hogFlowsCreateBodyConversionOneEventsItemFiltersOneSourceDefault),
actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),
@@ -252,9 +253,15 @@ export const HogFlowsCreateBody = /* @__PURE__ */ zod
.union([
zod.object({
source: zod
- .enum(['events', 'person-updates', 'data-warehouse-table', 'data-warehouse-view'])
+ .enum([
+ 'events',
+ 'internal-events',
+ 'person-updates',
+ 'data-warehouse-table',
+ 'data-warehouse-view',
+ ])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(hogFlowsCreateBodyActionsItemFiltersOneSourceDefault),
actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),
@@ -307,12 +314,13 @@ export const HogFlowsCreateBody = /* @__PURE__ */ zod
source: zod
.enum([
'events',
+ 'internal-events',
'person-updates',
'data-warehouse-table',
'data-warehouse-view',
])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(
hogFlowsCreateBodyActionsItemConfigTwoConditionFiltersOneSourceDefault
@@ -355,12 +363,13 @@ export const HogFlowsCreateBody = /* @__PURE__ */ zod
source: zod
.enum([
'events',
+ 'internal-events',
'person-updates',
'data-warehouse-table',
'data-warehouse-view',
])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(
hogFlowsCreateBodyActionsItemConfigTwoEventsItemFiltersOneSourceDefault
@@ -406,7 +415,7 @@ export const HogFlowsCreateBody = /* @__PURE__ */ zod
),
])
.describe(
- "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|slack-message|github-event, filters?}. slack-message runs once per message posted in a connected Slack channel, and takes only filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply). Runs are person-less, so person-dependent steps are rejected. github-event runs once per matching GitHub delivery, and takes only filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility). repository and event_type are required, each with an exact-match filter; without them the trigger runs on every delivery from every connected repository. Runs are person-less, so person-dependent steps are rejected. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function\*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open\/click tracking, so opens and clicks are not recorded for that step (delivery\/bounce\/unsubscribe still are). Dictionary input values are template strings too — write booleans\/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person\/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."
+ "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|internal-event, filters?}. internal-event requires filters.events naming one or more allowed event ids, and runs once for each matching event on the internal-events stream. Runs are person-less, so person-dependent steps are rejected. $slack_message_received takes filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply), and requires an exact-match channel filter; without one it runs on every message in every connected channel. $github_event_received takes filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility), and requires exact-match repository and event_type filters; without them it runs on every delivery from every connected repository. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function\*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open\/click tracking, so opens and clicks are not recorded for that step (delivery\/bounce\/unsubscribe still are). Dictionary input values are template strings too — write booleans\/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person\/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."
),
output_variable: zod
.unknown()
@@ -503,12 +512,13 @@ export const HogFlowsPartialUpdateBody = /* @__PURE__ */ zod
source: zod
.enum([
'events',
+ 'internal-events',
'person-updates',
'data-warehouse-table',
'data-warehouse-view',
])
.describe(
- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
+ '\* `events` - events\n\* `internal-events` - internal-events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table\n\* `data-warehouse-view` - data-warehouse-view'
)
.default(
hogFlowsPartialUpdateBodyConversionOneEventsItemFiltersOneSourceDefault
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-create.json
index 92a0f05691c0..2345a1272f79 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-create.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-create.json
@@ -70,8 +70,14 @@
},
"source": {
"default": "events",
- "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table\n* `data-warehouse-view` - data-warehouse-view",
- "enum": ["events", "person-updates", "data-warehouse-table", "data-warehouse-view"],
+ "description": "* `events` - events\n* `internal-events` - internal-events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table\n* `data-warehouse-view` - data-warehouse-view",
+ "enum": [
+ "events",
+ "internal-events",
+ "person-updates",
+ "data-warehouse-table",
+ "data-warehouse-view"
+ ],
"type": "string"
}
},
@@ -252,9 +258,10 @@
},
"source": {
"default": "events",
- "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table\n* `data-warehouse-view` - data-warehouse-view",
+ "description": "* `events` - events\n* `internal-events` - internal-events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table\n* `data-warehouse-view` - data-warehouse-view",
"enum": [
"events",
+ "internal-events",
"person-updates",
"data-warehouse-table",
"data-warehouse-view"
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-invocations-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-invocations-create.json
index fb40e9184b2d..7b5df04afa73 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-invocations-create.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-invocations-create.json
@@ -217,8 +217,14 @@
},
"source": {
"default": "events",
- "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table\n* `data-warehouse-view` - data-warehouse-view",
- "enum": ["events", "person-updates", "data-warehouse-table", "data-warehouse-view"],
+ "description": "* `events` - events\n* `internal-events` - internal-events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table\n* `data-warehouse-view` - data-warehouse-view",
+ "enum": [
+ "events",
+ "internal-events",
+ "person-updates",
+ "data-warehouse-table",
+ "data-warehouse-view"
+ ],
"type": "string"
},
"transpiled": {}
@@ -422,9 +428,10 @@
},
"source": {
"default": "events",
- "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table\n* `data-warehouse-view` - data-warehouse-view",
+ "description": "* `events` - events\n* `internal-events` - internal-events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table\n* `data-warehouse-view` - data-warehouse-view",
"enum": [
"events",
+ "internal-events",
"person-updates",
"data-warehouse-table",
"data-warehouse-view"
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-partial-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-partial-update.json
index e29882610ef3..57dbefd398b8 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-partial-update.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-partial-update.json
@@ -76,8 +76,14 @@
},
"source": {
"default": "events",
- "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table\n* `data-warehouse-view` - data-warehouse-view",
- "enum": ["events", "person-updates", "data-warehouse-table", "data-warehouse-view"],
+ "description": "* `events` - events\n* `internal-events` - internal-events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table\n* `data-warehouse-view` - data-warehouse-view",
+ "enum": [
+ "events",
+ "internal-events",
+ "person-updates",
+ "data-warehouse-table",
+ "data-warehouse-view"
+ ],
"type": "string"
}
},
@@ -262,9 +268,10 @@
},
"source": {
"default": "events",
- "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table\n* `data-warehouse-view` - data-warehouse-view",
+ "description": "* `events` - events\n* `internal-events` - internal-events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table\n* `data-warehouse-view` - data-warehouse-view",
"enum": [
"events",
+ "internal-events",
"person-updates",
"data-warehouse-table",
"data-warehouse-view"
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/error-tracking-alerts-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/error-tracking-alerts-create.json
index 05f126e5bb5b..98eb05fd1052 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/error-tracking-alerts-create.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/error-tracking-alerts-create.json
@@ -70,8 +70,14 @@
},
"source": {
"default": "events",
- "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table\n* `data-warehouse-view` - data-warehouse-view",
- "enum": ["events", "person-updates", "data-warehouse-table", "data-warehouse-view"],
+ "description": "* `events` - events\n* `internal-events` - internal-events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table\n* `data-warehouse-view` - data-warehouse-view",
+ "enum": [
+ "events",
+ "internal-events",
+ "person-updates",
+ "data-warehouse-table",
+ "data-warehouse-view"
+ ],
"type": "string"
}
},
@@ -252,9 +258,10 @@
},
"source": {
"default": "events",
- "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table\n* `data-warehouse-view` - data-warehouse-view",
+ "description": "* `events` - events\n* `internal-events` - internal-events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table\n* `data-warehouse-view` - data-warehouse-view",
"enum": [
"events",
+ "internal-events",
"person-updates",
"data-warehouse-table",
"data-warehouse-view"
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/error-tracking-alerts-partial-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/error-tracking-alerts-partial-update.json
index f2eebb612a65..7bc3ec18ac19 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/error-tracking-alerts-partial-update.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/error-tracking-alerts-partial-update.json
@@ -76,8 +76,14 @@
},
"source": {
"default": "events",
- "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table\n* `data-warehouse-view` - data-warehouse-view",
- "enum": ["events", "person-updates", "data-warehouse-table", "data-warehouse-view"],
+ "description": "* `events` - events\n* `internal-events` - internal-events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table\n* `data-warehouse-view` - data-warehouse-view",
+ "enum": [
+ "events",
+ "internal-events",
+ "person-updates",
+ "data-warehouse-table",
+ "data-warehouse-view"
+ ],
"type": "string"
}
},
@@ -262,9 +268,10 @@
},
"source": {
"default": "events",
- "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table\n* `data-warehouse-view` - data-warehouse-view",
+ "description": "* `events` - events\n* `internal-events` - internal-events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table\n* `data-warehouse-view` - data-warehouse-view",
"enum": [
"events",
+ "internal-events",
"person-updates",
"data-warehouse-table",
"data-warehouse-view"
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-create.json
index 67425141516f..fa76708c5e1b 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-create.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-create.json
@@ -75,9 +75,10 @@
},
"source": {
"default": "events",
- "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table\n* `data-warehouse-view` - data-warehouse-view",
+ "description": "* `events` - events\n* `internal-events` - internal-events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table\n* `data-warehouse-view` - data-warehouse-view",
"enum": [
"events",
+ "internal-events",
"person-updates",
"data-warehouse-table",
"data-warehouse-view"
@@ -158,9 +159,10 @@
},
"source": {
"default": "events",
- "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table\n* `data-warehouse-view` - data-warehouse-view",
+ "description": "* `events` - events\n* `internal-events` - internal-events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table\n* `data-warehouse-view` - data-warehouse-view",
"enum": [
"events",
+ "internal-events",
"person-updates",
"data-warehouse-table",
"data-warehouse-view"
@@ -195,7 +197,7 @@
"type": "object"
}
],
- "description": "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|slack-message|github-event, filters?}. slack-message runs once per message posted in a connected Slack channel, and takes only filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply). Runs are person-less, so person-dependent steps are rejected. github-event runs once per matching GitHub delivery, and takes only filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility). repository and event_type are required, each with an exact-match filter; without them the trigger runs on every delivery from every connected repository. Runs are person-less, so person-dependent steps are rejected. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open/click tracking, so opens and clicks are not recorded for that step (delivery/bounce/unsubscribe still are). Dictionary input values are template strings too — write booleans/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."
+ "description": "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|internal-event, filters?}. internal-event requires filters.events naming one or more allowed event ids, and runs once for each matching event on the internal-events stream. Runs are person-less, so person-dependent steps are rejected. $slack_message_received takes filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply), and requires an exact-match channel filter; without one it runs on every message in every connected channel. $github_event_received takes filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility), and requires exact-match repository and event_type filters; without them it runs on every delivery from every connected repository. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open/click tracking, so opens and clicks are not recorded for that step (delivery/bounce/unsubscribe still are). Dictionary input values are template strings too — write booleans/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."
},
"created_at": {
"description": "Created at (epoch ms). Frontend-managed.",
@@ -259,9 +261,10 @@
},
"source": {
"default": "events",
- "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table\n* `data-warehouse-view` - data-warehouse-view",
+ "description": "* `events` - events\n* `internal-events` - internal-events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table\n* `data-warehouse-view` - data-warehouse-view",
"enum": [
"events",
+ "internal-events",
"person-updates",
"data-warehouse-table",
"data-warehouse-view"
@@ -394,9 +397,10 @@
},
"source": {
"default": "events",
- "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table\n* `data-warehouse-view` - data-warehouse-view",
+ "description": "* `events` - events\n* `internal-events` - internal-events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table\n* `data-warehouse-view` - data-warehouse-view",
"enum": [
"events",
+ "internal-events",
"person-updates",
"data-warehouse-table",
"data-warehouse-view"
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-update.json
index e5fd8dca28bb..651871157ba4 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-update.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-update.json
@@ -64,9 +64,10 @@
},
"source": {
"default": "events",
- "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table\n* `data-warehouse-view` - data-warehouse-view",
+ "description": "* `events` - events\n* `internal-events` - internal-events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table\n* `data-warehouse-view` - data-warehouse-view",
"enum": [
"events",
+ "internal-events",
"person-updates",
"data-warehouse-table",
"data-warehouse-view"