How We Connect a WhatsApp Chatbot to a Medical System Without an API

One of our healthcare clients uses software similar to Doctoralia Pro or Agenda Pro, specialized in medical appointment management. This SaaS worked very well for their internal team, but had a major limitation: it did not offer a public API or documentation for integration with other tools, such as the chatbot we had already implemented on their website.

This was a problem because the client wanted to offer a modern and automated experience, where patients could book their appointment directly through the chatbot, without human intervention.

This was to achieve the well-known “self-serving” model, where patients can book their appointment quickly and automatically from any device, without human intervention.


🚧 The Challenge

Since the SaaS did not offer an official API, we couldn’t establish a direct connection to retrieve the doctor’s available time slots. This limited appointment scheduling to being handled solely by the clinic’s internal staff, which:

  • Increased the margin of error in appointment assignment.
  • Caused delays due to lack of staff response.
  • Depended 100% on human availability.

🧪 Exploring Solutions

The first thing we did was review the capabilities of the chatbot we had already configured in Kommo. We verified that it could send webhooks to an external server to fetch dynamic information and display it within the conversational flow.

With that validated, we started exploring two paths to access the available slots from the medical SaaS:

  1. Automation with Puppeteer (an open-source tool to control browsers).
  2. Automation with Playwright, a more modern open-source alternative, more robust and with multi-browser support.

🤖 Why Did We Choose Playwright?

We decided to implement the solution with Playwright for the following reasons:

  • More modern and stable for complex web interfaces.
  • Supports multiple browsers (Chromium, Firefox, WebKit).
  • Better handling of iframes, authentication, and complex scenarios.
  • Excellent documentation and active community.

🔧 What Did We Do?

  1. We created a microservice in Node.js that uses Playwright to:
    • Automatically log in to the client’s system (as if it were a staff member handling appointments).
    • Navigate to the appointment calendar.
    • Extract available time slots for the next 14 days.
  2. This service formats the time slots as JSON and exposes them via an endpoint, e.g., “/get-horarios“.
  3. The Kommo chatbot sends a webhook to that endpoint when the patient reaches the step “When would you like your appointment?”
  4. The chatbot receives the time slots as interactive buttons, and the patient selects the one that suits them best. It is automatically registered in the system.
  5. It’s worth noting that this chatbot is exclusive to WhatsApp usage.

🎉 The Result

The client was more than satisfied, having transformed their traditional system into a modern self-service model for patients, without having to switch software or wait for the provider to offer an API.

The benefits were immediate:

  • 👨‍⚕️ Increased operational efficiency.
  • 🕐 Reduction in human error.
  • 🤖 Full automation of the appointment scheduling flow.
  • 📈 Improved end-user experience, making the process faster and more pleasant.

✨ Conclusion

This case demonstrates that innovation doesn’t always depend on software having an API. With the right tools and a creative approach, it’s possible to overcome any technical limitation and deliver outstanding user experiences.