Community discussions

MikroTik App
 
troke
just joined
Topic Author
Posts: 3
Joined: Wed Aug 28, 2019 2:30 pm
Location: Bali, Indonesia

[SHARE] Sending your message log from Mikrotik to Discord

Mon Mar 29, 2021 7:39 am

Hello, first of all sorry for my bad english, i'm just want to share my script that might be usefull for all of you !

Mikrotik To Discord

As the name, this scripts can send message from your Mikrotik such as Hotspot login, Netwatch and some others who supported Mikrotik Scripts. I made this script because i have to know the user and some my devices are managed by my mikrotik to send the log into my discord server, before that i'm using TelegramBot to send it but i'm not very active using telegram, so i decided to make this script.

This script are very simple, mostly using curl for fetching by method GET the Discord API Webhook.
All you need to know i'm just providing the tutorial, you can use my scripts who already hosted by Heroku or you can host the script wherever you want

# Source Code
https://github.com/troke12/MikrotikToDiscord (sorry it's full Indonesian, you can easily click Heroku button if you wanna deploy by your own)

# Requirements
- Discord Server
- Discord Webhook (use this tutorial)
- Mikrotik

# Tutorial
1. Copy these code into your mikrotik
/tool fetch url="https://trokewebhook.herokuapp.com/form.php?text=INPUT_YOUR_TEXT&id=INPUT_ID_WEBHOOK&token=INPUT_TOKEN_WEBHOOK" keep-result=no;
Note :
- URL - This is my script that already hosted by Heroku, you can change this if you hosted somewhere else
- INPUT_YOUR_TEXT - You can put anything in here for example "MY+DEVICE+ARE+DOWN"
- INPUT_ID_WEBHOOK - Copy your webhook id here
- INPUT_TOKEN_WEBHOOK - Copy your token here

Webhook URL Explaination :
After you creating the webhook discord you will have the url for the webhook, please note that do not share your webhook url to anyone
https://discord.com/api/webhooks/{{ID_WEBHOOK}}/{{TOKEN_WEBHOOK}}

Example :
*My Webhook url already deleted
Image

2. Results
Image

I hope you like it guys! thanks!
 
Redy321
just joined
Posts: 4
Joined: Sat Nov 21, 2020 1:02 am

Re: [SHARE] Sending your message log from Mikrotik to Discord

Wed Mar 09, 2022 5:21 pm

Cool, thanks for sharing.

Who is online

Users browsing this forum: Ellaham, FoxWhite and 15 guests