This was code written as an entry in DevPost's The Serverless Chatbot Competition.
The AWS bot works in the following manner:
- The user visits the OAuth URL, which is redirected to the Slack API for authorization and return
- Upon return the OAuth and bot configuration is stored in the
retro_authtable
- All requested Slack events sent by the events API by the
slack-lambda-retrofunction, these are validated and then put on the SNS queue and a HTTP 200 is returned immediately to satisfy Slack's timing requirements - All incoming SNS items are also received by the
slack-lambda-retrofunction, which is then dispatched to thehandle_eventorhandle_commandfunctions appropriately
This app requires a few components to install:
Manual configuration is required in a few places:
- An AWS user set up with permissions to deploy a Lambda, configured as a profile in
~/aws.config. I use the namelambda_deployas a convenience, if different you will need to changedeploy.cfgand the two kappa*.yamls - Configuration of the deployment variables in the root
.env - Configuration of the runtime variables in the source directory
_src/.env
Lambda deployment is covered by the python application Kappa, as per its instructions you will need to create your own IAM user for deployment.
The lambda itself should be deployed with two commands:
lambda deploy - This will deploy the main function
lambda --config kappa_oauth.yaml deploy - This will deploy the second function for OAuth handling
Deployment is locally invoked through the deploy.py function. This will provision the following:
- DynamoDB Tables retro/retro_auth/retro_messages
- SNS Topic
- API Gateway Functions
- IAM Policies for everything to talk to each other
- Create an app integration in your Slack account and place the app's client ID and token in
_src/.env - Enter your deployed API URLs from the environment deployment in the event POST API and command POST API url entries
- Visit your OAuth URL to perform authentication for your application
Use the /retro start to begin the process!