Skip to main content

This AWS CDK Construct is designed to post messages sent from an SNS topic to a Slack Webhook via a Lambda function.

Project description

AWS SNS Slack Message Lambda Subscription

GitHub npm (scoped) PyPI Nuget GitHub Workflow Status (branch) GitHub release (latest SemVer)

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.

Incoming Sample Message

Installation

TypeScript

install by npm

npm install @gammarers/aws-sns-slack-message-lambda-subscription

install by yarn

yarn add @gammarers/aws-sns-slack-message-lambda-subscription

Python

pip install gammarers.aws-sns-slack-message-lambda-subscription

C# / .NET

dotnet add package Gammarers.CDK.AWS.SNSSlackMessageLambdaSubscription

Example

Please save it in AWS Secrets Manager in the following format.

get your slack webhook url parts

https://hooks.slack.com/services/<workspace>/<channel>/<whebook>
SecretKey SecretValue
Workspace
Channel
Webhook

Code

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.
});
{
    "text": ":mega: *TEST*",
    "attachments": [{
        "color": "#2eb886",
        "title": "CodePipeline pipeline execution *SUCCEED*",
        "title_link": "https://github.com/yicr",
        "fields": [
            {
                "title": "Pipeline",
                "value": "pipeline-name"
            }
        ]
    }]
}

License

This project is licensed under the Apache-2.0 License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file gammarers_aws_sns_slack_message_lambda_subscription-1.0.1.tar.gz.

File metadata

File hashes

Hashes for gammarers_aws_sns_slack_message_lambda_subscription-1.0.1.tar.gz
Algorithm Hash digest
SHA256 71cc33810d68cef9f61009dd732eab988af64b7a153002c12d73b4834a168391
MD5 07cb2e5ce98897ae9a0fa14966679733
BLAKE2b-256 7a77931cbee2522cbcab681bb90593f7ca1f7c44aee31f164ad1a9c5b8a13005

See more details on using hashes here.

File details

Details for the file gammarers_aws_sns_slack_message_lambda_subscription-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for gammarers_aws_sns_slack_message_lambda_subscription-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7c057bb7e5f42c8838d16fa1e93f34157b3324fae6c6d2a104f2a8a11465d114
MD5 6b9d43cbec417f7daacee9b975193c06
BLAKE2b-256 ef225adc69afb36bbaf17228ee5d552ab7cf406b97e0052a6df9db799872886b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page