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

Create Your Own Chatbot with Hubot and CoffeeScript

Embed Size (px)

Citation preview

Create your own Chatbot with Hubot and CoffeeScriptRob Scaduto

President and CTO, Third Wave Technology @scardetto

This talk was sponsored by:

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

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.

What is Hubot?

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)

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!

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

Well you should, silly.

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.

What can you do with Hubot?

Two Categories

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.

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

How do we build our own Hubot?

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.

CoffeeScript Crash Course

Variables and Scoping

Functions

Conditionals

Objects and Arrays

Classes

We’ve barely scratched the surface

coffeescript.org

Anatomy of a Hubot Script

<- Documentation is important

<- Hubot will listen for any message

<- Hubot will respond when called by name

Store Data in the Brain

<- Reading from the brain

<- Writing to the brain

Let’s Create a Hubot

Thanks for Listening!Tweet me if you have questions:

@scardetto

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