A Google App Scripts Bot for supporting team morale and happiness
Anyone managing a squad is aware that there is much that happens that they don't know about. Private feedback conversations, low grade grudges and pleasant moments all come and go behind closed doors.
Each squad member has their own personal life, communities that they participate in at work, and relationships with the squad management themselves.
Everyone's reality is complex, and we never see it all.
When things go wrong, when someone is upset, or needs help, how do we know to help them?
This app bot is a set of scripts designed to help squads to share, monitor and support their collective health.
The main function is to create Google Forms based off of a set template:
- to gather anonymous feedback on how squad members are feeling
- distribute that form to your squad members
- send summaries to the squad leads and trio for them to review and act on.
If you are managing multiple teams, as part of a wider tribe, then the bot is able to generate forms for each squad individually, and send summaries for both each squad and for the whole collective at the right level.
You don't have to know how to code to use this bot. All that is required is a Google Workspaces account, the ability to copy and paste some files, and altering one file with contact information in javascript (following a template provided).
This bot has been written to be simple to use. Instructions are provided below.
-
In Google App Scripts, create a new project
-
Go to the editor
-
Copy all the files from the utils source folder and then the bot source folder into the app scripts project by clicking the plus symbol next to Files
This part is currently tedious as you have to move each file separately - it is just as easy to copy all file content in order into the one file
IMPORTANT: Ensure that you have the files in the right order in the app script project, or the bot will not work
-
Copy the file StartHere.template.js into the app scripts project, changing the placeholder values to be your tribe's real values
-
Go to the triggers menu on the left of the page and add click a new trigger
-
Select the following:
- Function to run:
surveyTribeMorale - Deployment should run:
Head - Event source:
Time-driven - Type of time based trigger:
Week timer - Day of week:
Monday - Time of day:
8am to 9am
- Function to run:
-
Add another trigger, this time selecting the following:
- Function to run:
closeTribeMoraleSurveys - Deployment should run:
Head - Event source:
Time-driven - Type of time based trigger:
Week timer - Day of week:
Thursday - Time of day:
5pm to 6pm
- Function to run:
You now have two triggers. One will create and distribute the forms to your squads every Monday morning.
The other will close the forms and send a summary to the Trio and Squad Leads every Thursday evening.
N.B. Google should prompt you to approve permissions to create forms, and to send emails and gchat messages (if webhooks provided). It might similarly ask to be allowed to use some libraries.
If it does not, you may need to run the function
surveyTribeMoralemanually for the first time for this to happen. All of these need to be approved for the bot to work.
To see if the trigger has run successfully, you can look under Executions in the side menu to see the status of every run.
Google offers a Client Library for deploying App Script Projects (clasp) that can be used to push the code directly to the project without all the copy and pasting.
The clasp library is functional, but limited and can be awkward. Care should be taken when using it.
In particular, at time of writing, there is no way to push individual files - it must manage the entire project in one go.
If you are comfortable using a command line tool, you can build the bot using clasp:
set -e
# In repo root directory
# Install npm packages
npm install
yarn install --frozen-lockfile
# Authorise clasp with google via the browser
yarn run clasp login
# Create new app script project with clasp
# N.B. skip if you've already created your project
yarn run clasp create --title Wellbot --type standalone --rootDir src
# Clasp has created a .clasp.template.json file in src/ which is the wrong place - create the right file
NEW_SCRIPT_ID=$(jq '.scriptId' src/.clasp.json | sed -e 's/^"//' -e 's/"$//' ); \
cat .clasp.template.json | sed -e s/SCRIPT_ID_PLACEHOLDER/$NEW_SCRIPT_ID/ > .clasp.json
# Remove the useless file that clasp created now we've made the useful one
rm src/.clasp.json
yarn run clasp push --forceAfter this, you can run clasp commands as normal (e.g. clasp push) to manage the project. The file .clasp.json is created to configure the tool, and should be kept for future use.
It will still be necessary to add your configuration file based off of the config template.
I have attempted to use language based off of the Spotify model where possible:
- Squad: a small autonomous team of member practitioners working on a shared problem (e.g. a two pizza team)
- Squad Lead: a senior manager within the squad responsible for looking after the squad members
- Tribe: a group of teams working in a similar field that interact with each other regularly
- Trio: the senior management responsible for looking after the whole Tribe
This bot runs on the Google Workspace utility Google App Scripts, which is part of their enterprise offering. To check if you can use app scripts:
- Go to the App Scripts Dashboard
- Login to your Google Workspaces user, and approve permissions
You should now be able to view the Apps Scripts Dashboard

