Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zk-phi/slack-to-gcal
Slack slash command to manage Google Calendar events and tasks
https://github.com/zk-phi/slack-to-gcal
gas slack
Last synced: 11 days ago
JSON representation
Slack slash command to manage Google Calendar events and tasks
- Host: GitHub
- URL: https://github.com/zk-phi/slack-to-gcal
- Owner: zk-phi
- Created: 2020-01-20T04:03:27.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-03-01T03:30:56.000Z (almost 4 years ago)
- Last Synced: 2024-11-08T04:40:37.490Z (2 months ago)
- Topics: gas, slack
- Language: JavaScript
- Homepage:
- Size: 73.2 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: Readme.markdown
Awesome Lists containing this project
README
# slack-to-gcal
CRUD Google Calendar events from Slack.
# Setup
## Install `clasp`This app can easily be deployed to your Google Drive with `clasp` (an official Google Apps Script API client).
See the repository page (https://github.com/google/clasp) for install instructions.
After installing `clasp`, log-in to your Google account with `clasp login`.
## Deploy the app to your Google Drive
### Create an empty Google Apps Script itemIn your Google Drive page, create a new item of the type `Google Apps Script` and copy the ID in its URL.
```
https://script.google.com/d//edit
```FOR SECURITY REASONS, YOU MUST NOT SHARE THE ITEM (especially with Edit permission) WITH OTHERS.
### Deploy the app
Create a file named `.clasp.json` in the root directory of this repository, then register your app's ID as follows:
```
{"scriptId":""}
```After setting `scriptId`, you can use `clasp` to deploy the app.
```
clasp push # upload the code
clasp deploy # publish as a webapp
```When the app is deployed, a public URL is given to the deployed app.
In the GAS app page, click `Publish` > `Deploy as web app` and you'll see the URL. The URL will be used to connect to Slack later.
## Connect Slack app to the GAS app
### Create a Slack appOpen the Slack API page (https://api.slack.com/) and click `Your Apps` then `Create New App`.
### Authorize the GAS app to use Slack APIs
In your Slack app page,
- open `OAuth & Permissions` tab and copy the OAuth Access Token
In your GAS app page,
- click `File` > `Project Properties` > `Script Properties` and add a property as follows:
```
Key: SLACK_ACCESS_TOKEN
Value:
```### Enable interaction with the GAS app
In your Slack app page,
- open `Interactivity & Shortcuts` tab and turn on the feature, then copy-and-paste the GAS app's public URL to the `Request URL` field
- open `Basic Information` tab and copy the `Verification Token` in `App Credentials` section
In your GAS app page,
- click `File` > `Project Properties` > `Script Properties` and add a property as follows:
```
Key: SLACK_VERIFICATION_TOKEN
Value:
```### Add a slash command or a shortcut to the Slack app
In your Slack app page, either (or both):
- open `Slash Commands` tab and turn on the feature, then create a new command and copy-and-paste the GAS app's public URL to the `Request URL` field
- open `Interactivity & Shortcuts` tab and create two new shortcuts with callback id `add` and `add_task` respectively
### Add an incoming webhook to the Slack app
In your Slack app page,
- open `Incoming Webhooks` tab and turn on the feature, then click `Add New Webhook to Workspace`
In your GAS app page,
- click `File` > `Project Properties` > `Script Properties` and add a property as follows:
```
Key: SLACK_WEBHOOKURL
Value:
```## Authorize the GAS app to use Google APIs
Open `main.gs` in the GAS app page and run `doHelp` function manually from the menu `Execute` > `Execute a function` > `doHelp`.
You'll be asked to permit the app to use Google Calendar API, Tasks API and outgoing hooks.
After authorization, a help text will be posted to your Slack channel.
## Completed !
Now you can create Google Calendar events via the Slack slash command as follows:
```
/task Meet the brewers 12/30
``````
/task Vacation 8/1-31
```# Development
When you modify the app and want to update the deployment, you can use `-i` option to redeploy without changing the public URL. If `-i` is omitted, you'll have multiple deployments with different versions, in different URLs.
```
clasp push
clasp deploy -i
```You can see the list of deployments with `clasp deployments`:
```
$ clasp deployments
2 Deployments.
- @HEAD
- @4
```The first deployment tagged `@HEAD` is a read-only deployment for dev use, which always runs the latest version of the app. So you'll usually want to redeploy the second deployment.
After creating unneeded deployments, you can also delete the deployment with `clasp undeploy ` command.