Git Product home page Git Product logo

pizza-bot's Introduction

pizza-bot

Learn how to order ๐Ÿ• from Slack

Welcome Pizza Botter

Howdy ๐Ÿ‘‹ We're going to build a bot today. An awesome bot that will order you hot, delicious pizza. From Domino's. So, hot pizza. Well, maybe not hot, but definitely at least warm pizza. From Domino's. OK, let's not get hung up on the definitions of "pizza" or "food". The bot will be awesome, I promise.

Whether or not you actually want to eat Domino's "pizza", this project will show us how to take a fun idea (a Slack bot that delivers pizza), break it down into small and manageable steps, and work with real-life (sometimes messy) external libraries to make your idea become a real thing.

Before we begin, let's do a little set up.

Things You Need Before We Start

Node

You will need to have Node installed on your machine. The libraries we use require Node 4+ (the examples in this repo use the current release, Node 6). If you have an older version, check out nvm to upgrade.

Check if you have Node installed by typing node --version in your terminal. If you get an error, download it here: https://nodejs.org/en/download/

Git

You will need to have Git installed as well. One quick way to do this is to install GitHub Desktop.

Check if you have Git installed by typing git --version in your terminal. If you get an error, download it here: https://desktop.github.com/

GitHub Account

https://github.com/join

Sign up for a GitHub account. If you want to clone the code locally and push changes, you'll need to generate an SSH key and upload it to GitHub.

Break Into Teams

Get into teams of 2-3.

Once you are in teams, pick your team name and create a public Slack channel. Invite the workshop instructor, assistants and everyone on your team using the /invite command.

Once you have your team channel set up, DM your team name to the instructor, and they will give you a Slack API token.

Set Up The Project

We will be pair programming during this workshop. One person on the team should fork the repo (see below). Everyone else on the team can clone that copy to their machines and follow the setup steps below.

Fork this repo

You won't be able to make changes to this example repo, so you will need to fork it (make a copy of it). Have one person click the "Fork" button in the upper right hand corner of this repo. This will give you your own copy of this example repo to work with in your Github account.

You will be using one repo for your team so add everyone on your team as a "collaborator". You can do that at https://github.com/<GHUsername>/pizza-bot/settings/collaboration.

Clone Your Forked Version

Make a local copy of your version using the git clone command. Use the "Clone or Download" button to get the URL to your copy of the project.

Type cd pizza-bot to change your working directory into your copy of the repo.

Create a .env File

Create a file named .env in the root of your project. Add this line to the file:

export SLACK_TOKEN=replace_me

If you are comfortable creating your own Slack API token, you can follow these instructions. Otherwise, ask a mentor to create one for you. Once you have a Slack API token, replace replace_me with the token.

Once you have your token, open a terminal and type:

source .env

This will expose the variables in your .env file to the current terminal session. You will need to type source .env for each new terminal window you open. If you see this error Missing configuration. Config must include either slackToken AND/OR clientId, clientSecret, and port you forgot to type source .env ๐Ÿ˜„

Install Depedencies

Use npm install in the root of your project to install all the project dependencies.

Start Your Bot

This project uses npm scripts to perform tasks. You can find them in the package.json file.

Type npm start in a terminal window to start your bot. Find your bot in Slack and it should have a green active icon next to it. If you don't see that, check your terminal for logs (did you remember to source .env?).

In Slack type hello bot and see if it responds. You can also type @<botname> help to see what help commands it has.

Heads up: your bot will restart on every code change. This is a great feature for development, not so useful in production ๐Ÿ˜„

First Exercise

Once you have your bot running, it's time to dig in! Take a look at the README in this branch for the first exercise: https://github.com/SparkPost/pizza-bot/tree/01-plugin

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.