Skip to main content

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="Local script to get the IP address of the "
                                                 "local machine and forward it.")
    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 would like 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 it and it is my passion to develop and share 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

outlook-event-slack-bot-0.0.1.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

outlook_event_slack_bot-0.0.1-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file outlook-event-slack-bot-0.0.1.tar.gz.

File metadata

File hashes

Hashes for outlook-event-slack-bot-0.0.1.tar.gz
Algorithm Hash digest
SHA256 5f8f41d2019482af8dba37504c75602b378f1069050a4c17d4d5fa8287b6aace
MD5 b60ee436b5f7d35817812020aad825b2
BLAKE2b-256 fd8e756e6febbd41ce8bdb288e704ff214a09839e3832abf3e6326af5fd315ee

See more details on using hashes here.

File details

Details for the file outlook_event_slack_bot-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for outlook_event_slack_bot-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f951b04bf0e1c90dd617e99f458503290dcba6d7ed40576348523fa980fda58c
MD5 0f19641d4d419a12cfc955ea9e4f6cb7
BLAKE2b-256 f8dafd57dfe8402bd186d96d70fb49d04453e08c1dad784c2d529ca7e47cb1bc

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page