ChatOps

Arpit Mohan

CTO, Bicycle.ai

21/10/2016

What is ChatOps?

First there was Devops, now there's ChatOps.

C'mon! Stop the madness!

Wait, but why?

  • Single Interface that's familiar & easy to use
  • No custom logins
  • Multiple Integrations
  • Allows for a shared terminal concept (Think: tmux & screen)
  • Context sharing is simpler
  • More fun? 

Example Screenshots

Example Screenshots

Example Screenshots

Demo Time!

Tools used

  • Hubot
  • Slack
  • Coffee Script
  • Creativity :D

Show me the code


  robot.hear /hello|hi$/i, (res) ->
    response = ""
    helloResponses = robot.brain.get('helloResponses') * 1 or 0

    if helloResponses > 1
      res.reply "Stop it already!"
      #Resetting the count here. Ideally, this key should be reset every hour or so.
      robot.brain.set 'helloResponses', 0
    else
      res.reply "Howdy there! How can I help?"

    robot.brain.set 'helloResponses', helloResponses+1

Sample Code for the hello command

Show me the code

  robot.hear /gitlab build (.*)$/i, (res) ->
    res.send "Building ..."
    project_name = res.match[1]
    gitlab_ci_token = process.env.GITLAB_CI_TOKEN
    res.send "Will build #{project_name} using key #{gitlab_ci_token}"

    res.http("https://code.usefilter.com/api/v3/projects?private_token=#{gitlab_ci_token}")
    .header('Accept', 'application/json')
    .get() (err, http_res, body) ->
      if err
        res.send 'Sorry. Unable to fetch the list of projects from Gitlab'
        return

      for project in JSON.parse body
        if project.name.toLowerCase()  is project_name.toLowerCase()
            project_found = true
            project_id = project.id
            res.send "Found project with ID: #{project.id}"


    

Sample code for the build command

Other Alternatives

Other cool stuff

Questions?

Thank You

Github: github.com/mohanarpit

Website: arpitmohan.com

Email: [email protected]