#!/bin/bash -e message=$(echo $1 | tr -d '\n' | tr -d '"') username=$(echo $2 | tr -d '\n' | tr -d '"') SLACK_URL=https://hooks.slack.com/services/SDS9SDID9D9SJS9SDS if [ -z "$username" ]; then username="Server" fi if [ ! -z "$message" ]; then curl -X POST -H 'Content-type: application/json' --data "{ \"channel\": \"#notifications\", \"username\": \"${username}\", \"icon_emoji\": \":bot:\", \"text\": \"${message}\" }" $SLACK_URL fi