A Microsoft Outlook event Slack bot
Project description
Microsoft Outlook Event API Slack Bot
The repository includes a Python-based Slack Bot for MS Outlook events.
Functionality
The application allows accessing shared calendars of a user and reading the corresponding weekly events via Microsoft API calls. In the next step, it is possible to send this event in the form of a Slack message to a connected Slack channel.
Installation
pip install outlook-event-slack-bot
Example of use
import argparse
from outlook_event_slack_notification_bot.model import SlackAPI, OutlookCalendarApi
from outlook_event_slack_notification_bot.slack import Slack
from outlook_event_slack_notification_bot.outlook_calendar import OutlookCalendar
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Script to extract a user's Outlook calendar events and "
"forward them to a Slack channel.")
parser.add_argument("-wh", "--webhook", type=str, required=True, help="Get the Slack webhook")
parser.add_argument("-t", "--tenant", type=str, required=True, help="Get the Microsoft tenant")
parser.add_argument("-ci", "--client-id", type=str, required=True, help="Get the Microsoft OAuth Client ID")
parser.add_argument("-cs", "--client-secret", type=str, required=True, help="Get the Microsoft OAuth Client secret")
parser.add_argument("-scu", "--shared_calendar_user", type=str, required=True,
help="Get the Outlook shared calendar user")
parser.add_argument("-scn", "--shared_calendar_name", type=str, required=True,
help="Get the Outlook shared calendar name")
parser.add_argument("-cn", "--custom_notification", type=str, required=True,
help="Should be custom notifications send to the corresponding users, "
"defined Outlook calendar event body?")
args = parser.parse_args()
outlook_calendar_api: OutlookCalendarApi = OutlookCalendarApi(
tenant=args.tenant, client_id=args.client_id, client_secret=args.client_secret
)
outlook_calendar: OutlookCalendar = OutlookCalendar(outlook_calendar_api)
events: list = outlook_calendar.get_events(
args.shared_calendar_name, args.shared_calendar_user
)
events_cw: list = outlook_calendar.get_weekly_events(events)
Slack(SlackAPI(args.webhook), args.custom_notification).send_slack_message(events_cw)
Optimization potential:
- Add Integration tests
Contribution
If you would like to contribute something, have an improvement request, or want to make a change inside the code, please open a pull request.
Support
If you need support, or you encounter a bug, please don't hesitate to open an issue.
Donations
If you want to support my work, I ask you to take an unusual action inside the open source community. Donate the money to a non-profit organization like Doctors Without Borders or the Children's Cancer Aid. I will continue to build tools because I like them, and I am passionate about developing and sharing applications.
License
This product is available under the Apache 2.0 license.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file outlook_event_slack_bot-0.0.7.tar.gz
.
File metadata
- Download URL: outlook_event_slack_bot-0.0.7.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3542e715252540e2c47a4014f6557b9a6347180738eb0fcc6825911fc42354cf |
|
MD5 | 9e3833f19e9208bc3de188890118fd89 |
|
BLAKE2b-256 | d1bcbcc3918a4fae2d3701f6334858999efc754a23559d623f887828bd62c42b |
File details
Details for the file outlook_event_slack_bot-0.0.7-py3-none-any.whl
.
File metadata
- Download URL: outlook_event_slack_bot-0.0.7-py3-none-any.whl
- Upload date:
- Size: 11.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b3245a376458d423183177aad390c44bea8e07b55de7ced66b7698da1de6d828 |
|
MD5 | 10b11edf53c128f3831df6176e0560a2 |
|
BLAKE2b-256 | e87a546ef4979e796bdf8a4580c5b7dc8b7deede5556ca872a57dd0712596023 |