Queries all users for a specific team from the Postgres DB of Mattermost. Assigns every user based on email address to a manager and then send the resulting userlist to the managers.
- Managers are defined in the separate managers.json file
- The email template is in message txt
By default the script looks for both files in the current running directory
pip3 install psycopg2 sqlalchemy
- Modify message.txt to suit your needs
- Fill out managers.json
- Fix variables inside the script. Including:
- Team ID inside the SQL statement
- Mattermost config file location
- SMTP info
- Admin email, who's report includes all users that do not have a manager
python3 mm-user-report.py
NB! There is a commented out print statement near the end. You can comment that in and comment out the following send_message line to see all reports before sending.
- Do not query from the DB, but use the API with a token.
- Variables as command line params.