Skip to content

Instantly share code, notes, and snippets.

@rauhmaru
Created May 12, 2016 22:35
Show Gist options
  • Save rauhmaru/a8bb7af781ffa21d53010c258c26b329 to your computer and use it in GitHub Desktop.
Save rauhmaru/a8bb7af781ffa21d53010c258c26b329 to your computer and use it in GitHub Desktop.
Teste
IEVAN POLKA
URL="http://shenlong.solutis.com.br/hooks"
TOKEN="JbkKG29BFaSPcq8JT/jMb7WhrXwvnSR3QiPvYYXm33nenhG9jJG88uAx8Y7qeN6PiQ"
WEBHOOK="$URL/$TOKEN"
CURL="curl -X POST -k --data-urlencode"
TITLE_LINK="http://noc.tjba.jus.br/tr_events.php?triggerid={TRIGGER.ID}&eventid={EVENT.ID}"
####################
ISSO VAI NO CORPO DO EVENTO
TITLE="$2"
BODY="$3"
\"attachments\": [{
\"title\": \"[{TRIGGER.STATUS} - {HOST.NAME}]\",
\"title_link\": \"TITLE_LINK\",
\"text\": \"{TRIGGER.NAME}\n{ITEM.NAME1}: {ITEM.VALUE1}\nIP: {HOST.IP}\nVerificado às {TIME}, em {EVENT.DATE}\nITEM ID: {ITEM.ID}\",
\"image_url\": \"https://rocket.chat/images/mockup.png\",
\"color\": \"#764FA5\"
}]
"
####
envio
$CURL "payload={\"text\":"$TITLE","$BODY"}"
resposta esperada:
curl -X POST -k --data-urlencode 'payload={"text":"$2","attachments":[{
"title":"Rocket.Chat",
"title_link":"https://rocket.chat",
"text":"Rocket.Chat, the best open source chat",
"image_url":"https://rocket.chat/images/mockup.png",
"color":"#764FA5"}]}'
$WEBHOOK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment