Skip to content

Commit 9c6e045

Browse files
Merge pull request #23 from gitautoai/wes
Add a webhook sample index.js
2 parents b88e496 + 0e43aaf commit 9c6e045

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/webhook.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Handle only webhook events
2+
export const handler = async (event, context) => {
3+
console.log("Event: ", event);
4+
console.log("Context: ", context);
5+
const { changelog } = event;
6+
console.log("Changelog: ", changelog);
7+
8+
if (event.type === "avi:jira:created:issue") {
9+
return handleIssueCreated(event);
10+
}
11+
12+
if (event.type === "avi:jira:updated:issue") {
13+
return handleIssueUpdated(event);
14+
}
15+
};
16+
17+
const handleIssueCreated = async (event) => {
18+
console.log("Issue created");
19+
};
20+
21+
const handleIssueUpdated = async (event) => {
22+
console.log("Issue updated");
23+
};

0 commit comments

Comments
 (0)