/rocketchat-google-calendar

Integration of rocketChat with Google calendar using a pything script to create a webhook

Primary LanguagePythonMIT LicenseMIT

rocketchat-google-calendar

Integration of rocketChat with Google calendar using a python script to create a webhook

The solution consists of two parts.

  1. A python script that connects to google calendar API and sends the data to RocketChat
  2. An incoming webhook in RocketChat that interprets the data sent from the python script

Instructions

  1. Checkout the project
  2. Create an incoming webhook in your RocketChat
    1. Go to RocketChat-> Administration-> Integrations-> New Integration-> Incoming webhook
    2. Set "Enabled" to "true"
    3. Give a name for the webhook
    4. Define the channel you want the events to appear (ex: #calendar-events). Make sure the channel exists
    5. Set "Script Enabled" to "true"
    6. Put in the script field the contents of the file webhook.js
    7. Press "save changes"
    8. Copy the contents of the newly created field "Webhook URL" to clipboard. You will need it.
  3. Configure the python script
    1. Open the file calendarWebhook.py
    2. On line 18, put the url you copied form the RocketChat incoming webhook
    3. Open in your browser your google calendar, find the settings of that specific calendar and copy the CalendarId
    4. Paste the CalendarId on line 21
    5. If you want your results to appear in a specific timezone, fill in the line 24 (example: Europe/Athens)
  4. Install python prerequisites
    1. pip install --upgrade google-api-python-client
    2. pip install requests
  5. Create google api credentials as shown at: https://developers.google.com/google-apps/calendar/quickstart/python (step 1)
  6. Put client_secret.json from above step in the same directory as your python scrpt
  7. Fire up the OAuth authentication process by running it once on shell/terminal
    1. Create an event in your calendar starting somewhere in the next 30 minutes
    2. run: python calendarWebhook.py
    3. follow the instructions for authorising the script to access the calendar. Note: The user you use to authorise should have access to the calendar
    4. If all went well, it should post the calendar event in your channel
  8. set to run every 5 minutes