A Hubot script that responds with the list of people assigned to a given task.
The list of tasks and assignments is read from Google Sheets.
This works well for notification abou tasks that should be performed periodically in a round-robin manner. Moving the marker to the next person should be done manually. This bot only reads out the assignments.
The worksheet with tasks should contain the following columns:
- Name
- Chat username
Keep in mind that the names of those columns should be exactly as written above.
Then, each task should have a separate column. The task name is the header of the column.
The bot assumes that assignment is done by having any marker in a cell. There may be multiple markers in a column if a task should be performed by more than 1 person.
The spreadsheet can contain multiple worksheets. Each can be referenced individually by name.
Name | Chat username | Host | Minutes owner |
---|---|---|---|
John Wick | johnny | ||
Joe Goldberg | will.bettleheim | x | |
Love Quinn | love | ||
Forty Quinn | forty.quinn | x | |
Candace | candace | x | |
Luke Skywalker | luke |
Assuming the worksheet name is Hollywood meeting:
Got it! For Hollywood meeting: Host - @will.bettleheim (Joe Goldberg), @forty.quinn (Forty Quinn) Minutes owner - @candace (Candace)
You can ask the bot for task assignments from a specific worksheet, or from all worksheets that the bot can recognize.
Ask the bot the following:
@botname show all
The bot will try to parse all worksheets and reply with task assignments.
The bot can be invoked with the following command:
@botname who is responsible for (worksheet name)?
for example:
@botname who is responsible for Hollywood meeting?
And the bot will read out the assignments in the Hollywood meeting worksheet.
There is also a shorthand command that has the same effect:
@botname show (worksheet name)
This sections lists the steps required to install the script.
- Node 10.x+
- npm v6+
You can use the prebuilt script, downloadable as the asset in a given release on GitHub (sheets-task-reader.js
).
Alternatively, you may build the script yourself. To build the script, run the following commands:
npm install
npm run build
Then, the script should be available in dist/index.js
.
Copy the script (sheets-task-reader.js
from a prebuilt release or dist/index.js
if built
yourself) to <your hubot instance>/scripts/sheets-reader.js
.
Add the following line to the dependencies
object in your Hubot's package.json
:
"google-spreadsheet": "^3.0.10"
The following environment variables should be set before Hubot is started:
-
HUBOT_GOOGLE_SHEETS_CREDENTIALS_PATH
The path to the Google Sheets credentials file.
To generate the credentials file, follow the instructions in the
google-spreadsheet
package.Don't forget to share the spreadsheet with the service account (by sharing it with the generated account's e-mail).
-
HUBOT_SPREADSHEET_KEY
The ID of the spreadsheet that the bot should read.
It can be extracted from the spreadsheet's URL:
https://docs.google.com/spreadsheets/d/here is the spreadsheet key/edit#gid=0
Feel free to contribute by raising a Pull Request or creating an issue for discussion.