callumalpass_tasknotes/docs/examples/webhook-transforms/minimal-discord.js
callumalpass 0fb618b539 improve: add detailed error logging for webhook transform failures
- Add comprehensive error messages for transform file loading failures
- Include file path validation and existence checking
- Add function validation warnings for missing transform functions
- Provide step-by-step logging for transform execution
- Add minimal transform examples for Discord and Slack

Fixes silent failures that made debugging transform issues difficult.
Addresses issue #719 where users couldn't identify why transform scripts weren't loading.
2025-09-27 22:26:43 +10:00

28 lines
No EOL
619 B
JavaScript

/**
* Minimal Discord Webhook Transform for TaskNotes
* This is the simplest possible transform for Discord webhooks
*/
console.log("🔥 transform file loaded");
function transform(payload) {
const { event, data } = payload;
// Simple Discord message format
if (event === 'task.created') {
return {
content: `📝 New task: **${data.task.title}**`
};
}
if (event === 'task.completed') {
return {
content: `✅ Completed: **${data.task.title}**`
};
}
// For all other events, return a generic message
return {
content: `TaskNotes: ${event} event triggered`
};
}