https://github.com/adam-fowler/sns-to-slack-lambda
Swift Lambda for publishing SNS messages to Slack
https://github.com/adam-fowler/sns-to-slack-lambda
lambda slack sns swift swift-aws-lambda-runtime
Last synced: about 1 year ago
JSON representation
Swift Lambda for publishing SNS messages to Slack
- Host: GitHub
- URL: https://github.com/adam-fowler/sns-to-slack-lambda
- Owner: adam-fowler
- Created: 2020-06-07T09:38:30.000Z (about 6 years ago)
- Default Branch: main
- Last Pushed: 2023-09-14T06:41:05.000Z (almost 3 years ago)
- Last Synced: 2025-04-14T11:55:27.536Z (about 1 year ago)
- Topics: lambda, slack, sns, swift, swift-aws-lambda-runtime
- Language: Swift
- Homepage:
- Size: 18.6 KB
- Stars: 6
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SNS to Slack
This is a Swift based AWS Lambda that will publish Simple Notification System (SNS) messages to a Slack channel.
## Setup Slack incoming webhook
Click [here](https://api.slack.com/apps) to go to the Slack Apps setup page. Click on "Create New App". Provide a name for your app and choose the workspace you want to post to. Click on "Incoming Webhooks". Click the switch to activate incoming webhooks. Click on "Add new webhook". Choose a channel to post to and click "Allow". You now have a webhook URL. You can go to do the bottom of the "Incoming Webhooks" page and copy the URL.
## Build and install
Before continuing you will need [Docker Desktop for Mac](https://docs.docker.com/docker-for-mac/install/) installed. You will also need the AWS command line interface and AWS SAM installed. You can install `awscli` and `sam` with Homebrew.
```
brew tap aws/tap
brew install awscli
brew install aws-sam-cli
```
There are two stages to getting the Lambda installed.
The install process can be broken into two stages, each with its own shell script.
1) build-and-package.sh: Building and packaging the lambda. This uses the `archive` command plugin that comes with the swift-aws-lambda-runtime
2) deploy.sh: Deploying the packaged Lambda to AWS using AWS SAM. The first time you run this you should add the command line parameter `--guided`. This will ask a number of questions about how you want the deployment to work.
## Link to Slack
The Lambda uses the Environment variable SLACK_HOOK_URL to get the URL to post to. You need to edit the SAM `deploy.yml`` to point this environment variable to the correct URL.