From 0e43aaf71b1fd115db19b8af9b89444d90ed6c72 Mon Sep 17 00:00:00 2001 From: Hiroshi Nishio Date: Tue, 10 Dec 2024 17:21:08 +0900 Subject: [PATCH] Add a webhook sample index.js --- src/webhook.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/webhook.js diff --git a/src/webhook.js b/src/webhook.js new file mode 100644 index 0000000..57ea498 --- /dev/null +++ b/src/webhook.js @@ -0,0 +1,23 @@ +// Handle only webhook events +export const handler = async (event, context) => { + console.log("Event: ", event); + console.log("Context: ", context); + const { changelog } = event; + console.log("Changelog: ", changelog); + + if (event.type === "avi:jira:created:issue") { + return handleIssueCreated(event); + } + + if (event.type === "avi:jira:updated:issue") { + return handleIssueUpdated(event); + } +}; + +const handleIssueCreated = async (event) => { + console.log("Issue created"); +}; + +const handleIssueUpdated = async (event) => { + console.log("Issue updated"); +};