/gcal-slack

Integration of Google calendar and slack - To update slack status and inform team of being afk & leave. (In progress)

Primary LanguageNunjucks

Nest Logo

A progressive Node.js framework for building efficient and scalable server-side applications.

NPM Version Package License NPM Downloads CircleCI Coverage Discord Backers on Open Collective Sponsors on Open Collective Support us

Description

Nest framework TypeScript starter repository.

Installation

$ pnpm install

Running the app

# development
$ pnpm run start

# watch mode
$ pnpm run start:dev

# production mode
$ pnpm run start:prod

Test

# unit tests
$ pnpm run test

# e2e tests
$ pnpm run test:e2e

# test coverage
$ pnpm run test:cov

Support

Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.

Stay in touch

License

Nest is MIT licensed.

Setup & Usage

Fetching new Google credentials

  • Go to Google developer console
  • Create a new project with any name
  • Under Manage APIs, enable Google calendar API
  • Under the same project, create new OAuth client ID credentials
  • Generate a credentials.json file and place it in the root folder of this repo.

Running locally on HTTPS

Since this app rely on Google calendars event watch subscription, it need the server to run on HTTPs.

To run on HTTPS locally (recommended):

Generate SSL certificate on localhost

brew install mkcert
brew install nss # if you use Firefox
mkcert -install
mkcert localhost

Add local.integrate.app as alias to 127.0.0.1 in /etc/hosts on mac/linux. Similar setup steps can be found online for Windows OS. Go to local.integrate.app:3000 to see the view.

OR

Use ngrok (recommended only for testing calendar watch event)

Install ngrok

npm i -g ngrok

Once installing ngrok, try the following to give a random url on HTTPS:

ngrok http https://local.integrate.app:3000 --host-header=rewrite

Copy the generated random HTTPS string URL into .env -> HOST property. And then run the server using node .. Go to ngrok generated url to view the UI.

Create new Slack app

  • Create a new Slack app from this page: https://api.slack.com/apps
  • Copy the src/slack/app-manifest.yaml content to App Manifest tab under newly created app.
  • Go to OAuth scopes in the same page and fill the env variables as the format mentioned in .env.example file.

Running the app

Once above setup steps are done, run app using:

node .

Go to local.integrate.app:3000 to see the view.

You can also run the app on VScode debugger. Select webserver script while debugging.

Issues

Refresh token not found

Further reading: link