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
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
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gammarers_aws_sns_slack_message_lambda_subscription-1.0.9.tar.gz.
File metadata
- Download URL: gammarers_aws_sns_slack_message_lambda_subscription-1.0.9.tar.gz
- Upload date:
- Size: 378.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ced1b3945b2e49a1a366322ed91062645855db294c8f9c656ee9f0341e8e6505
|
|
| MD5 |
8a2352a1db279d05e42a2e1100c77e00
|
|
| BLAKE2b-256 |
f10a015220c3430298a47b5d2df96ccca073b9c6dd3ef4b69f9293fa502c09e8
|
File details
Details for the file gammarers_aws_sns_slack_message_lambda_subscription-1.0.9-py3-none-any.whl.
File metadata
- Download URL: gammarers_aws_sns_slack_message_lambda_subscription-1.0.9-py3-none-any.whl
- Upload date:
- Size: 377.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6bd7d7bbbee912fbb452b766c0dcb597cecbee07030ee3965d3a026949589ed1
|
|
| MD5 |
3feed474a0b78304cecad091e0956c38
|
|
| BLAKE2b-256 |
0899c3a9497c0122a70ccb4381d09d93305a81bed442b300dd285dcceb35e740
|