Back to Docs
Automation & Cron
Cron Jobs
Schedule recurring messages or tasks:
{
"cron": [
{
"schedule": "0 9 * * *",
"action": "send",
"channel": "telegram",
"message": "Good morning! Here's your daily briefing."
}
]
}
Webhooks
Receive external events and trigger bot actions:
curl -X POST http://localhost:18789/api/v1/webhook \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{"channel": "slack", "message": "Deployment complete!"}'
Event Hooks
React to events in the message pipeline:
const hook: Plugin = {
name: 'my-hook',
async onBeforeReply(ctx) {
// Modify the AI response before sending
ctx.reply = ctx.reply.replace('bad word', '***');
},
async onAfterReply(ctx) {
// Log, store, or forward the response
await saveToDatabase(ctx);
},
};