This is a slack bot implementation of the classic game secret santa using AWS lambdas and AWS CDK.
Once triggered, the bot will send message to a slack channel of your choice
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.
If less than two participants have reacted, then it will notify the channel that secret santa will not commence.
The app made of several AWS lambda functions and a message queue to send the secret santa assignment messages.
- 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.
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.
The cdk stack expects the token to be stored as a secret in AWS secret manager. Store the OAuth token with the key 'token'
.
In cdk.json
, you need to set:
botTokenName
: name of the AWS secrets for bot tokensecretRegion
: region of the bot secretchannelID
: the slack channel you wish the bot to post in
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
npm run build
compile typescript to jsnpm run watch
watch for changes and compilenpm run test
perform the jest unit testscdk deploy
deploy this stack to your default AWS account/regioncdk diff
compare deployed stack with current statecdk synth
emits the synthesized CloudFormation template