5 Steps how to track your Team's Mood
Tags: camunda, zeebe, automation, mood
Published: 2020-12-11 18:46:14

Personally, I'm a very structured person. And as a rule, I also try to back up everything possible with data and facts in my private life. That helps me personally a lot to draw the right conclusions for actions.

Measuring your own mood is a metric to determine over time if something is wrong. Often people don't want to admit it to themselves, or judge the situation wrongly. Of course, the same measurement can be applied to entire teams. A team is only a strong team if the employees are satisfied and happy. Human mood pictures are an important asset, they should not only be treated anonymously but also primarily be in the data sovereignty of the teams (or at least the company). Of course, you can use external services for this, but you can also simply implement it yourself.

**How about a self-built mood barometer for your team?**

I have only simple requirements for it:

- Simple and accessible channel to receive mood survey
- Easy to configure trigger times
- Mood value may only be submitted once
- Anonymous results

I will again use a [Camunda Cloud](https://camunda.io) workflow engine for this use case. Why? Because I don't need to set up a cron job to poll the mood periodically, and because it allows me to easily extend the process.

## A small backend is of course necessary

The backend should take care of sending and accepting the mood images. As channel I use a simple email. The email should contain five links that reflect the current mood. I chose email because everybody has an e-mail account. Be it in a private or business environment. No one has to register for a new service or install software for it.

![E-Mail Template](https://dev-to-uploads.s3.amazonaws.com/i/f6hjnuj9oqmnjgh5ufe3.png)

I would like to use the following approach:

1. A new process instance starts daily.
2. A worker of a service task generates a random id for each participant and sends an email.
3. Links in the email point to a web application that sends an HTTP request to a backend service with the mood.
4. The backend service persists the data and checks beforehand if the request has already been submitted for the generated Id.

## #1 Design the process

![BPMN Diagram](https://dev-to-uploads.s3.amazonaws.com/i/cn9ffzynemefyu4olv97.jpg)

Hardly worth mentioning, so simple and so valuable! A special feature is the start event. It is a timer event with the following configuration:

- Timer Definition Type: `Cycle`
- Timer Definition: `R/P1D`

With this configuration we tell the workflow engine to start a new instance every day.

## #2 Implement the worker

The worker should do two things:

1. Generate Id
2. Send email

I've implemented the following controller to manage the moods:

{% gist https://gist.github.com/urbanisierung/09c04534118809304a6df1d665e21357 %}

Via `createRequest()` a new record is created with a random Id and the associated team. Then the record is stored in a database.

The worker uses this controller to create the request. Afterwards the email is sent via an SMTP server. For the sake of simplicity, the name, the email address and the associated team are set as parameters.

{% gist https://gist.github.com/urbanisierung/b525a158371ea900212b4266de39bed5 %}

The implementation can be further optimized, for example, by taking the user from an (internal) user database and passing only a `userId`. In addition, an email service such as [SendGrid](https://sendgrid.com/) or [MailJet](https://www.mailjet.com/) can be used for sending emails.

## #3 Setup a simple Backend

The backend is very simple, it accepts the request, checks if there is already a result for the id and if not it is persisted:

{% gist https://gist.github.com/urbanisierung/0afb2d71eb2fd1154ffdf238f995c60c %}

## #4 Use a Frontend to route your request to the Backend

Here I don't want to go into too much detail, it's just for routing the request ;)

## #5 Start measuring!

{% youtube s04erEH4neM %}

With a few simple steps a service is created that can track your team's mood. Since the orchestrating component is a process, you can of course add more steps, or customize the flow to send an email only on certain days.

[![BPMN Diagram extended](https://dev-to-uploads.s3.amazonaws.com/i/bnv9o8nx18795e27yujl.jpg)](https://cawemo.com/share/64fa544a-f311-451b-a4ed-ece78d58522a)

And now: relax! :)

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/sjt6v34sd6u1f51tyzad.jpg)

---

Let me know if the article was helpful! And if you like the content follow me on [Twitter](https://twitter.com/urbanisierung), [LinkedIn](https://www.linkedin.com/in/adamurban/) or [GitHub](https://github.com/urbanisierung) :)

---

<span>Header Photo by <a href="https://unsplash.com/@aridley88?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Andrew Ridley</a> on <a href="https://unsplash.com/s/photos/mood?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></span>

<span>Last Photo by <a href="https://unsplash.com/@tanelah?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Taneli Lahtinen</a> on <a href="https://unsplash.com/s/photos/mood?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></span>