Top Banner
Create your own Chatbot with Hubot and CoffeeScript Rob Scaduto President and CTO, Third Wave Technology @scardetto
35

Create Your Own Chatbot with Hubot and CoffeeScript

Aug 12, 2015

Download

Technology

Rob Scaduto
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Create Your Own Chatbot with Hubot and CoffeeScript

Create your own Chatbot with Hubot and CoffeeScriptRob Scaduto

President and CTO, Third Wave Technology @scardetto

Page 2: Create Your Own Chatbot with Hubot and CoffeeScript

This talk was sponsored by:

Page 3: Create Your Own Chatbot with Hubot and CoffeeScript

About Me

•President and CTO of Third Wave Technology

•Developing software professionally since 1998

•Maintainer of a handful of open source projects (Crux, physique, build_number, Microservice.Template)

•Musician and aikido practitioner

Page 4: Create Your Own Chatbot with Hubot and CoffeeScript

About My Company

•Boutique consulting firm specializing in Agile software development.

•Develop custom software solutions for a variety of languages and platforms.

•Strong focus on Agile practices like Unit Testing and Continuous Integration.

Page 5: Create Your Own Chatbot with Hubot and CoffeeScript

What is Hubot?

Page 6: Create Your Own Chatbot with Hubot and CoffeeScript

Hubot is a chat bot.•Automates your chat room.

•Fully customizable.

•Runs on Node.

•Written in CoffeeScript.

•Uses Regular Expressions to match text to commands.

•Easily deployable to Heroku. (or Linux or even Windows)

Page 7: Create Your Own Chatbot with Hubot and CoffeeScript

Lots of Integrations• Flowdock

• Twilio

• Twitter

• XMPP

• Gtalk

• Yammer

• iMessage

• Hall

• ChatWork

• QQ

• AIM

• Lingr

• Campfire

• Slack

• HipChat

• IRC

• Partychat

• Talker

• Gitter

• Visual Studio Online

• Talktype

• Fleep

• Let’s Chat

• VictorOps

Or Write Your Own!

Page 8: Create Your Own Chatbot with Hubot and CoffeeScript

But, my team isn’t using a team communication platform.

Page 9: Create Your Own Chatbot with Hubot and CoffeeScript

Well you should, silly.

Page 10: Create Your Own Chatbot with Hubot and CoffeeScript

We use

• Awesome user experience.

• Support for multiple teams.

• Integrates with popular services like GitHub, BitBucket, Dropbox.

• Very quickly becomes the central communication hub for your team.

Page 11: Create Your Own Chatbot with Hubot and CoffeeScript
Page 12: Create Your Own Chatbot with Hubot and CoffeeScript

What can you do with Hubot?

Page 13: Create Your Own Chatbot with Hubot and CoffeeScript
Page 14: Create Your Own Chatbot with Hubot and CoffeeScript

Two Categories

Page 15: Create Your Own Chatbot with Hubot and CoffeeScript
Page 16: Create Your Own Chatbot with Hubot and CoffeeScript
Page 17: Create Your Own Chatbot with Hubot and CoffeeScript
Page 18: Create Your Own Chatbot with Hubot and CoffeeScript
Page 19: Create Your Own Chatbot with Hubot and CoffeeScript
Page 20: Create Your Own Chatbot with Hubot and CoffeeScript

Productivity Examples•Check the uptime and status of your apps.

•Kick off Acceptance Test Suite.

•Integrate with your issue tracker.

•Kick off builds and deployments.

•Be notified when PR’s are submitted and approved.

•Provision Servers with Puppet or Chef.

•If it has an API or even just a hackable URL you can automate it.

Page 21: Create Your Own Chatbot with Hubot and CoffeeScript

Automation is AwesomeBecause you are not a robot, but Hubot is.

Page 22: Create Your Own Chatbot with Hubot and CoffeeScript
Page 23: Create Your Own Chatbot with Hubot and CoffeeScript

How do we build our own Hubot?

Page 24: Create Your Own Chatbot with Hubot and CoffeeScript

Built with CoffeeScript•CoffeeScript compiles to JavaScript.

•Was an attempt to expose the good parts of JavaScript and eliminate a lot of cruft and confusion.

•The syntax will be friendly if you are a Ruby or Python developer.

•ES6 has fixed a lot of the issues that made CoffeeScript a viable alternative.

•However, for Hubot, everything is written in CoffeeScript.

Page 25: Create Your Own Chatbot with Hubot and CoffeeScript

CoffeeScript Crash Course

Page 26: Create Your Own Chatbot with Hubot and CoffeeScript

Variables and Scoping

Page 27: Create Your Own Chatbot with Hubot and CoffeeScript

Functions

Page 28: Create Your Own Chatbot with Hubot and CoffeeScript

Conditionals

Page 29: Create Your Own Chatbot with Hubot and CoffeeScript

Objects and Arrays

Page 30: Create Your Own Chatbot with Hubot and CoffeeScript

Classes

Page 31: Create Your Own Chatbot with Hubot and CoffeeScript

We’ve barely scratched the surface

coffeescript.org

Page 32: Create Your Own Chatbot with Hubot and CoffeeScript

Anatomy of a Hubot Script

<- Documentation is important

<- Hubot will listen for any message

<- Hubot will respond when called by name

Page 33: Create Your Own Chatbot with Hubot and CoffeeScript

Store Data in the Brain

<- Reading from the brain

<- Writing to the brain

Page 34: Create Your Own Chatbot with Hubot and CoffeeScript

Let’s Create a Hubot

Page 35: Create Your Own Chatbot with Hubot and CoffeeScript

Thanks for Listening!Tweet me if you have questions:

@scardetto

Source code available at: github.com/scardetto/hubot-talk