Company
Date Published
Author
Pedro Lopes
Word count
3089
Language
English
Hacker News points
None

Summary

The REST API for a real estate agency uses Twilio TaskRouter to delegate leads to the correct salesperson based on their monthly income. The API receives customer data through an HTTP request, generates a lead, and sends it to the TaskRouter for assignment. The TaskRouter assigns the lead to a worker based on a predefined workflow, which is determined by the lead's monthly income. Once a reservation is created in the TaskRouter, the API receives a callback request to accept or reject the reservation. The API can be improved by decoupling the acceptance of reservations from the callback process and exploring alternative methods for creating tasks, such as receiving phone calls through TwiML.