- Registrar un bot en BotFather y copiar el botid
- Averiguar el
chat_id
del grupo donde se quieren entregar los mensajes. Google is your friend. - Crear un script en el router con el nombre
telegram
y el siguiente contenido:
:global tgMessage
:local botid
:local chatid
set botid "672533351:AAG_yj6vKm9HIVBSDFGSDFGSDFGSDFG2a40"
set chatid "-2842234298"
if ($tgMessage != "") do={
/tool fetch keep-result=no mode=https http-content-type="application/json" url="https://api.telegram.org/bot$botid/sendMessage" http-data="{ \"chat_id\": \"$chatid\" , \"text\": \"$tgMessage\" }"
set tgMessage ""
}
La opcion http-content-type="application/json"
de la herramienta tool fetch
se eliminó y ahora hay que usar http-header-field="content-type: application/json"
.
:global tgMessage
:local botid
:local chatid
set botid "672533351:AAG_yj6vSDFGSDFGgsdfgsdfgIwSa2a40"
set chatid "-28426345648"
if ($tgMessage != "") do={
/tool fetch keep-result=no mode=https http-method=post http-header-field="content-type: application/json" url="https://api.telegram.org/bot$botid/sendMessage" http-data="{ \"chat_id\": \"$chatid\" , \"text\": \"$tgMessage\" }"
/log warn "Telegram enviado"
set tgMessage ""
}
En otro script o contexto, fijar la variable global tgMessage
y luego invocar el script telegram
:global tgMessage ("AP HPE volvio a responder")
/system script run telegram
- Crear webhook en la Consola de Sistema de Mattermost y copiar el URL
- Crear un script en el router con el nombre
mattermost
y el siguiente contenido
:global mmMessage
:global routerName [/system identity get name]
:global mensaje ("Router: $routerName\nMensaje:\n$mmMessage")
if ($mmMessage != "") do={
/tool fetch url="https://mattermost.midominio.com.py/hooks/3bphuipej7bg3de1txk5xfayyw" http-data="{ \"text\": \"$mensaje \" }" keep-result=no mode=https http-content-type="application/json"
set mmMessage ""
}
En otro script o contexto, fijar la variable global mmMessage
y luego invocar el script mattermost
:global mmMessage ("AP HPE volvio a responder")
/system script run mattermost