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

File metadata

File hashes

Hashes for gammarers_aws_sns_slack_message_lambda_subscription-1.0.11.tar.gz
Algorithm Hash digest
SHA256 dfd31db2a26f34dbc6a8bd4970a2bbfe1a0c7af29f01c0005140f10d54210b0b
MD5 cc02793254019b77e3838a671d9d0dcc
BLAKE2b-256 7cc1f2c024cf950003c174813610a22acca530b64c0506ebdd802cd1f81bc6ed

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gammarers_aws_sns_slack_message_lambda_subscription-1.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 5ee1f7304684e6cc5985bd39dcfb7196d22ab21cfa7f1b05deaff708eee330f0
MD5 ef330458ba9c303448bdd32d99fc86f9
BLAKE2b-256 b19b45b21ea930011d1133d4923519bff33cd6ef0d3b15c4784127a240b9148a

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