Home

Awesome

Toki: deep work for collaborative teams

Toki is a Slack bot that helps individuals focus at work, track their productivity and stay in sync with their team. Its goal is to empower deep work for teams, through the benefits of Slack (collaboration, transparency and fun).

Toki enables you to /focus on [task] for [time]. This command turns on your Do Not Disturb (DND) mode in Slack and shares what you're working on to your team. You can see what teammates are focused on by checking /pulse @user. Toki will also store these focused sessions to provide daily reflections of how you spend your time. Think of /focus as an upgrade to /dnd that makes deep work more collaborative, transparent and informative.

Toki is written in Javascript and uses the excellent Botkit and Wit libraries. The Botkit + Express integration is inspired from this tutorial. If you are looking for a foundation to build your own Slack bot app with Botkit and Express, check out that tutorial.

<a name="main-features"/> # Main Features ### Focus sessions <img src="/build/public/gifs/focus.gif" width="80%" alt="Focus sessions"> * `/focus [task] for [time]` * Turns on your DND in Slack while in "focus" mode * Shares what you are working on to your team * Toki stores this information for daily reflection * You can end your session at any point, which turns off your DND (via interactive button, or `/end`)

View your team's pulse

<img src="/build/public/gifs/dashboard.gif" width="80%" alt="Team Pulse"> * Toki will dynamically update its channels whenever one of the channel members enters a focus session * This allows you to create information channels (i.e. `#pulse-backend`) to get a snapshot of what teams are focused on * See what an individual is up to with `/pulse @user`

Send appropriate notifications

<img src="/build/public/gifs/collaborate.gif" width="80%" alt="Collaborate Now"> * You are able to send notifications through each teammate's `Collaborate Now` button, through which Toki temporarily turns off the user's DND and sends a ping to start a conversation * This helps segment notifications to be ones that preserve an individual's context or is actually urgent * You are also able to `Collaborate Now` when you see a specific individual's `/pulse @user`

Daily Reflection

<img src="/build/public/images/reflection_example.png" width="80%" alt="Daily Reflection"> * Toki provides a daily cadence of how you spent your focused time * This helps you build a habit of being intentional with your time, and get pictures of what you got done each day

Note: Toki has a web app interface in its roadmap. We plan this to be a React + Redux frontend hosted on a separate server that speaks to the API end points on this server in /app/api.

<a name="directory-structure"> # Directory Structure ``` build/ ├── app/ // Web server │ ├── api/ // RESTful API endpoints │ ├── migrations/ // Sequelize DB migrations │ ├── models/ // Sequelize Models │ ├── router/ // Express routes │ ├── cron.js/ // Cron job functions ├── bot/ // Slackbot │ ├── actions/ // Bot initiates conversation │ ├── controllers/ // Botkit controllers to handle Slack events and conversations │ ├── lib/ // Slackbot helpers │ ├── middleware/ // Botkit middleware functions ├── public/ // Static assets ├── server.js/ // App starting point ```

Notes:

<a name="getting-started"> # Getting Started First, fork the repository and install node dependencies by navigating to the root of your local repository and running `npm install`.

By default, Toki comes with configuration for a development bot and a production bot so that you can continue developing your bot and test new functionalities while it is live and on others' teams. This means you will have to create two separate Slack apps and do basic configuration for each. Here are the steps:

  1. Create your two slack apps (one for development and one for production)
  2. Set up your environment variables. You can modify and rename the provided .env-example file:
SLACK_ID=your.productionSlackId
SLACK_SECRET=yourProductionSlackSecret
SLACK_REDIRECT=https://yourproduction.site

DEV_SLACK_ID=your.developmentSlackId
DEV_SLACK_SECRET=yourDevelopmentSlackSecret
DEV_SLACK_REDIRECT=http://localhost:8080/

VERIFICATION_TOKEN=yourVerificationToken

WIT_TOKEN=yourWitToken
HTTP_PORT=8080

Make sure to put NODE_ENV=production as an environment variable on your production server. This allows Toki to know whether to start up the production bot or the development bot 3. Get your apps' verification tokens for Slash commands 4. Create a Wit.api app and set your wit token

  1. Decide deployment strategy
  1. We use Postgres for storage with the Sequelize ORM
<a name="modules"/> # Modules

Toki is built on top of the Botkit framework and uses the following modules:

<a name="development"/> ## Development As mentioned above, Toki comes with a production bot and a development bot by default. You can name your development bot whatever you want. For reference, our production bot is named `toki` and our development bot is named `dev_toki`.

Actual development is done inside the /src directory, and its changes are compiled into the /build directory via babel and node-sass for deployment. This allows us to use ES6 and SCSS while developing.

Toki comes with the scripts npm run watch-css and npm run watch-babel to run in the background and compile a file from /src into its mirror location in /build each time you save a change.

<a name="running-production"/> ## Running on Production For production, Toki uses Digital Ocean and [pm2](https://github.com/Unitech/pm2), a production process manager for Node.js applications.

Notes:

<a name="product-roadmap"/> ## Product Roadmap Our ideas for the product roadmap are held in our [public Trello board](https://trello.com/b/AYIEVUsN/product-development-roadmap). We'd love to hear suggestions, and work together towards a better future! You can add comments directly in Trello. <a name="authors"/> ## Authors [Kevin Suh](https://github.com/kevinsuh) ([@kevinsuh34](https://twitter.com/kevinsuh34)) is the primary developer for Toki. Additional development from [Chip Koziara](https://github.com/chipkoziara) ([@chipkoziara](https://twitter.com/chipkoziara)). For inquiries, reach out at [kevinsuh34@gmail.com](https://mail.google.com/a/?view=cm&fs=1&to=kevinsuh34@gmail.com). For issues related specifically to Toki's codebase, please post on our [issues](https://github.com/kevinsuh/toki/issues) page.