├── LICENSE ├── README.md ├── docs ├── TUTORIAL.md ├── add-configuration.png ├── choose-command.png ├── field-autocomplete.png ├── field-label-save.png ├── field-label.png ├── field-method.png ├── field-token.png ├── field-url.png ├── hint-usage-label.png ├── message-down.png ├── message-invalid.png └── message-up.png └── isitup.php /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 David McCreath 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # isitup-for-slack 2 | 3 | Custom slash command to use isitup.org to check if a site is up from within Slack 4 | 5 | ## REQUIREMENTS 6 | 7 | * A custom slash command on a Slack team 8 | * A web server running PHP5 with cURL enabled 9 | * A valid SSL certificate for your web server (not self-signed) 10 | 11 | ## USAGE 12 | 13 | * Place the `isitup.php` script on a server running PHP5 with cURL and a valid SSL certificate. 14 | * Set up a new custom slash command on your Slack team: https://slack.com/apps/A0F82E8CA-slash-commands 15 | * Under "Choose a command", enter whatever you want for the command. /isitup is easy to remember. 16 | * Under "URL", enter the URL for the script on your server. 17 | * Leave "Method" set to "Post". 18 | * Decide whether you want this command to show in the autocomplete list for slash commands. 19 | * If you do, enter a short description and usage hint. 20 | * Update the `isitup.php` script with your slash command's token. 21 | 22 | ## DOWNLOAD 23 | 24 | You can download the completed script and a tutorial for writing your own at https://github.com/mccreath/isitup-for-slack/ 25 | -------------------------------------------------------------------------------- /docs/TUTORIAL.md: -------------------------------------------------------------------------------- 1 | # Your First Custom Slash Command for Slack 2 | 3 | This tutorial is the first part of a two-part series. This part will show you how to set up and process a simple slash command. The second part will work with more complex data and different message options. 4 | 5 | You can download the completed script here: https://github.com/mccreath/isitup-for-slack/ 6 | 7 | ## How Slack's Slash Commands Work 8 | 9 | A slash command performs a very simple task: it takes whatever text you enter after the command itself and sends it to a URL. Then it receives whatever that URL returns and posts it as a message in Slack. By default this message visible only to the person who issued the command, and that’s what this tutorial will do. We’ll get into posting the message for everyone in a channel to see in the next tutorial. 10 | 11 | **What makes slash commands so useful and powerful is what you do with that text at the URL.** 12 | 13 | For example, you have a script that translates English to French, so you create a slash command called `/translate`, and expect that the user will enter an English word that they'd like translated into French. When the user types `/translate dog` into the Slack message field, Slack bundles up the text string `dog` with those other server variables and sends the whole thing to your script, which performs its task of finding the correct French word, `chien`, and sends it back to Slack along with whatever message you added with your script has, and Slack posts it back to the user as `The French word for "dog" is "chien"`. No one else on the team will see message, since it's from Slackbot to the user. 14 | 15 | 1. Slack bundles up the text string dog with those other server variables and sends the whole thing to your script on your server. 16 | 2. The script performs its task of finding the correct French word, chien 17 | 3. The script sends it back to Slack along with whatever additional information or message you added with your script 18 | 4. Slack posts it back to the user as The French word for “dog” is “chien”. By default, no one else on the team will see message. 19 | 20 | This very simple demo will take you through the process of setting up a custom slash command (https://api.slack.com/slash-commands) using a third-party service. It's also the first part of a larger tutorial that will show you how to use a slash command to query a remote service and post the results to a channel, group, or DM. 21 | 22 | If you're familiar with PHP, JSON, and cURL, you can probably find all the info you need in the comments of the `isitup.php` script in this repo. If you’re curious about the nuts and bolts, read on! 23 | 24 | ## What we're going to do 25 | 26 | For this tutorial, we'll be using the web service [itisiup.org](http://isitup.org) to check whether a website is running. It's a good one to start with because the [API is super simple](https://isitup.org/api/api.html), and because you don't need an API key to use the service. All you need to do is identify your script to their servers. 27 | 28 | The way isitup.org works is that you call a URL that specifies the domain you want to check and the format that you want to receive the data in. You can get JSON, JSONP, or comma-separate text. JSON stands for JavaScript Object Notation, and it's a common format for exchanging data between web services. It also happens that PHP has some nice built-in tools for working with it, so we're going to use the JSON option. 29 | 30 | The URL is formatted as `https://isitup.org/[DOMAIN TO SEARCH].[DATA FORMAT]`. So if we wanted to check on Amazon and get the results in JSON, the URL would be `https://isitup.org/amazon.com.json`. If we wanted to check the Whitehouse website and get the results as comma-separated values, it would be `https://isitup.org/whitehouse.gov.txt`. Simple! 31 | 32 | ### What we're going to write 33 | 34 | Our script is going to 35 | 36 | * Take the values that the slash command sends and turn them into variables 37 | * Use cURL to send the domain name to isitup.org's API 38 | * Accept the results returned by isitup and decide what to do with them. 39 | * Format the results into a proper JSON payload for the incoming webhook 40 | * Return the results to the person who used the slash command 41 | 42 | ### Tools you'll need: 43 | 44 | * A plain text editor. If you want a free one, I recommend TextWrangler for Mac (http://barebones.com/products/textwrangler/) or Notepad++ for Windows (http://notepad-plus-plus.org/) 45 | * A hosting account running PHP 5 and cURL where you can put the script we're going to write. Pretty much any shared hosting account in the world should work for this. 46 | * A Slack account (a free one is fine) 47 | 48 | ### What we'll be using on the server 49 | 50 | Don't worry too much if you've never used one or more of these. Our use of them will be thoroughly explained in the tutorial. 51 | 52 | * PHP (http://php.net) 53 | 54 | A commonly available and widely-used server-side scripting language. 55 | 56 | * JSON (JavaScript Object Notation - http://json.org/) 57 | 58 | JSON is a simple way to represent and exchange data. It's an open standard format that uses human-readable text to transmit data objects consisting of key-value pairs. 59 | 60 | * cURL (http://curl.haxx.se) 61 | 62 | cURL (http://curl.haxx.se) is an open source tool that lets you transfer data with URL syntax, which is what web browsers use, and as a result, much of the web uses. Being able to transfer data with URL syntax is what makes slash commands (and webhooks, as we'll see later) work. 63 | 64 | One of the great things about cURL is that you can use it from the command line (which makes it easy to use for testing things), or you can interact with it from most modern scripting languages, including PHP. We're going to take advantage of that and use it in our script to receive data from Slack and then send it back in. We'll be using a few very basic commands that are common for this type of task. All of the cURL that we use in this script will be transferrable to any other webhook script that you want to write. 65 | 66 | ## Set up your slash command 67 | 68 | Go to [https://slack.com/apps/A0F82E8CA-slash-commands](https://slack.com/apps/A0F82E8CA-slash-commands) to add a new slash command (you’ll need to be signed in). Click the “Add Configuration” button to start the process. 69 | 70 | ![Add a new configuration](add-configuration.png) 71 | 72 | Next, choose the text command itself. This is the text that the user will type after the slash. In this case, `isitup` is clear and short, so let's stick with that. But you can use whatever makes the most sense for your command and your users. 73 | 74 | ![Create the command](choose-command.png) 75 | 76 | For now you can leave everything else empty. We'll come back and finish setting this up in a bit. Just scroll down to the bottom and click the "Save Integration" button, but don't close the page yet. 77 | 78 | ## The PHP script 79 | 80 | Now we're going to go step by step through the PHP script. If PHP isn't your jam, this should still be pretty simple to apply to the language of your choice. Create a new file in your text editor called `isitup.php`. Save it some place where you'll be able to get to it easily when it's time to upload it. 81 | 82 | ### Set up your user agent string 83 | 84 | The isitup API requests that the client is identified by a User-Agent string. This allows the isitup folks to look through their logs and see how often our script is being used on their site. Feel free to leave this set to this, or you can update it with any info you want. 85 | 86 | ```php 87 | $user_agent = "IsitupForSlack/1.0 (https://github.com/mccreath/istiupforslack; mccreath@gmail.com)"; 88 | ``` 89 | 90 | ### Set up some variables 91 | 92 | The first thing you need to do when the script is called by your slash command is grab some values the command sends over and make variables out of them. It's not strictly necessary to make new variables out of these, but it's a good habit to get into, because they're easier to reuse, and you can name them what you want. 93 | 94 | All of the values can be found in a PHP array called `$_POST`, and they're all named values. To get the value of a named item in a PHP array, you use the following format: `$array_name['item_name']`. That will return the value. In the case of our slash command, if we wanted to retrieve the text of the command itself, it would look like this: `$_POST['command']`. That will have the value of `isitup`. 95 | 96 | So following on, let's make a variable from the command string itself. In our case, `isitup` 97 | 98 | ```php 99 | $command = $_POST['command']; 100 | ``` 101 | 102 | Next, the text that was entered with the command. In this case, it will be the domain, which is what we'll send to isitup. 103 | 104 | ```php 105 | $domain = $_POST['text']; 106 | ``` 107 | 108 | The token is an additional identifier that's sent with the slash command that you could use to verify that what's calling your script is actually your slash command. You'll find the token on your slash command configuration page. 109 | 110 | ```php 111 | $token = $_POST['token']; 112 | ``` 113 | 114 | Here's an example of an `if` statement that will return a message to your user if the token doesn’t match, saying it needs to be updated. Copy the token from your configuration page to use in your `if` statement: 115 | 116 | ![Your slash command token](field-token.png) 117 | 118 | ```php 119 | # 120 | # replace this token with the token from your slash command configuration page 121 | # 122 | 123 | if($token != 'zNvYk1lDMEwvHHhZrWApVhfv'){ 124 | $msg = "The token for the slash command doesn't match. Check your script."; 125 | die($msg); 126 | echo $msg; 127 | } 128 | ``` 129 | 130 | We're going to take the text exactly as it's typed by the user, and rely on isitup to check the validity of the domain. If it's not a valid domain, isitup.org will respond with a `3`. We want to get the JSON version back. 131 | 132 | ```php 133 | $url_to_check = "https://isitup.org/".$domain.".json"; 134 | ``` 135 | 136 | Now that we've got all our information, we just need to send the URL to isitup.org. 137 | 138 | First, we initialize cURL and tell it what URL we want it to open. We pass in our variable `$url_to_check`. 139 | 140 | ```php 141 | $ch = curl_init($url_to_check); 142 | ``` 143 | 144 | Next we set some cURL options to handle some specific tasks associated with opening the URL. 145 | 146 | This first one sends in the user agent string that we created up above. 147 | 148 | ```php 149 | curl_setopt($ch, CURLOPT_USERAGENT, $user_agent); 150 | ``` 151 | 152 | The second option tells cURL we expect to get some kind of information back from the URL, and we want to get that information. 153 | 154 | ```php 155 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 156 | ``` 157 | 158 | With those in place, we can now call the URL. By assigning the call to a variable, we have a place to store the information returned from isitup.org. 159 | 160 | ```php 161 | $ch_response = curl_exec($ch); 162 | ``` 163 | 164 | And finally, close the cURL connection. 165 | 166 | ```php 167 | curl_close($ch); 168 | ``` 169 | 170 | We now have a variable called `$ch_response` that contains the response from isitup.org. The response will be in a JSON string, which looks something like this: 171 | 172 | ```json 173 | { 174 | "domain": "duckduckgo.com", 175 | "port": 80, 176 | "status_code": 1, 177 | "response_ip": "46.51.197.88", 178 | "response_code": 200, 179 | "response_time": 0.025 180 | } 181 | ``` 182 | 183 | That’s easy to read and easy to pass around the Internet, which is great. It’s why JSON exists. However, it’s easier and more efficient to work with an array than with a string so it’s a good thing that PHP has tools to convert JSON data to a PHP array. We’ll pass the string to the built-in PHP function `json_decode()`. By default this function will turn a JSON string into an object, but you can optionally turn it into an array by setting the second parameter to `TRUE`. Arrays are a little easier to work with than objects, so we’ll use that option. Notice that we’re putting the decoded array into its own variable. 184 | 185 | ```php 186 | $response_array = json_decode($ch_response, TRUE); 187 | ``` 188 | 189 | For comparison to the JSON string, a PHP array is represented like this: 190 | 191 | ```php 192 | array( 193 | "domain" => "duckduckgo.com", 194 | "port" => 80, 195 | "status_code" => 1, 196 | "response_ip" => "46.51.197.88", 197 | "response_code" => 200, 198 | "response_time" => 0.025 199 | ); 200 | ``` 201 | 202 | The difference a little abstract in presentation, and in practice, you won't see any of this happen. But using an array allows us to access the values that `isitup.org` sent to us using the same format that we used to set the variables from the `$_POST` array up at the top of the script, like this: 203 | 204 | ```php 205 | $response_array['domain'] 206 | $response_array['status_code'] 207 | ``` 208 | 209 | Now we can take the values from `$response_array` and put together the message that we're going to send back to the user. Since there are a few possible responses from isitup.org, we'll use an `if` statement to test which response we gotand make sure the message has the correct information. 210 | 211 | The first thing we check is whether the script can reach isitup.org. We do that by checking whether the `$ch_response` came back with anything. 212 | 213 | ```php 214 | if($ch_response === FALSE){ 215 | 216 | # isitup.org could not be reached 217 | $reply = "Ironically, isitup could not be reached."; 218 | 219 | } else { 220 | 221 | # Run all the other tests to see which status we received. 222 | 223 | } 224 | ``` 225 | 226 | Assuming that we did reach isitup.org, we need to see which of the three responses we got back. `1` means the site is up. `2` means the site is not up. `3` means the person who sent the command didn't write the domain properly, which usually means they left off the `.com` (or `.net`, `.org`, etc.). We're going to use a second `if` statement to test which number we got back and set the `$reply` variable to the correct message. 227 | 228 | ```php 229 | if ($response_array['status_code'] == 1){ 230 | 231 | $reply = "Good news! ".$response_array["domain"]." is up!"; 232 | 233 | }else if ($response_array['status_code'] == 2){ 234 | 235 | $reply = "Oh no! ".$response_array["domain"]." is down!"; 236 | 237 | }else if($response_array['status_code'] == 3){ 238 | 239 | $reply = "The domain you entered, ".$domain.", does not appear to be a valid domain. "; 240 | $reply .= "Please enter both the domain name AND suffix (ex: amazon.com or whitehouse.gov)."; 241 | 242 | } 243 | ``` 244 | 245 | ### Add some visual cues 246 | 247 | One thing that might not be obvious at this point is that all three versions of our message will look very similar to the user. By default, Slackbot responses are dark gray instead of black, and they're italicized. These two things help set them apart from other messages, but we can take a couple of more steps to make sure that each of our messages is easier to interpret. Slack lets you use emoji in your messages, so we'll add a different emoji to each status, then we'll bold the status of the site to make it stand out a little more, and we'll link the domain name. 248 | 249 | To bold any text in a Slackbot message, just put a single asterisk on either side, with no spaces between the asterisks and the text. In the following sentence, "a bold phrase" will be displayed in bold type. 250 | 251 | Here's some text with *a bold statement*. 252 | 253 | To turn any URL in a Slackbot message into a link, just put an angle bracket on either side of it. Luckily for this slash command, a simple domain name is enough for Slack's servers to create a link. In the following sentence, the domain will be displayed as a link to that site. 254 | 255 | One of the largest online retailers is . 256 | 257 | But we can go one step further. Because the user only types in the domain, it makes more sense to display only the domain in the reply. We can still link it, but it takes a little more work. The format for linking text in an incoming message on Slack is `domain` + `|` (that's the pipe character) + `text`. 258 | 259 | 260 | 261 | For our message, we're going to be linking the text of the domain itself, so the code will look a little redundant, but the output will be much nicer. We're going to do this: 262 | 263 | 264 | 265 | For status `1`, the site is up, let's use the universal affirmative of "thumbs up". Then linking the domain and bolding the status would give us a string that looks like this: 266 | 267 | ":thumbsup: I am happy to report that *<".$response_array["domain"].">* is *up*!" 268 | 269 | For status `2`, the site is down, let's use the disappointed face. Adding the link and the bold text gives us this string: 270 | 271 | ":disappointed: I am sorry to report that *<".$response_array["domain"].">* is *down*!" 272 | 273 | For status `3`, the domain entered by the user was not valid, let's use the interrobang (!?) to indicate there's a problem. Let's also include some examples of correctly formatted domains, and go ahead and bold those, too. Notice that in this message, we're 274 | 275 | ":interrobang: *".$domain."* does not appear to be a valid domain. Please enter both the domain name AND the suffix (example: *amazon.com* or *whitehouse.gov*)." 276 | 277 | ### Completed `if` statement 278 | 279 | Now our entire `if` statement looks like this: 280 | 281 | ```php 282 | if($ch_response === FALSE){ 283 | 284 | # isitup.org could not be reached 285 | $reply = "Ironically, isitup could not be reached."; 286 | 287 | }else{ 288 | 289 | if ($response_array['status_code'] == 1){ 290 | 291 | $reply = ":thumbsup: I am happy to report that ** is *up*!"; 292 | 293 | }else if ($response_array['status_code'] == 2){ 294 | 295 | $reply = ":disappointed: I am sorry to report that ** is *down*!"; 296 | 297 | }else if($response_array['status_code'] == 3){ 298 | 299 | $reply = ":interrobang: *".$domain."* does not appear to be a valid domain. "; 300 | $reply .= "Please enter both the domain name AND the suffix (ex: *amazon.com* or *whitehouse.gov*)."; 301 | 302 | } 303 | 304 | } 305 | ``` 306 | 307 | 308 | ### Send the formatted response back to the user 309 | 310 | Now, after all that set up and logic and design thinking, it's finally time for the climax of the script! Letting the user know what they asked! 311 | 312 | ```php 313 | echo $reply; 314 | ``` 315 | That's it. That's all you have to to. Just echo the `$reply` string and cURL, which has been waiting patiently this whole time while we went through our machinations, will take that reply and post it back to the user in Slack. 316 | 317 | *Status code `1`: The site is up.* 318 | ![The site is up.](message-up.png) 319 | 320 | *Status code `2`: The site is down.* 321 | ![The site is down.](message-down.png) 322 | 323 | *Status code `3`: The domain is invalid.* 324 | ![The domain is invalid.](message-invalid.png) 325 | 326 | 327 | ### Upload the script to your server 328 | 329 | If you haven't already put your script on your hosting account server, now is the time to do that. I like to keep scripts like this in their own folders, but use whatever organization works for you. The important thing is to make note of what the URL is for the script for the configuration page. 330 | 331 | So if your web address is `http://superhype.com/` and you put your script in a directory called `isitup`, the URL would be `http://superhype.com/isitup/isitup.php`. 332 | 333 | 334 | ## Finish configuring the integration 335 | 336 | The last thing to do is take care is finalizing the slash command configuration on Slack. 337 | 338 | Back on your configuration page, enter the **URL** where you've posted your PHP script. 339 | 340 | ![Enter the URL of your script](field-url.png) 341 | 342 | Leave **Method** set to POST. 343 | 344 | ![Method should be post](field-method.png) 345 | 346 | Next you need to decide whether you want to include your slash command in the auto-complete list of slash commands. This is handy if you think your command will be used frequently. Enter a description of the slash command along with some example usage. 347 | 348 | ![Adding to autocomplete](field-autocomplete.png) 349 | 350 | Finally, add a descriptive label to help distinguish this slash command from the others in your team's list of configured integrations. 351 | 352 | ![Add a descriptive label](field-label-save.png) 353 | 354 | Save it! Now your slash command is available to your team for use. 355 | 356 | 357 | ## Next steps 358 | 359 | In the next tutorial, we'll build on this one in two ways: 360 | 361 | * We’ll work with more complex information returned from the third-party service. 362 | * We’ll explore sending the response to Slack as a public slash command reply or through an incoming webhook, which gives you more options for formatting and allows you to send the reply to any channel for everyone on the team to see. 363 | 364 | ### Further reading 365 | 366 | This tutorial touched several topics, and there's a lot more to learn about all of them. 367 | 368 | * Message formatting on Slack: https://api.slack.com/docs/formatting 369 | * cURL Basics: http://httpkit.com/resources/HTTP-from-the-Command-Line/ 370 | * PHP Arrays: http://www.w3schools.com/php/php_arrays.asp 371 | * Using JSON: http://www.copterlabs.com/blog/json-what-it-is-how-it-works-how-to-use-it/ 372 | 373 | ## Download This Project 374 | 375 | If you haven't downloaded the completed script yet, you can get it here: https://github.com/mccreath/isitup-for-slack/ 376 | 377 | If PHP is not your thing, and you’d like to see this in Python, my colleague Jake has you covered: https://github.com/jake-swanson/isituppy 378 | 379 | Could be it's time to retire this tutorial. 380 | 381 | 382 | 383 | 384 | -------------------------------------------------------------------------------- /docs/add-configuration.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mccreath/isitup-for-slack/c16a1461fc1b0f81552e253cf68c449ee8a00169/docs/add-configuration.png -------------------------------------------------------------------------------- /docs/choose-command.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mccreath/isitup-for-slack/c16a1461fc1b0f81552e253cf68c449ee8a00169/docs/choose-command.png -------------------------------------------------------------------------------- /docs/field-autocomplete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mccreath/isitup-for-slack/c16a1461fc1b0f81552e253cf68c449ee8a00169/docs/field-autocomplete.png -------------------------------------------------------------------------------- /docs/field-label-save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mccreath/isitup-for-slack/c16a1461fc1b0f81552e253cf68c449ee8a00169/docs/field-label-save.png -------------------------------------------------------------------------------- /docs/field-label.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mccreath/isitup-for-slack/c16a1461fc1b0f81552e253cf68c449ee8a00169/docs/field-label.png -------------------------------------------------------------------------------- /docs/field-method.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mccreath/isitup-for-slack/c16a1461fc1b0f81552e253cf68c449ee8a00169/docs/field-method.png -------------------------------------------------------------------------------- /docs/field-token.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mccreath/isitup-for-slack/c16a1461fc1b0f81552e253cf68c449ee8a00169/docs/field-token.png -------------------------------------------------------------------------------- /docs/field-url.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mccreath/isitup-for-slack/c16a1461fc1b0f81552e253cf68c449ee8a00169/docs/field-url.png -------------------------------------------------------------------------------- /docs/hint-usage-label.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mccreath/isitup-for-slack/c16a1461fc1b0f81552e253cf68c449ee8a00169/docs/hint-usage-label.png -------------------------------------------------------------------------------- /docs/message-down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mccreath/isitup-for-slack/c16a1461fc1b0f81552e253cf68c449ee8a00169/docs/message-down.png -------------------------------------------------------------------------------- /docs/message-invalid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mccreath/isitup-for-slack/c16a1461fc1b0f81552e253cf68c449ee8a00169/docs/message-invalid.png -------------------------------------------------------------------------------- /docs/message-up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mccreath/isitup-for-slack/c16a1461fc1b0f81552e253cf68c449ee8a00169/docs/message-up.png -------------------------------------------------------------------------------- /isitup.php: -------------------------------------------------------------------------------- 1 | * is *up*!"; 74 | } else if($response_array["status_code"] == 2){ 75 | # Boo, the domain is down. 76 | $reply = ":disappointed: I am sorry to report that ** is *not up*!"; 77 | } else if($response_array["status_code"] == 3){ 78 | # Uh oh, isitup.org doesn't think the domain entered by the user is valid 79 | $reply = ":interrobang: *".$text."* does not appear to be a valid domain. \n"; 80 | $reply .= "Please enter both the domain name AND suffix (example: *amazon.com* or *whitehouse.gov*)."; 81 | } 82 | } 83 | 84 | # Send the reply back to the user. 85 | echo $reply; 86 | --------------------------------------------------------------------------------