Skip to content

Instantly share code, notes, and snippets.

@mubbashir10
Created March 20, 2022 07:41
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
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