Skip to content

Latest commit

 

History

History
58 lines (42 loc) · 3.28 KB

README.md

File metadata and controls

58 lines (42 loc) · 3.28 KB

macnoms-lambda-to-slack

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.

App Architecture

App Architecture

Installation Instructions

  1. Create an AWS account if you do not already have one and login
  2. Go to the app's page on the Serverless Application Repository and click "Deploy"
  3. Provide the required app parameters (see parameter details below) and click "Deploy"

Using this Application

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.

Slack Url

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

App Parameters

  1. SlackUrl (required) - Webhook URL for integration with Slack
  2. LogLevel (optional) - Log level for Lambda function logging, e.g., ERROR, INFO, DEBUG, etc. Default: INFO
  3. SlackUrl01 (optional) - Webhook URL for integration with Slack (if messages match ContainsString1)
  4. ContainsString01 (optional) - A string that, if present in the message, dictates that the message should be logged to SlackUrl1
  5. SlackUrl02 (optional) - Webhook URL for integration with Slack (if messages match ContainsString2)
  6. ContainsString02 (optional) - A string that, if present in the message, dictates that the message should be logged to SlackUrl2
  7. SlackUrl03 (optional) - Webhook URL for integration with Slack (if messages match ContainsString3)
  8. ContainsString03 (optional) - A string that, if present in the message, dictates that the message should be logged to SlackUrl3
  9. SlackUrl04 (optional) - Webhook URL for integration with Slack (if messages match ContainsString4)
  10. ContainsString04 (optional) - A string that, if present in the message, dictates that the message should be logged to SlackUrl4
  11. SlackUrl05 (optional) - Webhook URL for integration with Slack (if messages match ContainsString5)
  12. ContainsString05 (optional) - A string that, if present in the message, dictates that the message should be logged to SlackUrl5

App Outputs

  1. LambdaToSlackName - Lambda function name.
  2. LambdaToSlackArn - Lambda function ARN.

License Summary

This code is made available under the MIT license. See the LICENSE file.