This is an old revision of the document!
TrainingBot
Some of the committees have adopted the TrainingBot system to keep on top of training requests.
- Training is requested via a google form.
- Form responses are collected in a google sheet.
- A Slack bot (TrainingBot) posts to the committee channel whenever someone requests training.
- The TrainingBot posts a list of all the pending training requests to the committee channel once a week.
Implementation details:
- Create a google form in your committee's google drive folder - see the training request forms on this page for examples
- Make sure you collect their name, and their slack or talk handle
- Set the google form up to save responses to a google sheet that also belongs to your committee's group.
- From the Form, click “App Scripts” to load up the app scripts editor
- Name the created project “<Subject> Training Bot Scripts”. e.g. “CoreXY Training Bot Scripts”
- Click on the sidebar to add a library, and enter this library ID: 1NX_-nJIfqTDdmuDtLvdI4-t-sXl7V5Lt0-CBHCO54jyGwFBt9_mZ9DEa
- If you don't have access to the Library, ask @cory on slack
- Customize and add the following code to the main code.gs file in the App Script project:
const TRAINING_TYPE = "CoreXY";
const COMMITTEE_CHANNEL = "3d-printing-committee";
const COMMITTEE_NAME = "3D Printing Committee";
const FORM_NAME_FIELD = "Slack username";
function onSubmit(e) {
let form = FormApp.getActiveForm();
let formResponse = VHSWebhookCode.parseForm(form);
const username = formResponse[FORM_NAME_FIELD];
const message = `${formResponse['Name']} (@${username}) has requested ${TRAINING_TYPE} training. They should be contacted by ${VHSWebhookCode.getDateNDaysFromNow(30)}.`;
VHSWebhookCode.postToSlack(COMMITTEE_CHANNEL, message);
const dm_message = `The ${COMMITTEE_NAME} has been notified of your training request, and someone should get back to you soon! Remember, we're all volunteers here at VHS, so please be patient!`;
VHSWebhookCode.sendSlackDMToUser(username, dm_message);
};
The most important details to get right are COMMITTEE_CHANNEL, which needs to exactly match the committee channel name, and FORM_NAME_FIELD, which needs to exactly match the name of the username field in the Google Form.