Company
Date Published
Author
Osaigbovo Emmanuel
Word count
3013
Language
English
Hacker News points
None

Summary

The chatbot is built using Laravel, Redis, and Twilio's API for WhatsApp. It uses a factory pattern to generate responders based on the type of message received from the user. The responders include a GreetResponder, HospitalResponder, and InvalidKeywordResponder. The chatbot can respond with a greeting, list nearby hospitals, or an error message if the input is invalid. The Redis database stores the list of hospitals and their locations, which are used to calculate the distance between the user's location and each hospital. The Twilio API handles the WhatsApp messages and sends them to the HospitalController for processing. The chatbot can be tested by sending different types of messages, such as "hi," an invalid keyword, or a location with the current latitude and longitude.