Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
wiki:committees:trainingbot [2026/08/31 15:18] corywiki:committees:trainingbot [2026/08/31 15:48] (current) cory
Line 1: Line 1:
-===== TrainingBot =====+<!DOCTYPE markdown> 
 + 
 +TrainingBot
  
 Some of the committees have adopted the TrainingBot system to keep on top of training requests. Some of the committees have adopted the TrainingBot system to keep on top of training requests.
Line 7: Line 9:
   - A Slack bot (TrainingBot) posts to the committee channel whenever someone requests training.   - 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.   - The TrainingBot posts a list of all the pending training requests to the committee channel once a week.
 +  - Trainers view the responses form, and when they have reached out to someone they add something to a specific row which removes them from the reminders list.
  
-=== Implementation details: ===+## Implementation details:
  
-  - Create a google form in your committee's google drive folder - see the [[..:tools:training|training request forms]] on this page for examples+  - Create a google form in your committee's google drive folder - see the [training request forms](wiki:tools:trainingfor examples
       - Make sure you collect their name, and their slack or talk handle       - 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.   - 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   - 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 Form Scripts" +  - Name the created project "<Subject> Training Form Scripts". e.g. "CoreXY Training Form Scripts" 
-  - Click on the sidebar to add a library, and enter this library ID: %%1NX_-nJIfqTDdmuDtLvdI4-t-sXl7V5Lt0-CBHCO54jyGwFBt9_mZ9DEa%% +  - 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 +      - If you don't have access to the Library, ask in `#vhs-it-ops` on slack or DM `@cory`. 
-  - Customize and add the following code to the main %%code.gs%% file in the App Script project:+  - Customize and add the following code to the main `code.gsfile in the App Script project:
  
-<code>+```
 const TRAINING_TYPE = "CoreXY"; const TRAINING_TYPE = "CoreXY";
 const COMMITTEE_CHANNEL = "3d-printing-committee"; const COMMITTEE_CHANNEL = "3d-printing-committee";
Line 38: Line 41:
   VHSWebhookCode.sendSlackDMToUser(username, dm_message);   VHSWebhookCode.sendSlackDMToUser(username, dm_message);
 }; };
-</code>+```
  
-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.+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.
  
-Now add a trigger, so the onSubmit script is run when the form is submitted. Go to the triggers tab from the sidebar, and add a trigger that runs onSubmit when the "On form submit" event happens.+Now add a trigger, so the `onSubmitscript is run when the form is submitted: go to the triggers tab from the sidebar, and add a trigger that runs `onSubmitwhen the "On form submit" event happens.
  
 The final step is to add the weekly reminders. To do this, go to the form's responses Sheet, and under the "extensions" menu select "App Script". The final step is to add the weekly reminders. To do this, go to the form's responses Sheet, and under the "extensions" menu select "App Script".
  
-Name the project something like "CoreXY Training Response Scripts"+Name the project something like "CoreXY Training Sheet Scripts"
  
 Add a modified version of the following code to the App Script: Add a modified version of the following code to the App Script:
  
-<code>+```
 const TRAINING_TYPE = "filament"; const TRAINING_TYPE = "filament";
-const SHEET_NAME = "Form Responses 3";+const SHEET_NAME = "Form Responses 1";
 const CHANNEL = "3d-printing-committee"; const CHANNEL = "3d-printing-committee";
 const SHEET_NAME_INDEX = 1; const SHEET_NAME_INDEX = 1;
Line 68: Line 71:
   VHSWebhookCode.postToSlack(CHANNEL, message);   VHSWebhookCode.postToSlack(CHANNEL, message);
 } }
-</code>+``` 
 + 
 +Important variables: 
 + 
 +- `SHEET_NAME` is the name of the sheet - usually "Form Responses 1". 
 +- `SHEET_NAME_INDEX` is the index of the name field, 0 is the first column, 1 is the second, etc. 
 +- `SHEET_TRAINED_STATUS_INDEX` is the index of the field used to track if the member has been contacted.
  
-let TRAINING_TYPE = "filament"+Then go to the Triggers section, and add a "Time Basedtrigger that runs `checkForUnTrained` weekly.
-let SHEET_NAME = "Form Responses 3"; +
-let CHANNEL = "3d-printing-committee";+
  
-Then go to the Triggers section, and add "Time Based" trigger that runs %%checkForUnTrained%% weekly.+Don't forget to run both the scripts manually - sometimes it'll toss up permissions dialog that you have to OK before it'll run successfully.
  
 That's it! That's it!