Jokess Bot is a simple slack bot to send automated scheduled jokes to slack channels
- Python 3.X.X
- Requests
- Slack SDK
For running locally, Please create a virtual environment and install the dependencies in that environment.
python -m venv env
- Visit Slack API.
- Click on Create App.
- Select From Scratch.
- Enter your App Name & Workspace. This can be changed later.
- Choose Bots as Feature and Functionality.
- Then assign a scope to your bot token, You will be redirected to the scope page. scroll down to Bot Token Scopes.
- Scopes you need to add : channels:read, chat:write, chat:write.customize, chat:write.public, im:write, mpim:write
- Go to OAuth & Permissions and Search for OAuth Tokens for Your Workspace.
- Copy your token and use it the below command
- Login to your Heroku Dashboard.
- create a pipeline and an application on Heroku platform and upload your code to it.
- You can use Heroku CLI or GitHub to connect your source code to Heroku application
- Then you can go into Deploy menu in the Heroku application and deploy the application. It will install the required packages in the environment and ready the python environment for your app.
- Now you have to create the scheduler for your python script. To do that, you can use Heroku add-ons. Go to resources menu in your Heroku application and search for Heroku Scheduler (Free Option).
- Enter the config as per your requirement and add this command -
python app.py --channel=<CHANNEL> --token=<TOKEN>
- Download the Heroku CLI.
- Run
heroku login -i
. - Enter Email and Password.
- Run the following command to check the scheduled task/job -
heroku run python app.py --channel=<CHANNEL> --token=<TOKEN> --app <APP NAME>
Jokess variables can also be added to environment variables as follows
export JOKESS_BOT_CHANNEL=<CHANNEL>
export JOKESS_BOT_AUTH_TOKEN=<TOKEN>
python3 app.py --channel=<CHANNEL> --token=<TOKEN>
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Icons made by Freepik from www.flaticon.com