Last active
June 19, 2017 01:19
-
-
Save meilon/1ddf647063485e0b64bc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This is a script to send a notification from OTRS to Mattermost. | |
# Create a new Generic Agent and select "TicketCreate" under event based events. | |
# Finally, put in the path to the script into the command box. | |
# Of course you could use it for different notifications, but OTRS is only giving the ticket number and id to the script. | |
header="Content-Type: application/json" | |
ticketid=$2 | |
request_body=$(< <(cat <<EOF | |
{ | |
"username": "OTRSbot", | |
"text": "**New Ticket!** <http://host.of.otrs/otrs/index.pl?Action=AgentTicketZoom;TicketID=$ticketid>", | |
"icon_url": "http://host.of.otrs/otrs-web/skins/Agent/default/img/icons/apple-touch-icon.png" | |
} | |
EOF | |
)) | |
curl -i -X POST -H "$header" -d "$request_body" http://host.of.mattermost/hooks/WebHookKey |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment