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 where https://httpstat.us/201?sleep=10000 we can set the delay in miliseconds. Keep in mind the request will timeout after 30 seconds, so the number has to be less than 30000.

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?

Meta processes guide: FBM verification, Official Business Account (OBA) requests, Appeals

Additional Number integration: Limitations and Requirements (Number integration)