Enhancing WhatsApp Bots with Delayed Responses Using External APIs

Cesar Banchio Updated by Cesar Banchio

WhatsApp bots have become increasingly popular for automating conversations and providing quick responses. However, adding a delay between messages can significantly improve the user experience and simulate a more natural conversation flow. By integrating external APIs, we can introduce delays in WhatsApp bots, allowing for more human-like interactions. Here's a step-by-step guide on how to generate a delay in a WhatsApp bot using an external API. On this example, we will use this API.

We will create a simple flow

The API has this endpoint https://hub.dummyapis.com/delay?seconds=4 where we can set the delay. This number can be anywhere from 0 to 60, keep in consideration possible timeouts of the request.

How to set up the Webhook Block

We will use a GET request to the endpoint mentioned above:

It's very important to save the response in order for the delay to be generated:

Remember to thoroughly test your implementation to ensure that the delays are accurately applied and do not hinder the overall performance of the bot. With a well-implemented delay mechanism, your WhatsApp bot will be better equipped to provide more authentic and realistic interactions, leading to a more enjoyable user experience.

How did we do?

Send Automated Message Templates based on Dates

Different ways to format numbers with JS (WhatsApp)