Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mozamimy/lambda-slack-notifier
https://github.com/mozamimy/lambda-slack-notifier
aws-lambda serverless slack-webhook
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/mozamimy/lambda-slack-notifier
- Owner: mozamimy
- License: mit
- Created: 2018-11-10T15:49:10.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-11-17T07:06:06.000Z (about 1 year ago)
- Last Synced: 2024-10-08T08:20:04.886Z (3 months ago)
- Topics: aws-lambda, serverless, slack-webhook
- Language: Rust
- Size: 56.6 KB
- Stars: 3
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# lambda-slack-notifier
## About
This program sends a message to Slack when it receives like following event data published from AWS SNS topic.
Option elements can be omitted from `MessageAttributes` object. In that case, this function fills omitted these options with default values of incoming-webhook.
```json
{
"Records": [
{
"EventSource": "aws:sns",
"EventVersion": "1.0",
"EventSubscriptionArn": "arn:aws:sns:us-east-1::ExampleTopic",
"Sns": {
"Type": "Notification",
"MessageId": "95df01b4-ee98-5cb9-9903-4c221d41eb5e",
"TopicArn": "arn:aws:sns:us-east-1:123456789012:ExampleTopic",
"Subject": "example subject",
"Message": "example message",
"Timestamp": "1970-01-01T00:00:00.000Z",
"SignatureVersion": "1",
"Signature": "EXAMPLE",
"SigningCertUrl": "EXAMPLE",
"UnsubscribeUrl": "EXAMPLE",
"MessageAttributes": {
"Channel": {
"Type": "String",
"Value": "#nanika-channel"
},
"UserName": {
"Type": "String",
"Value": "nanika"
},
"IconEmoji": {
"Type": "String",
"Value": ":rabbit:"
},
"Color": {
"Type": "String",
"Value": "warning"
}
}
}
}
]
}
```## Run locally with Docker
https://docs.aws.amazon.com/lambda/latest/dg/images-test.html
```sh
docker build -t lambda-slack-notifier .
docker run -p 9000:8080 -e SLACK_WEBHOOK=https://xxxxxxxx lambda-slack-notifier
# In other terminal session
curl "http://localhost:9000/2015-03-31/functions/function/invocations" [email protected]
```## License
MIT