Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/schibsted/slack-calendar-topic
Set the topic of a Slack channel to the currently ongoing event in a Google calendar
https://github.com/schibsted/slack-calendar-topic
google-calendar slack
Last synced: about 2 months ago
JSON representation
Set the topic of a Slack channel to the currently ongoing event in a Google calendar
- Host: GitHub
- URL: https://github.com/schibsted/slack-calendar-topic
- Owner: schibsted
- License: mit
- Created: 2020-08-06T21:42:16.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-02-05T18:20:24.000Z (almost 4 years ago)
- Last Synced: 2024-04-09T21:51:03.146Z (9 months ago)
- Topics: google-calendar, slack
- Language: JavaScript
- Homepage:
- Size: 142 KB
- Stars: 2
- Watchers: 12
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Slack Calendar Topic
[![Build Status](https://travis-ci.com/schibsted/slack-calendar-topic.svg?branch=master)](https://travis-ci.com/schibsted/slack-calendar-topic)
[![Maintainability](https://img.shields.io/codeclimate/maintainability/schibsted/slack-calendar-topic)](https://codeclimate.com/github/schibsted/slack-calendar-topic)
![License](https://img.shields.io/github/license/schibsted/slack-calendar-topic)A script that sets the topic of a Slack channel to the currently ongoing event
in a Google calendar. Great for keeping track of who's on call, for example.![Image](./docs/calendar.png)
## Getting started
#### Create a service account
Create a Google Service Account, download the credentials in JSON format and
export it to `GOOGLE_CREDENTIALS`.#### Create a Slack bot
Create a Slack bot with scopes `channels:manage` and `channels:read`, and export
its access token to `SLACK_ACCESS_TOKEN`.#### Share calendar(s) with your service account
Go to **Settings and sharing** for the Google Calendar(s) you'd like to use, and
share them with the service account by entering the e-mail address of the
service account in **Share with specific people**.#### Mentions in calendar events
If you want to use mentions in the topic, you need to use Slack's special syntax for
that. Open Slack and go to the profile of the user you want to mention, click the `More`
button and then `Copy member ID`. You can now mention that user with `<@{MEMBER-ID}>`For example, if the desired member ID is `F4K3ID123`:
```
Person on-call: <@F4K3ID123>
```Unfortunately, this can make it hard to read your calendar at a glance. To get around that,
put your topic in the event description instead of the title, and we'll use that when it's set.#### Connect calendars and channels
Create a mapping between calendars and channels like so, and export it to
`CHANNEL_CALENDAR_MAP`:```
[
{
"calendarId": "[email protected]",
"channelId": "C018DQTCFNX"
},
...
]
```#### Run it
That's it! Run it with `npm run update` (or `./bin/update`) and watch your channels
be updated to the currently ongoing events in the corresponding calendars:```sh
$ ./bin/update
#backend-bugs: Set topic to 'Person on call: Tuesday talent 🤩'
#infrastructure-issues: Topic already set
#petty-problems: No ongoing event
```## Deploying
#### Anywhere you want
You can deploy this script anywhere that runs Node and has some mechanism for running it on
a schedule (like cron).#### AWS Lambda
It's a particularly good fit for a [Lambda scheduled with CloudWatch][aws]. Create your lambda,
set the environment variables, and configure the handler as `lambda.handler`. Then, run
`AWS_LAMBDA_NAME=slack-calendar-topic ./deploy.sh` to deploy it.If you haven't already, remember to install and configure your `aws` command line interface first:
- Log into your AWS Console and retrieve your IAM credentials.
- Run `aws configure` and follow the steps.[aws]: https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/RunLambdaSchedule.html