This serverless app posts messages to Slack. It uses a set of contains strings to determine which slack channel/webhook should be used for the messages.
This is important because only a single subscriber is allowed for each cloudwatch log; so logging to more than a single slack channel with a single lambda-to-slack (traditional) lambda was not possible.
- Create an AWS account if you do not already have one and login
- Go to the app's page on the Serverless Application Repository and click "Deploy"
- Provide the required app parameters (see parameter details below) and click "Deploy"
This lambda function expects to be called with a JSON array of strings, and will post each string to a Slack channel via a webhook.
To get a webhook URL for this application:
- Navigate to https://api.slack.com
- Click on the "Start Building" button
- Give your app a name and select a workspace
- Under "Add features and functionality" select "Incoming Webhooks"
- Turn on "Incoming Webhooks" and click "Add New Webhook to Workspace"
- Select the desired channel and click "Authorize"
- Copy the generated Webhook URL
SlackUrl
(required) - Webhook URL for integration with SlackLogLevel
(optional) - Log level for Lambda function logging, e.g., ERROR, INFO, DEBUG, etc. Default: INFOSlackUrl01
(optional) - Webhook URL for integration with Slack (if messages match ContainsString1)ContainsString01
(optional) - A string that, if present in the message, dictates that the message should be logged to SlackUrl1SlackUrl02
(optional) - Webhook URL for integration with Slack (if messages match ContainsString2)ContainsString02
(optional) - A string that, if present in the message, dictates that the message should be logged to SlackUrl2SlackUrl03
(optional) - Webhook URL for integration with Slack (if messages match ContainsString3)ContainsString03
(optional) - A string that, if present in the message, dictates that the message should be logged to SlackUrl3SlackUrl04
(optional) - Webhook URL for integration with Slack (if messages match ContainsString4)ContainsString04
(optional) - A string that, if present in the message, dictates that the message should be logged to SlackUrl4SlackUrl05
(optional) - Webhook URL for integration with Slack (if messages match ContainsString5)ContainsString05
(optional) - A string that, if present in the message, dictates that the message should be logged to SlackUrl5
LambdaToSlackName
- Lambda function name.LambdaToSlackArn
- Lambda function ARN.
This code is made available under the MIT license. See the LICENSE file.