Integrate Monika with Discord using Discord Server Webhook

Denny Pradipta
Hyperjump Tech
Published in
4 min readFeb 15, 2022
Photo by Alexander Shatov on Unsplash

We have implemented integration between Monika and Telegram Bots, Slack, Microsoft Teams, even WhatsApp too. Per April 2021, we added Discord into Monika’s growing channel choice.

Discord is a free voice, video, and text chat app that’s used by tens of millions of people ages 13+ to talk and hang out with their communities and friends. Discord has been getting popular aside from gaming. Discord allows you to chat and use voice channels to communicate with each other for free.

With that in mind, it can be used for anything such as family and friends, private communities, and internal workplace communication tools. Even better, Discord supports bots and webhooks too!

This article will show you how to integrate Monika with Discord using Discord server webhook so that you can get your Monika notifications through your maintained Discord server. So, without further ado:

Getting your Discord server webhook

To create your server webhook, you need to create a server first (if you haven’t yet). Navigate to the left sidebar of your Discord app, and click the Plus icon to create a new server. Answer the questions given, give your server a name, and click Create button.

Create a server

Now that your server is created, click your server’s name at the top left of the app, and select Server Settings. Then, navigate to the Integrations menu.

Integrations menu

After that, click the Create Webhook button. Then, click the New Webhook button. Enter the desired name for the webhook (e.g Monika Webhook), select which channel (e.g #general), and click the Save Changes button. Now that you have created your webhook, click the Copy Webhook URL button and save the webhook URL somewhere else.

Created webhook

Integrate Monika with Discord

Monika is an open-source and free synthetic monitoring command-line application. The name Monika stands for “Monitoring Berkala”, which means “periodic monitoring” in the Indonesian language.

With Monika, you can add as many websites as you want to monitor. You can monitor several undesirable events such as service outages or slow services. In addition, you can configure Monika to send notifications of the incidents on your services through your favorite communication tools like SMTP mail, Telegram, Slack, etc.

Install Monika via npm install -g @hyperjumptech/monika or if you don’t have NPM in your system, you can download the prebuilt binary from our release page.

Now that we have our Webhook URL, it’s time to create a configuration called monika.yml:

Let me explain a little bit about this configuration:

  • You need to set the notification channel in the notifications object. There are 3 properties: id, type, and data. Set the id to any string values, as it is just an identifier. Then, set the type field to discord to set the notification channel to Discord. After that, put your Discord Webhook URL into the data.url field.
  • Monika will be probing https://reqres.in/api/users every ten seconds and will send you an alert if the response time is greater than half a second or the response status code is not 200.
  • The Incident and recovery threshold is set to one, which means when an incident/recovery happens at least once, it will send you an alert.

Now that we have our configuration ready, it’s time to run it with Monika. Go to the directory where you saved the Monika configuration, and run Monika straight away using monika -c monika.yml

Running Monika with working Discord integration

Congratulations! Now that you have successfully integrated Monika with Discord, you will be notified if your website is slow or down.

Closing

If you monitor your community web pages or internal workplace communication tools using Discord, integrating Monika to Discord is a good idea. You can easily create a webhook URL in your existing servers without hassle, configure Monika, and monitor right away!

If you’re having a problem with using Monika, don’t hesitate to create an issue on Monika’s Github Issue Page. If you like this article, don’t forget to clap and share this article with your friends!

That’s it for today, see you next time!

Hyperjump is an open-source-first company providing engineering excellence service. We aim to build and commercialize open-source tools to help companies streamline, simplify, and secure the most important aspects of their modern DevOps practices.

--

--

Denny Pradipta
Hyperjump Tech

Full-stack developer who loves to explore new technologies. Uses MongoDB, Express, React, and Node daily. Regularly writing for Hyperjump Technologies.