Giter Club home page Giter Club logo

secret-santa's Introduction

๐ŸŽ Secret Santa Bot ๐ŸŽ

This is a slack bot implementation of the classic game secret santa using AWS lambdas and AWS CDK.

How it works

Once triggered, the bot will send message to a slack channel of your choice

Slack bot start message

After one week, based who has reacted to the messages, it collects the list of participants and send them a private message with the person who they will be giving a secret gift to.

Slack bot start message

If less than two participants have reacted, then it will notify the channel that secret santa will not commence.

Technical Details

The app made of several AWS lambda functions and a message queue to send the secret santa assignment messages.

Slack bot architecture

  • The step function manages sending the initial welcome message and pushing assigned gift pairs each into the SQS queue. Once its done, it messages the slack channel confirming that pairing has been completed.
  • The send lambda prompt lambda polls the queue to send the private messages informing the gift-giver their recipients. Exponential back-off is used to avoid rate limiting. If gift pair fails to send, it will be redirected to the dead line queue triggering a cloudwatch alarm, indicating that the bot has failed.

Deploy the app on yourself

Slack Bot Token

You need to set up an OAuth token for your bot. You will need to give the token the scopes: chat:write, im:write, reactions:read. Then you need to install the bot to your workspace and invite the bot to your slack channel.

Store your token in AWS secrets manager

The cdk stack expects the token to be stored as a secret in AWS secret manager. Store the OAuth token with the key 'token'.

Configure the bot

In cdk.json, you need to set:

  • botTokenName: name of the AWS secrets for bot token
  • secretRegion: region of the bot secret
  • channelID: the slack channel you wish the bot to post in

Deploy the bot on AWS

The stack is deployed using the aws cdk, so you need to have nodejs and npm installed, to install of required packages run

npm install .

To deploy the stack, run

cdk deploy

Useful cdk commands

  • npm run build compile typescript to js
  • npm run watch watch for changes and compile
  • npm run test perform the jest unit tests
  • cdk deploy deploy this stack to your default AWS account/region
  • cdk diff compare deployed stack with current state
  • cdk synth emits the synthesized CloudFormation template

secret-santa's People

Contributors

archennz avatar

Watchers

James Cloos avatar  avatar

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.