Created
March 20, 2022 07:41
-
-
Save mubbashir10/d759d48b8c8de1d488672796dcef40d4 to your computer and use it in GitHub Desktop.
Send AWS Amplify Pipeline Notifications on Slack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fetch = require('node-fetch') | |
// this should be your webhook URL (doc: https://api.slack.com/messaging/webhooks) | |
const integrationURL = '' | |
exports.handler = async (event) => { | |
const message = event.Records[0].Sns.Message | |
return await fetch(integrationURL, { | |
method: 'POST', | |
body: JSON.stringify({ | |
attachments: [{ | |
title: `AWS Amplifyy Notification!`, | |
text: message, | |
}] | |
}), | |
headers: { 'Content-Type': 'application/json' }, | |
}) | |
.then((data) => console.log('sent!')) | |
.catch((e) => console.error(e.response.data)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tutorial: https://dev.to/aws-builders/enable-slack-notifications-for-aws-amplify-deployments-5a0l