Python script to create documents via Churchtools API.
- Member list
- Prayer list
- Checkin form
- Attendance report
- Copy
.env.sample
to.env
, and adjust to your setup. - Copy template.sample.odt to template.odt and adjust to your preferences (Use LibreOffice to modify the template).
- Check the template language documentation
- Install Python 3
- Create a virtual env for this project, and activate the venv. More information
- Install Python dependencies:
<path_to_venv>/bin/pip install -r requirements.txt
Any of the below commands will create odt
output files.
Use LibreOffice to preview or postprocess them, or generate a PDF of it.
You can also use the command line to generate a PDF: libreoffice --convert-to pdf --outdir . input.odt
Creates a membership directory.
./create-memberlist.py \
--filter-group <group_id> \
[--template template_memberlist.odt] \
[--output memberlist.odt]
The --filter-group
param is used to filter by a certain group in Churchtools.
Creates a prayer list (similiar to membership directory, but different layout). Can be filtered to include only part of the members using --surname-from
and surname-to
arguments.
./create-prayerlist.py \
[--surname-from <letter>] \
[--surname-to <letter>] \
[--template template_prayerlist.odt] \
[--output prayerlist.odt]
Create a checkin form. This assumes you have two groups: Members and regular visitors. The regular visitors group can be filtered to include only certain roles from that group.
./create-checkinform.py \
--group-members <group_id> \
--group-regularvisitors <group_id> \
--role-id-regularvisitors <role_id> \
[--template template_checkinform.odt] \
[--output checkinform.odt]
Generate an attendance report.
./create-attendancereport.py \
--group-members <group_id> \
--group-regular-visitors <group_id> \
--role-id-regularvisitors <role_id> \
--group-visitors <group_id> \
--role-id-visitors <role_id> \
--date YYYY-MM-DD \
[--template template_attendancereport.odt] \
[--output attendancereport.odt]
Find your ChurchTools API documentation / playground here: <mychurch>.church.tools/api
To retrieve a login token, first find your user ID using the GET /persons
API.
Then use the GET /persons/{id}/logintoken
API to get your login token.