This AWS CDK Construct is designed to post messages sent from an SNS topic to a Slack Webhook via a Lambda function.
npm install @gammarers/aws-sns-slack-message-lambda-subscription





This AWS CDK Construct is designed to post messages sent from an SNS topic to a Slack Webhook via a Lambda function. The Lambda function accepts JSON text as a message, formats it for Slack, and sends it to the Slack Webhook API.

#### install by npm
``shell`
npm install @gammarers/aws-sns-slack-message-lambda-subscription
#### install by yarn
`shell`
yarn add @gammarers/aws-sns-slack-message-lambda-subscription
`shell`
pip install gammarers.aws-sns-slack-message-lambda-subscription
`shell`
dotnet add package Gammarers.CDK.AWS.SNSSlackMessageLambdaSubscriptionExample
get your slack webhook url parts
`text`
https://hooks.slack.com/services/
| SecretKey | SecretValue |
|-------------|-----------------|
| Workspace | \
| Channel | \
| Webhook | \
`typescript
import { SNSSlackMessageLambdaSubscription } from '@gammarer/aws-sns-slack-message-lambda-subscription';
declare const topic: sns.Topic;
new SNSSlackMessageLambdaSubscription(stack, 'SNSSlackMessageLambdaSubscription', {
topic,
slackWebhookSecretName: 'slak-webhook', // alredy saved slack webhook info.
});
`
`json``
{
"text": ":mega: TEST",
"attachments": [{
"color": "#2eb886",
"title": "CodePipeline pipeline execution SUCCEED",
"title_link": "https://github.com/yicr",
"fields": [
{
"title": "Pipeline",
"value": "pipeline-name"
}
]
}]
}
This project is licensed under the Apache-2.0 License.