Documentation Index
Fetch the complete documentation index at: https://mintlify.com/botpress/botpress/llms.txt
Use this file to discover all available pages before exploring further.
Events notify bots when something happens in the external platform.
Define events
integration.definition.ts
export default new IntegrationDefinition({
events: {
messageReceived: {
title: 'Message Received',
description: 'Triggered when a message is received',
schema: z.object({
userId: z.string(),
text: z.string(),
timestamp: z.string(),
}),
},
},
})
Emit events
const integration = new bp.Integration({
handler: async ({ req, client }) => {
const event = req.body
await client.createEvent({
type: 'messageReceived',
payload: {
userId: event.user_id,
text: event.text,
timestamp: new Date().toISOString(),
},
})
return { status: 200 }
},
// ...
})