Notify Teammates of Chat via WhatsApp

Abby Updated by Abby

In this article we'll show you how you can notify your employees via WhatsApp of incoming chats

For this workaround, your employees will need to have been previously opted in, and we will need their Customer ID, we will also need a free Make account

The employee will receive a notification with the chat url every time someone selects the Human Takeover flow

Here's what the bot looks like:

In our example we'll redirect the chat to one employee or another based on the current time

We've used the business hours block to set the employee hours, open for the daytime employee, and closed for the night time employee

We'll add the Customer ID of the employee to the corresponding shift

Here's what the Make flow will look like:

Let's start with the Webhooks module, we'll need to select 'Custom Webhook', and copy the url it gives us:

Now we'll go back to the Webhook block in Landbot and paste the url

In the params we'll add employee as the key, and as the value we'll add our employee customer ID

Next, we'll add another parameter, this time we'll add 'chaturl' as the key, and as the value we'll add the following: ΒΏΒ·~uuidΒ·?

We'll now go back to Make and click 'Determine data structure'

Once that's clicked we can go to Landbot and press 'Test the request', this should be the response:

Once we have a 200 response we can go back to Make and complete the scenario

Now, we'll add two 'HTTP make a request' modules, the first will send the message, and the second will un-assign the chat

Here's what the first module will look like:

In the url we'll add the following, changing XXXX for the employee customer ID we previously sent

https://api.landbot.io/v1/customers/XXXXXX/send_text/

This is a POST request

In Headers we'll add our API key, the key will be Authorization and the value will be Token XXXXX

We'll replace XXXXX for our API key

Next we'll scroll down to Body

We'll select Body type 'Raw' and Content type 'JSON'

In the Request content we'll add the following

{

"message": "https://app.landbot.io/gui/chats_v4/XXXXXX"

}

changing XXXXXX for our chaturl variable

We should keep in mind that this request is to send a plain message, this requires that the employee has had a conversation within the past 24 hours, if this is not the case, we can change this request for a Message Template

In the final module of our scenario we'll add the following to our url

https://api.landbot.io/v1/customers/XXXXX/unassign/

We'll change the method to PUT

And again, we'll change the XXX for the employee customer ID variable, and we'll add the API key the same way

Finally, we'll just need to activate the scenario!

Every time a user selects Human Takeover in the bot, your employee should get a notification with the Chat url!

How did we do?

Different ways to format numbers with JS (WhatsApp)

Creating a Simple Cart in WhatsApp

Contact