Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Let's build a simple Slack bot

Let's build a simple Slack bot

You love Slack. Your team loves Slack. You've integrated other services like Github or Trello into Slack, but there is one little thing you wish Slack could do and there is no integration for it. It's time to build a Slack bot.

Avatar for Rob Knight

Rob Knight

July 11, 2016
Tweet

More Decks by Rob Knight

Other Decks in Technology

Transcript

  1. Why Slack? • Friendliness makes it easy for
 newbies and

    technophobes • Keeps remote team members connected • Channels let new team members
 see the history of a conversation
  2. • Github pushes, Travis builds, code deployments • Twitter, Facebook,

    and Instagram mentions • Wufoo form submissions • Trello Notifications and service integrations
  3. Kinds of integrations • Webhook: post message a channel via

    HTTP POST • Slash command: user-invoked keyword starting with / • Bot user: Appears as a user. Parses and responds to natural language in messages.
  4. Kinds of integrations • Webhook: post message a channel •

    Slash command: user-invoked keyword starting with / • Bot user: Appears as a user. Parses and responds to natural language in messages.
  5. Step 2: your server 1. Verify token 2. Check for

    TEXT value 3. Query Google API
 for available rooms 4. Construct and return plain
 text response
  6. Step 2: your server • An HTTPS endpoint URL •

    Ruby/Sinatra running on Heroku (Hobby Dyno: $7/month) • Takes MINUTES as a variable. Default is 30 minutes • Uses “FreeBusy” Google Calendar API method • Returns an array of calendars that are open
 for the duration requested • Plain text response is sent back to Slack
  7. Response types Basic • Simple messages • Returned within 3

    seconds of request • That don’t need layout or color
  8. Response types Formatted • Rich or actionable messages • Longer

    than 3 seconds to process • Use fancy layout or color
  9. Thank you • Slack brand elements: https://brandfolder.com/slack • Organized desktop:

    https://unsplash.com/photos/9dI3g8owHiI • Man on surfboard with dog: https://unsplash.com/photos/98Rcate6GCU • Hipster phone guy: https://unsplash.com/photos/Q12JPPvF7eQ • Crafting tools: https://unsplash.com/photos/9OKGEVJiTKk • Conference room: https://unsplash.com/photos/GWe0dlVD9e0 • GIFs: http://giphy.com Images • [email protected] • github.com/knice/slack-roomicorn • api.slack.com/slash-commands Links