Integrate Monika with DingTalk

Denny Pradipta
Hyperjump Tech
Published in
5 min readJul 12, 2022
DingTalk Logo — Source

At Hyperjump, one of our priorities is improving Monika integrations with many collaboration tools. We have successfully integrated Monika with Telegram Bots, Slack, Microsoft Teams, Discord, and even WhatsApp. In May 2022, we added DingTalk to Monika’s growing channel choice.

DingTalk is an all-in-one mobile workplace developed by Alibaba. With DingTalk, you can receive Monika notifications through the app so that you won’t miss any incidents again.

This article will show you how to integrate Monika with DingTalk to get your Monika notifications. So, without further ado:

Setup DingTalk Robot

Setting up DingTalk could be very difficult if you can’t read Chinese. So, we will guide you on how to do it with pictures so that you can understand it more straightforwardly.

First, you need to open https://open.dingtalk.com/document/group/assign-a-webhook-url-to-an-internal-chatbot to access the documentation. Then, you need to click the highlighted URL below:

Click the highlighted URL

Assuming you already have a DingTalk account, you will be redirected to the page in the image below. If you haven’t, you will be redirected to create an account.

Logged in to DingTalk

After that, go to the second menu on the navbar, and select the first sub-menu like so:

Go to the second menu on the navbar, and select the first sub menu

You will be redirected to another page. Select the last menu on the sidebar, and click the blue button to create a robot.

Select the last menu on the sidebar
Click the blue button

After that, you will be prompted to fill out a form to create a robot. Fill out the form with the application name, description, and icon. Once that’s done, click the blue button again.

Fill out the form with the application name, description, and icon

If the bot has been successfully created, it should redirect you to the robot details page.

Robot details page

But your newly created robot has not been activated yet, so let’s activate the robot by selecting the last menu on the sidebar, then select the first sub-menu of it, and click the right blue button. Once that’s done, the red indicator should turn green.

Click the sub menu and click the right blue button
The indicator should turn green

Use DingTalk Robot in the Desktop App

Now that we have successfully created the robot, we can use it in the desktop app. So, download the desktop app and authenticate with your credentials. Then, create a new group for the robot to be added.

Create a new group

Then, click the group and open the settings inside the group and click the Group Assistant menu.

Settings inside the group
Group Assistant Menu

From there, you can add your previously created robot. Click the robot name you have just created.

Click the robot name

A popup will appear showing your robot data. Scroll down to the webhook URL and copy the webhook URL to another place. Then, copy only the access token in the webhook URL. The access token format should be like this:

https://oapi.dingtalk.com/robot/send?access_token=<your_access_token>

Save it to somewhere safe as we are going to need it later.

Copy webhook URL

Additionally, you can secure your robot by allowing keywords. Scroll down to Security Settings and check the Custom Keywords checkbox. From there, you can define the keywords allowlist yourself.

Whitelisting keyword

We are finally done with the DingTalk setup, all that’s left is to set up Monika with the DingTalk webhook URL.

Integrating Monika with DingTalk

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 conditions such as service outages or slow services. Also, you can configure Monika to send notifications of the incidents on your services through your favorite communication tools like SMTP mail, WhatsApp (it’s free!), Microsoft Teams, Slack, and many more.

There are many ways to install Monika, from Node Package Manager (NPM), downloading binaries from the Monika release page, to package managers such as Homebrew or Snapcraft.

Now that we have our access token from DingTalk, it’s time to create a Monika configuration called monika.yml

Let me explain the configuration a little bit:

  • Monika will use DingTalk as their notification channel, using the access token from the previous step
  • Monika will probe http://localhost:3000/api/demo/status with recovery and incident threshold set to 1 every one second
  • Monika will alert you if the response status code is not 200

Once that’s done, run the monika.yml with the configuration above.

It’s up and running!

Congratulations! You have successfully integrated Monika with DingTalk!

Closing

DingTalk is an all-in-one mobile workplace developed by Alibaba. With DingTalk, you can receive Monika notifications through the app so that you won’t miss any incidents again. If you’re fluent in Chinese, chances are you can do it easily. Shoutout to Lukman Adisaputro for helping us integrate Monika with DingTalk!

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.