@cdkx/aws-sns-subscriptions

AWS SNS extended subscriptions

Usage no npm install needed!

<script type="module">
  import cdkxAwsSnsSubscriptions from 'https://cdn.skypack.dev/@cdkx/aws-sns-subscriptions';
</script>

README

AWS SNS Subscription extensions

Subscription targets

Slack Subscription

Get it from npm

npm install @cdkx/aws-sns-subscriptions --save // using npm

yarn add @cdkx/aws-sns-subscriptions // using yarn

Getting Started

Add a SNS Topic to your stack

import { Topic } from '@aws-cdk/aws-sns';

// create topic
const myTopic = new Topic(this, 'MyTopic');

Add an slack bot enabled subscription to your topic.

import { SlackSubscription } from '@cdkx/aws-sns-subscriptions';

// add slack subscription to alongside with other subscription targets
myTopic.addSubscription(
  new SlackSubscription({
    channelName: 'my-channel',
  })
);

Add Token to parameter

Once stack has deployed, a new System Parameter resources will be made available. There add a slack bot oAuth token next to property authToken.

Required Scopes for these token depend of level of context provided to subscription target. When channelId is provided, OAuthToken will only need chat:write:bot. But if no channelId is preset, channel id will be resolved from slack api and to do that OAuth token will need additional channels:read, groups:read, im:read, mpim:read scopes.