calrules
enables you to perform actions against meeting requests and meeting cancellations.
calrules
only works with Microsoft Exchange calendar providers.
I'm too lazy to create a PyPi package, but you can easily install this using:
pip install git+https://github.com/sthulb/cal-rules.git
This package requires Python 3.9 or higher.
You can run the project using the calrules
binary that's installed, make sure you include the --config
parameter:
calrules --config /path/to/config.yaml
You can add more detailed logging using the LOG_LEVEL=debug
env var.
sender
email address who sent the meetingrecipients
a list of email addresses the event was sent to.type
meeting event type,REQUEST
orCANCELLATION
subject
calendar event subject linehas_conflicts
if the event is conflicted with anothersent_date
a unix timestamp of sent dateduration
duration of the eventmodified
if the event is an update to the original event
Example Config:
exchange:
email: <email>
username: <username>
domain: <domain>
password: <password>
server: <server>
ca_cert: <optional mail server TLS root cert>
rules:
- pattern: "type == 'CANCELLATION'"
description: Meeting Cancellation
response: DELETE
- pattern: "sender == '[email protected]'"
description: Decline cal spam
response: DECLINE
message: No thanks!
## Complex rules
- pattern: >
sender in [
"[email protected]",
"[email protected]",
"[email protected]",
]
description: Thing (Addresses)
response: DECLINE
- pattern: >
[s for s in [
".*Foo.*",
".*Bar.*",
".*Baz.*",
] if subject =~ s]
description: Thing (Subject)
response: DECLINE