Giter Site home page Giter Site logo

jbdatascience / ai_for_scheduling Goto Github PK

View Code? Open in Web Editor NEW

This project forked from llsourcell/ai_for_scheduling

0.0 0.0 0.0 0 B

This is the code for "AI for Scheduling" by Siraj Raval on Youtube

Jupyter Notebook 9.74% JavaScript 89.96% Shell 0.30%

ai_for_scheduling's Introduction

Sam the Slack Scheduler Bot

Overview

This is the code for this video on Youtube by Siraj Raval on AI for scheduling.

Purpose

Productivity is hard to come by in fast-paced work environments. Dozens of browsers tabs, desktop apps, and mobile notifications drown your ability to focus and concentrate. As companies like Google, Facebook, Amazon and IBM continue to build powerful AI-based platforms and tools, the barrier to applying machine learning to real user problems is becoming dramatically reduced.

The Slack Scheduler Bot solves a real customer problem by streamlining workflow for a very large, immediately addressable market (teams who schedules meetings and also use Slack) at the exact right time (advent of new powerful, easy-to-use AI technologies + proliferation of software tools used on job)

Overview

TL;DR: The Slack Scheduler bot is a langauge aware intelligent slack bot for scheduling reminders and meetings with other slack users in google calendar.

This Slack Scheduler bot is built using many asynchronous API's, making it very difficult to maintain state across multiple users. The three core APIs used are Slack RTM, API.AI, and Google Calendar API. When the slack bot is sent a message, it is immedaitely sent to API.AI where multiple intents are already set up to parse the input and decide how to respond based off of the users input. For example, if you were to input "Schedule a meeting with a person at time on date or today/tomorrow/etc to discuss a meeting topic for one hour". If any of the italic fields are missing, the response will ask for the user for the specific field. Duration is not required, but will default to 30 minutes if not included.

User: "Schedule a meeting with @pneelde tomorrow"  
Bot: "What Time?"  
User: "3pm"  
Bot: "What will be the topic of the meeting?"  
User: "Milestone #3"  
Bot: "Confirm meeting"  
Bot: "Meeting Confirmed"  

The scheduler bot will then check to see if it has permissions to add events to both users calendar. If it doesnt, it will inform the user to have the user message the bot and the bot will send the user a link to give the bot permission to edit thier calendar.

If all permissions are set, it will then check both users calendars to see if there any prexisting conflicts with any of the users calendars.
If there are, the bot will then respond, letting the user know there are time conflicts, and then will prompt the user to pick a new time from a list of first 10 available meeting slots that work for every user invited to the meeting. This is limited to 3 free times per day, and will check up to 7 business days ahead of time for these free times. It will check for free times for the duration of the meeting, if provided. If not provided, it will default to 30 minute free slots.
The user will select the best time and the bot will then schedule the meeting, adding the event to all users calendars and sending each user and email.

The scheduler bot can also create reminders for users. Using the same process as scheduling, the bot will set a reminder in the users calendar. These reminders are also added to an internal list of reminders that the scheduler will remind the user of the task at midnight, and the user will see the reminder in their slack Direct Messages when they next open slack. This is done through the script.js file, Heroku's script scheduler, acting as a cron job to fire every night at midnight.

User: "Remind me to turn in progress report"  
Bot: "When should I remind you?"  
User: "Tomorrow"  
Bot: "Confirm reminder"  
Bot: "Reminder Set"  

Usage

Authenicating throught Google:

Set Reminders:

Schedules Meetings with other Slack Users:

Checks Permissions for both users:

Schedules meeting on both users calendar:

Checks for time conflicts for both users:


Running the tests

Since the free version of Heroku has been used, the server will automatically sleep after 12 hours. To test this application, simply deploy this project to heroku, set the Heroku address with the /slack/interactive endpoint to the request URL for interactive messages in the Slack API application dashboard. For example, here is my interactive message endpoint:
https://dry-sierra-94244.herokuapp.com/slack/interactive

You will also need to set up a mongodb. Instructions on how to do this can be found here.

Finally, set all of your environmental variables in heroku. You will need the following names for your environment variables:
API_AI_TOKEN: Your API.AI token
CLIENT_ID: Your Slack credentials
CLIENT_SECRET: Your Slack credentials
DOMAIN: Heroku domain name
GOOGLE_CLIENT_ID: Google API Credentials
GOOGLE_CLIENT_SECRET: Google API Credentials
MONGODB_URI: Mongo DB credentials
SLACK_API_TOKEN: Bot User OAuth Access Token

Built With

  • API.AI - The ai/machine learning tool used to process natural language
  • Slack - Chat application used for RTM and interactive messages
  • Google Calendar API - Used by bot to schedule meetings and reminders
  • Express - Backend Server

Credits

Credits for this code go to floresfxf. I've merely created a wrapper to get people started.

ai_for_scheduling's People

Contributors

llsourcell avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.