Estimate contextual delays (the ones you can't control) for research tasks using multiple parameters.
To see usage from within slack, enter
/delay-estimator
from within the slack site where it is installed, or see below:
/delay-estimator best_case_weeks=2 fraction_RD=0.8 hpc_factor=1 num_coauthors=1 stress_level=1
Parameters:
- best_case_weeks: Minimum possible time required, in weeks (e.g. 2)
- fraction_RD: Fraction of task that is R&D (0 to 1)
- hpc_factor: 0 = no HPC, 1 = average reliability, >1 = worse than average
- num_coauthors: Number of coauthors who must weigh in (excluding PI)
- stress_level: 0.5 = rested, 1 = typical, >1 = depleted
Typical output:
(General guide generated by ChatGPT)
This guide will help you build and deploy a Slackbot using Python, Flask, and either your local machine (with ngrok) or PythonAnywhere. It assumes basic comfort with Python but no prior experience with Slack app development.
- Go to https://api.slack.com/apps
- Click Create New App > From scratch
- Give your app a name (e.g.
MyBot) and select your Slack workspace
- In the left menu, click Slash Commands
- Click Create New Command
- Command:
/mybot - Request URL: (you'll set this after deployment)
- Short Description: A test bot
- Usage Hint:
name=value name2=value2
- Command:
- Save the command
- In the left menu, click Interactivity & Shortcuts
- Turn it ON
- Set the Request URL to the same endpoint as your slash command
- In the left menu, go to OAuth & Permissions
- Click Install App to Workspace
- Authorize access
Here is a minimal example (app.py):
from flask import Flask, request, jsonify
app = Flask(__name__)
@app.route("/slack/command", methods=["POST"])
def respond():
user_input = request.form.get("text", "")
return jsonify({
"response_type": "in_channel",
"text": f"You said: {user_input}"
})
if __name__ == "__main__":
app.run()-
Install ngrok
-
In terminal:
ngrok http 5000
-
Copy the URL (e.g.
https://abcd1234.ngrok.io) into Slack as the Request URL -
Run your app locally with:
python app.py
-
Login into https://www.pythonanywhere.com/ (if this is a lab slackbot, you can run it on the lab pythonanywhere account)
-
Go to the Files tab and upload your
app.py -
Go to the Web tab and create a new web app (Manual configuration, Python 3.x)
-
Edit your WSGI configuration file and replace its contents with:
import sys path = "/home/yourusername" if path not in sys.path: sys.path.append(path) from app import app as application
Replace
"yourusername"with your PythonAnywhere username, and"app"with the name of your Python file (without.py). -
Reload your app using the Web tab.
-
Use this URL as your Slack slash command Request URL:
https://yourusername.pythonanywhere.com/slack/command
In Slack, type:
/mybot Hello world
You should see the bot respond:
You said: Hello world
You can expand your bot to support features like:
- A
/mybot helpmessage - Rich responses using Slack Block Kit (e.g. buttons, menus, layouts)
- Interactivity support (e.g. handling button clicks or modal inputs)
- Custom validation and argument parsing