Skip to content

Instantly share code, notes, and snippets.

@meilon
Last active June 19, 2017 01:19
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save meilon/1ddf647063485e0b64bc to your computer and use it in GitHub Desktop.
Save meilon/1ddf647063485e0b64bc to your computer and use it in GitHub Desktop.
#!/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