Code Monkey home page Code Monkey logo

aws-sns-to-slack-publisher's Introduction

aws-sns-to-slack-publisher

Serverless License Build Status

Publish a message received from SNS to Slack.

System Architecture

This service requires an SNS topic for it to subscribe to. It will receive SNS messages formatted for the chat.postMessage Slack API for publishing to Slack.

Example service:

Slack App setup

This service requires the creation of a Slack App in your organization. It will use the credentials and permissions of that app in order to post messages.

1) Sign in to your Slack workspace.

click the link below to sign into the desired Slack workspace.

2) Create a Slack app in your workspace.

Click the link below and on that page click the "Create New App" button.

Give the app a name and select the workspace.

Slack Create App

3) Obtain OAuth token and select permissions.

OAuth Tokens & Redirect URLs

Click "OAuth & Permissions" in the left side bar. On that page under the OAuth Tokens & Redirect URLs section obtain an OAuth Access Token. You will need that to deploy this service.

Under the Scopes section add the following:

  • channels:read
  • chat:write:bot

Once you've saved settings, your Slack bot is configured.

Service Interface

  • Event Type: AWS SNS
  • SNS Message: Message should be a JSON formatted string that conforms to the chat.postMessage Slack API method. See also slack-message-schema.json in this repository to understand more about the message shape.

Deployment

You will need the following in order to deploy and use this service.

  • A Slack App API key
  • A Slack channel
  • The CloudFormation export value of the SNS topic ARN this should subscribe to.

In addition, this service can optionally publish responses from the Slack API to an SNS topic so the responses may be processed. You may toggle this attribute of the stack as well.

This application is intended to be deployed using AWS Serverless Application Repository. However, Serverless Framework is also supported.

Serverless Application Repository / CloudFormation

When deploying via Serverless Application Repository or CloudFormation, you will be presented with the following parameters to configure.

  • SlackApiToken (Required): API token to use when publishing to slack.
  • SlackDefaultChannel: Channel messages should be published to.
  • SnsPublishResponse: Name of the CloudFormation export to find the event source SNS topic to subscribe
  • SnsPublisherTopicExport (Required): Whether to publish Slack API responses to an SNS topic.

AWS Serverless Application Repository: aws-sns-to-slack-publisher

Serverless Framework

To configure the deployment of this service, the following environment variables may be set when running sls deploy.

  • SLACK_API_TOKEN (Required): API token to use when publishing to slack.
  • SLACK_DEFAULT_CHANNEL: Channel messages should be published to.
  • SNS_PUBLISHER_TOPIC_EXPORT (Required): Name of the CloudFormation export to find the event source SNS topic to subscribe to.
  • SNS_PUBLISH_RESPONSE (Values: 'true'|'false'): Whether to publish Slack API responses to an SNS topic.
$ npm install -g serverless
$ npm install
$ SLACK_API_TOKEN=|TOKEN| SNS_PUBLISHER_TOPIC_EXPORT=|CFN_EXPORT| serverless deploy -v

Exports

These values may be used by other services in your AWS infrastructure.

  • ${AWS::StackName}-SlackResponseSnsTopicArn: Topic to which Slack publishing responses are sent.

aws-sns-to-slack-publisher's People

Contributors

matthiasgubler avatar tmclaugh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

aws-sns-to-slack-publisher's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.