Skip to content

Instantly share code, notes, and snippets.

@mubbashir10
Created March 20, 2022 07:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mubbashir10/d759d48b8c8de1d488672796dcef40d4 to your computer and use it in GitHub Desktop.
Save mubbashir10/d759d48b8c8de1d488672796dcef40d4 to your computer and use it in GitHub Desktop.
Send AWS Amplify Pipeline Notifications on Slack
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