Video calls are an invaluable tool that can connect people from around the world. As the pandemic progresses, we’ve depended on these conversations to effectively disseminate company knowledge, enabling us to build more collaboratively.

Video calls are meant to be easy — like simply walking up to a person and starting a conversation. But in reality, this is far from the truth. It requires the user to maintain an account, logging into a platform every time to start a video meeting.

At n8n, we use Mattermost and Whereby. Mattermost is an open-source, self-hostable online chat service with file sharing, search, and integrations. It is designed as an internal chat for organizations and companies. Whereby is an easy to use video conferencing platform that does not require any software and runs entirely in-browser.

We created a custom Mattermost slash command to reduce friction and help us quickly connect with other members of the team via Whereby. In this article, I’m going to show you how you can create a Mattermost slash command that will use n8n as a backend to return your Whereby URL in a channel. You can follow along using the workflow available over here. Please note that you will need to configure credentials for the Mattermost node.

Prerequisites

  • An instance of n8n. You can find instructions on how to set up n8n here. Alternatively, you can use n8n.cloud to get started quickly. (This workflow was built using [email protected] version)
  • A Mattermost account. You’ll need to obtain the Personal Access Token and Base URL. You can find instructions on how to obtain that here.
  • A Whereby account. You’ll need to create a room and copy the room name.

Setting up the Workflow

1. Setting up a Webhook node

The first node of this workflow will be a Webhook node that will receive the requests from the Mattermost slash command (we’ll create the slash command in the next step).

Add a new node by clicking the '+' button on the top right of the Editor UI. Under the Trigger section, select the Webhook node. Then, select the 'POST' option for HTTP Method.

Now, save the workflow. This saves the webhook. Finally, copy the Test webhook URL (we will need this later). Here’s a video of me following the steps mentioned above.

Creating the Webhook node to receive data from Mattermost

2. Create a custom slash command in Mattermost

Mattermost handles all slash commands using HTTP requests. We will first create a custom slash command and then configure it with the webhook that we created in the previous step.

Navigate to Main Menu > Integrations > Slash Commands. Then, click on Add Slash Command and enter a name and description for the command. Enter call as the Command Trigger Word and the webhook URL you copied in step 1 as the Request URL.

Now, click ‘Save’ to create and save the slash command. Here’s a video of me following the steps mentioned above.

Creating a custom slash command in Mattermost
If you don’t have the Integrations option in your Main Menu, slash commands may not be enabled on your Mattermost server or may be disabled for non-admins. Enable it in System Console > Integrations > Integration Management.

Now, click on Execute Workflow. Then, head over to Mattermost and enter /call in the message box. You should now see data from Mattermost in n8n.

It should look something like this the following image.

Data received from Mattermost in n8n

Add a new node by clicking the '+' button on the top right of the Editor UI. Select the Set node. Then, set the Keep Only Set toggle to true. Click on the Add Value button and select ‘String’ from the dropdown list. Enter your Mattermost username in the Name field. Enter your Whereby room ID in the Value field. This will return the correct Whereby room name for the user who has issued the slash command.

It should look something like this the following image.

Using the Set node to map the Mattermost username to the Whereby room name‌

Then, add a new node by clicking the '+' button on the top right of the Editor UI. Select the Mattermost node. Double click on the node and create credentials for the node by clicking on the Mattermost API dropdown list and selecting Create New. Enter the Access Token that you obtained earlier. Then, use the variable selector to enter the Channel ID received in the webhook. You can use the following expression in the Expression Editor: {{$node["Webhook"].json["body"]["channel_id"]}}. This tells the Mattermost node where to send the message.

In the Message field, enter Join me in a video call:. Click on the Add attachment button, and then select ‘Title’ from the Add attachment item dropdown list. Select ‘Title Link’ from the Add attachment item dropdown list. Click on the gears icon, select ‘Add Expression’ from the dropdown list and enter https://whereby.com/{{$json[$node["Webhook"].json["body"]["user_name"]]}} in both the Title and Title Link fields. This expression retrieves the username of the person who issued the slash comment (from the Webhook node) and correlates that with their Whereby room ID that was specified in the Set node.

Here’s a video of me following the steps mentioned above.

Using the Mattermost node in n8n to send the Whereby meeting link to Mattermost

4. Executing the workflow

First of all, change the webhook in Mattermost from the testing to production and activate the workflow. The test webhook is meant only for configuration and setting up the webhook. It is only active for 120 seconds. The production webhook on the other hand, listens for requests all the time.

Next, open a Mattermost thread and type in /call and hit enter. You should see your Whereby meeting room link returned as a message!

Here’s a video of me executing the workflow.

Using a custom slash command in Mattermost to start a Whereby meeting via n8n

And, that’s it! Congratulations, you have just easily set up a custom slash command to quickly start video calls via Mattermost 🎉

Next Steps

Adding more users

To allow other users to use the /call command, simply add more users’ information in the Set node, by clicking on the Add Value button and selecting ‘String’ from the dropdown list. Enter their Mattermost username in the Name field and their Whereby room ID in the Value field.

Extending the workflow

Since n8n supports several other nodes such as Zoom, you can experiment with customizing and adding more nodes to better suit your needs.

You can also include steps in the workflow to schedule and end meetings as well, making the slash command a powerful way to conduct meetings within Mattermost.

You can also extend the workflow to include multiple services, for example /call zoom would start a Zoom meeting and /call whereby would start a Whereby meeting, and so on.

Conclusion

With the current global pandemic, remote work is becoming the new normal and brings with it the challenges of communication. Video calls are becoming increasingly relevant with each passing day and is a great way to collaborate as a distributed team.

In this article, we learnt to create a custom Mattermost command, using n8n and Whereby to reduce the friction involved in initiating a conversation remotely, via video.

We’ve seen several benefits internally, we save time and end up collaborating more on great ideas — because the medium of discussion doesn’t feel like a chore anymore. What are your thoughts? How do your online meetings work?

In case you’ve run into an issue while following the tutorial, feel free to reach out to me on LinkedIn or ask for help on our forum 💙