Presentation is loading. Please wait.

Presentation is loading. Please wait.

#watitis2015 CHAT-OPS WITH SLACK Kevin Paxman.

Similar presentations


Presentation on theme: "#watitis2015 CHAT-OPS WITH SLACK Kevin Paxman."— Presentation transcript:

1 #watitis2015 watitis.uwaterloo.ca @watitisconf CHAT-OPS WITH SLACK Kevin Paxman

2 #watitis2015 WHAT IS CHAT-OPS? Conversation-driven development Bots in your chat Everyone can see what’s going on There’s a shared history of what happened when Book downloadable from https://victorops.com/chatops-for-dummies/

3 #watitis2015 WHAT IS CHAT-OPS? Control external systems from chat Have external systems automatically send notices to chat In some cases, similar to doing tasks using a command line

4 #watitis2015 WHAT IS SLACK? Just another chat program – like IRC, Lync, Skype, ICQ, Facebook Messenger, Apple Messages, Google Talk, AOL Instant Messenger, Mattermost, etc., etc. But it’s free*, fun**, and makes it easy to set up integrations*** * Paid options are available, with educational pricing ** Certainly more fun than plain text-based chat; probably not as much fun as a roller coaster *** Limited to 10 on free plans

5 #watitis2015 WHAT CAN YOU INTEGRATE?

6 #watitis2015 WHAT CAN YOU INTEGRATE?

7 #watitis2015 And here’s the thing…

8 #watitis2015 YOU CAN BUILD YOUR OWN If the integration you want isn’t on the list, you can build your own! GitLab (git.uwaterloo.ca) integrates this way

9 #watitis2015 GETTING STARTED WITH SLACK Sign up at slack.com Send out invitations Turn on the Giphy integration You will probably want to set it to PG It’s surprising how much having animated GIFs at your beck and call encourages people to use the system…

10 #watitis2015 SETTING UP GIT.UWATERLOO.CA In Slack, set up an “incoming webhook” integration Copy the webhook URL to your clipboard In git.uwaterloo.ca, in your project settings, under services -> Slack, paste the webhook URL. Set the service to “active”.

11 #watitis2015 SETTING UP JENKINS In Slack, set up a Jenkins CI integration Copy the token to your clipboard In Jenkins, add and configure the Slack plugin In your jobs, enable Slack notifications and set them as a post-build action

12 #watitis2015 SETTING UP A NAMED BOT Is sent messages that start with the bot’s name Should respond to everything Can perform different functions based on the message sent

13 #watitis2015 SETTING UP A NAMED BOT In Slack, set up an “outgoing webhook” integration Let the bot listen to all channels, or select a channel for the bot to listen on Set up a trigger word (the bot’s name)

14 #watitis2015 SETTING UP A “KEYWORD BOT” Is sent every message posted to a specific channel Should respond when text matches a keyword Must be written to ignore other bot posts or you can end up in endless loops

15 #watitis2015 SETTING UP A “KEYWORD BOT” In Slack, set up an “outgoing webhook” integration Select a channel for the bot to listen on

16 #watitis2015 “HELLO WORLD” INTEGRATION A step-by-step look at putting together a “named bot” that can tell you how to say “hello world” Written in procedural PHP – but could have been written in anything that can respond to a request from a web server

17 #watitis2015 “HELLO WORLD” INTEGRATION Starter PHP file has a list of ways to say “hello world” and a comment with information copied from Slack Initially, we won’t use tokens – which lets this integration talk to anything – but we’ll add this in later To start with, we’ll set up a default response, and look at the information we’re given from Slack

18 #watitis2015 “HELLO WORLD” INTEGRATION

19 #watitis2015 “HELLO WORLD” INTEGRATION

20 #watitis2015 “HELLO WORLD” INTEGRATION We’ll let the bot answer with its default response if it was summoned without any request We’ll look at the request any see if it matches something the bot will be able to do, and let the user know if it’s not We’ll send a custom response either way

21 #watitis2015 “HELLO WORLD” INTEGRATION

22 #watitis2015 “HELLO WORLD” INTEGRATION Now we’ll format the response in the JSON format Slack requires We’re only sending text, but could also send attachments with additional code https://api.slack.com/docs/attachments We’re making sure not to respond to other bots, so there’s no potential for endless loops Essential when using regular expressions

23 #watitis2015 “HELLO WORLD” INTEGRATION

24 #watitis2015 “HELLO WORLD” INTEGRATION Now we’ll add the integration to Slack and test

25 #watitis2015 “HELLO WORLD” INTEGRATION Finally, we’ll wrap everything in token verification, so nothing happens if the page is accessed from an unexpected source...original code…

26 #watitis2015 “HELLO WORLD” INTEGRATION Starter file and final source available at: https://git.uwaterloo.ca/kpaxman/hello-world- bot https://git.uwaterloo.ca/kpaxman/hello-world- bot Can use as a starting point to build tools that perform other functions, talk to APIs, etc.

27 #watitis2015 IN SUMMARY This only scratches the surface of what can be done With appropriate safeguards, can be made to control other systems – for example, close RT tickets, deploy a build, post to a database…whatever you can think of! Doing things “in the open” leads to better engagement and collaboration

28 #watitis2015 Any questions?


Download ppt "#watitis2015 CHAT-OPS WITH SLACK Kevin Paxman."

Similar presentations


Ads by Google