Files
2026-07-13 13:34:48 +08:00

47 lines
1.5 KiB
TypeScript

import { EventDefinition, z } from '@botpress/sdk'
import { baseIdentifierSchema } from './common'
const recordEventSchema = z.object({
event_type: z.string().title('Event Type').describe('The type of event'),
id: baseIdentifierSchema
.extend({ record_id: z.string().title('Record ID').describe('The record identifier') })
.describe('The record identifier object'),
actor: z
.object({
type: z.string().title('Actor Type').describe('The type of actor (e.g., workspace-member)'),
id: z.string().title('Actor ID').describe('The actor identifier'),
})
.title('Actor')
.describe('The actor who triggered the event'),
})
const recordCreated: EventDefinition = {
title: 'Record Created',
description: 'A new record has been created in Attio',
schema: recordEventSchema.extend({
event_type: z.literal('record.created').title('Event Type').describe('The type of event'),
}),
}
const recordUpdated: EventDefinition = {
title: 'Record Updated',
description: 'A record has been updated in Attio',
schema: recordEventSchema.extend({
event_type: z.literal('record.updated').title('Event Type').describe('The type of event'),
}),
}
const recordDeleted: EventDefinition = {
title: 'Record Deleted',
description: 'A record has been deleted in Attio',
schema: recordEventSchema.extend({
event_type: z.literal('record.deleted').title('Event Type').describe('The type of event'),
}),
}
export const events = {
recordCreated,
recordUpdated,
recordDeleted,
}