https://github.com/barricklab/barricklab_calendar
Google Calendar to Slack Daily Events
https://github.com/barricklab/barricklab_calendar
Last synced: 4 months ago
JSON representation
Google Calendar to Slack Daily Events
- Host: GitHub
- URL: https://github.com/barricklab/barricklab_calendar
- Owner: barricklab
- License: mit
- Created: 2024-07-13T21:15:27.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-01T02:33:46.000Z (almost 2 years ago)
- Last Synced: 2025-09-09T16:02:50.812Z (11 months ago)
- Language: Python
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Barrick Lab Google Calendar -> Slack Daily Events
## Setup
You have to set up a number of things to communicate for this to work!
## Slack
Create an App in your workspace.
It needs to have these permissions:
```
channels:read
chat:write
```
You will need to set up a file called `slack.json` with the credentials so that your script can post on Slack.
```
{
"SLACK_BOT_TOKEN":"XXXXXXXXXXXXXXX",
"SLACK_SIGNING_SECRET":"XXXXXXXXXXXXXXX",
"CHANNEL":"general"
}
```
## Google Calendar
Set up a Google App using [https://developers.google.com/calendar/api/quickstart/python](these directions). Use the Calendar owner's Google account for Google Cloud. Add this email as the test user. Enable the Google Calendar API. You need to give permission to read events. You will need to download `credentials.json` from here.
## Local Setup
```bash
conda create -n slackapp python
conda activate slackapp
pip install -r requirements.txt
```
Now check that it works on your local machine. You must do this to authorize for Google.
```bash
python barricklab_calendar.py
```
After run this once, you should have a local `token.json` file. You can copy this to another machine (the server) and it will work.
## Server Setup
You need a machine with an internet connection that is on all the time to call this at specified time.
tun
On that machine, set up the Conda environment.
Then, add something like this to your crontab to have it run each day at 8 AM.
```
sudo crontab -e
```
```bash
PATH=/home/jbarrick/.conda/envs/slackapp/bin
0 8 * * * (cd /home/jbarrick/barricklab_calendar; python barricklab_calendar.py >> /home/jbarrick/barricklab_calendar/logs.log 2>&1)
```
Of course, fix the paths to the Conda environment bin directory and the source code.