Hyperjump Tech
Published in

Hyperjump Tech

Integrate Monika with Facebook Workplace using Custom Integrations

Source: https://www.facebook.com/groups/workplaceuk/

We have implemented integration between Monika and Slack, Microsoft Teams, WhatsApp, even Discord too. In June 2021, Ade Yahya submitted a pull request to add Facebook Workplace to Monika’s growing channel choice.

Taken from their FAQ page, Facebook Workplace is a communication tool that connects everyone in your company, even if they’re working remotely. Using Facebook Workplace, you can use familiar features such as News Feed, Chat, Live Video, and Groups, to get people talking and working together.

This article will show you how to integrate Monika with Facebook Workplace using Custom Integrations so that you can get your Monika notifications through your Workplace. So, without further ado:

Setting up the Custom Integrations

To create a Custom Integration, you need to create a workplace (if you haven’t yet). Create your workplace at https://work.workplace.com and follow the instructions.

After you have created your workplace, go to the Admin Panel and select Integrations. Then, on the Custom Integrations section, click the Create custom integration button. Fill out the name and the description of the integration and click Create.

Facebook Workplace Admin Panel

You will be redirected to the Integration details page. There, you can click the Create access token button to generate a new access token. Copy the access token somewhere safe, as we are going to use them later on.

Access Token

Then, go to the Permissions page. Enable the Group chat bot, Message any member, and Create link previews permissions (optional). Scroll to the bottom, and click Save.

Permissions

Getting the Facebook Workplace Thread ID

After we have the access token, we need to get the Thread ID. To get the Thread ID, navigate to the home page of your Workplace. Open Chats and create a group of yourself and Monika.

A group of me and the Monika integration

Look at the address bar. The last digits in the URL are your Thread ID. Save the thread ID into somewhere safe.

The 7231209490284210 is your thread ID

Now that the preparation is completed, it’s best to test your Access Token and Thread ID using Postman/Insomnia like so:

{
"recipient": {
"thread_key": <your_thread_id>
},
"message": {
"text": "Test"
}
}

Integrate Monika with Facebook Workplace

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.

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.

There are three ways to install Monika:

  • Install using npm or yarn (Windows/Linux/Mac)
    If you’re using NPM or Yarn, you can simply run this command in your terminal:
npm i -g @hyperjumptech/monika
# or
yarn global add @hyperjumptech/monika
  • Install script
    If you are using Linux, you can simply run this command in your terminal:
curl https://raw.githubusercontent.com/hyperjumptech/monika/main/scripts/monika-install.sh | sh

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

  • Use Package Managers such as Chocolatey or Snapcraft

For the last two weeks, we have been adding Monika to many package managers, such as Chocolatey and Snapcraft. Feel free to install Monika from the package managers mentioned.

Now that we have installed Monika in our system, get your previously-saved access token and thread ID. It’s time to integrate Monika with Facebook Workplace:

Let me explain a little bit about this sample configuration:

  • We are going to use the Facebook Workplace notification channel, with the Thread ID and Access Token that we saved in the previous steps.
  • We are going to probe https://reqres.in/api/users/ URL and it will return a list of users along with the response status code 200.
  • We want to be notified when the response status code is not 200
  • We want to be notified when the response time is larger than 500 milliseconds
  • We want to be notified when the incident or recovery has been triggered once

Now that we have our configuration and Monika ready, it’s time to run monika -c monika.yml in the Terminal.

Working integration with Facebook Workplace!

Congratulations! You have successfully integrated Monika with Facebook Workplace!

Closing

If you use Facebook Workplace daily, integrating Monika with Facebook Workplace 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!

Have a great day!

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.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Denny Pradipta

Denny Pradipta

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