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.24.tar.gz.

File metadata

File hashes

Hashes for gammarers_aws_sns_slack_message_lambda_subscription-1.0.24.tar.gz
Algorithm Hash digest
SHA256 1e06d96fb711eb981d7c64b43e103ece10c32743260cd33afdca84c17735089c
MD5 65c9f0ec95c6cb7bf92528f8b32af83b
BLAKE2b-256 6e917096493b97394908e3157034058d572f05fe71be7e370c9ca7fde7fea532

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gammarers_aws_sns_slack_message_lambda_subscription-1.0.24-py3-none-any.whl
Algorithm Hash digest
SHA256 2284754ee2b9018eb1582293c430cf83cc671c5347e0a56b8832bc00e5aedaf5
MD5 c837ebf5230317f187662d638e14cf70
BLAKE2b-256 f32903420e925fe4976e2c05f2311eb71c1ac20a269405bcc46d6b8385487c05

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