Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.
/ tx-rooms Public archive

Slack Application to help you find all the rooms in the TX Group Building (Zûrich)

Notifications You must be signed in to change notification settings

tx-group-adm/tx-rooms

Repository files navigation

TX Rooms logo shows people standing around giant 3D letters T and X

TX Rooms

👀 Have you ever been lost in the TX Groups building in Zürich?

🙉 Have you ever been invited to a meeting in a room you have never heard of?

🏃‍♂️ Have you ever learned 2 minutes before a meeting that the room is 6 minutes away?

TX Rooms Slack Bot is here to help you find your way ™️ 🌈 ✨


Getting Started

  1. Install the Serverless framework
$ npm install -g serverless
  1. Save two files named config/config.dev.json and config/config.prod.json with the following structure:
{
    "SLACK_SIGNING_SECRET": "Your Apps's Signing Secret",
    "SLACK_VERIFICATION_TOKEN": "Your App's Verification Token",
    "SLACK_BOT_USER_OAUTH_ACCESS_TOKEN": "Your Slack App's User OAuth Access Token"
}

These files will help you keep your enviornments variables safely out of version control, but in a place that conveniently loads them to the lambda runtime when you are testing or invoking locally.

💡 You only need the config/config.prod.json file if you ever want to try and envoke your lambda functions locally with production settings, for example, running commands with the --stage prod flag. Otherwise you can keep your production secrets secure in AWS Lamda console using the Enviornment Variables feature for your Lambda functions.

Local Development

We can use ngrok to get Slack to connect to our local instance of Lambda (which uses serverless offline behind the scenes).

To get started:

  1. In a terminal window run npm run start to get lambda running locally
  2. In a new terminal window run npm run ngrok
  3. Copy the ngrok url into your Slack App's Event Subscription, Slash Commands and Interactivity & Shortcuts

🌈 Now your app will use your local lambda functions to respond to your Slack interactions

Serverless Configuration

This app uses the Serverless framework and Lambda functions. You can inspect the serverless.yaml file to see which functions are mapped to lambda functions. Spoiler Alert: All of the lambda functions are mapped to the files in the api directory.

Updating the Room Directory

If you need to make any changes to the room entries, simply do the following:

  1. Edit the file modules/rooms.js with your room updates

  2. Run npm run build

💡 Running the command npm run build will auto-generate some static files that are used in various parts of the app. The idea is that we can save in computation time (which costs money) if we use static files where we can get away with it.

Deploying

To deploy to your staging enviornment

$ serverless deploy --stage dev

To deploy to your production enviornment

$ serverless deploy --stage prod

Made with ❤️ by Michael Wuergler so he can stop getting lost at work.

About

Slack Application to help you find all the rooms in the TX Group Building (Zûrich)

Resources

Stars

Watchers

Forks

Packages

No packages published