The experment bot for generating hexagrams on slash commands.
It allows users to ask any question and receive a hexagram and a poetic text as a response. The app uses a slash command, which is a way to invoke an app by typing a string into the message box. The app's slash command is /ask
, followed by the user's question (or nothing for general read).
The app tries to replicate the Yarrow Stalk casting method, which is one of the traditional ways to generate a hexagram from the I Ching. User can either scratch the poetry recieved from the bot, or save it to Notion database and publish to main channel for further discussion.
The app's purpose is to provide a fun and creative way to explore the ancient wisdom. The app is inspired by a book called "The Science of I Ching" by Joseph K. Kim & Dr. David S. Lee, which focuses on the beginnings of Eastern thought. The app also thanks pantherwebworks for providing the web source for the poetic texts.
The project uses several AWS resources, including Lambda functions and an API Gateway API. These resources are defined in the template.yaml
file. You can update the template to add AWS resources through the same deployment process that updates your application code.
- Slack workspace with admin access
- Notion account with API access
- AWS account; AWS CLI
sam build
sam deploy --guided
- Create custom bot for slack
- Configure slash command to accept requests and save them to Notion
- Nudge shortcut
- Connect Slack App to Notion (https://www.notion.so/my-integrations)
- Install Slack App to your workspace (https://api.slack.com/apps/)
- Configure bot permissions, interactivity, slash commands with the request URL (using API Gateway endpoint URL for RandomBot function)
- Populate environment variables in the console.aws.amazon.com (names sampled in
template.yaml
)
Build your application with the sam build
command.
random-bot-app$ sam build
Run functions locally and invoke them with the sam local invoke
command.
random-bot-app$ sam local invoke RandomBotFunction --event events/event.json
The SAM CLI can also emulate your application's API. Use the sam local start-api
to run the API locally on port 3000.
random-bot-app$ sam local start-api
random-bot-app$ curl http://localhost:3000/
random-bot-app$ sam logs -n RandomBotFunction --stack-name random-bot-app --tail
random-bot-app$ cd src
src$ npm install
src$ npm run test
App logo generated with DALL·E 3 🙇
To delete the application can use the AWS CLI:
sam delete --stack-name random-bot-app