PickDrive: Taxi Booking WhatsApp ChatBot [Concept]
Intro
This quick project has drawn much of its inspiration from InDrive - a ride / taxi booking Mobile application
For the past few weeks, I have been attempting to create a Proof of Concept (PoC) WhatsApp Chatbot for a taxi booking system. Most of the chatbots I have had to develop where mainly based off plain texts and buttons. Of recent, I have been digging and exploring more uncommonly used features that WhatsApp has like WhatsApp Flows and location messages.
For this chatbot - I heavily relied on and took advantage of the Location-based
messages that WhatsApp has to offer.
Over the past few months, I have been challenging myself to attempt creating WhatsApp Chatbots with the Java Programming Language, specifically using the Spring Boot framework. I have been developing chatbots with Python Language a lot since I started creating chatbots for clients for over 3 years.
It has been an exciting and challenging journey, which led me to create JAWCE - A Java WhatsApp Engine based on templates which was used for this project.
Process Flow
For this chatbot, the process should be simple enough for the user to book a taxi. To do this i created an ugly plain old flow like below
The user must do the below quick steps until they are off to their destination
Choose taxi / ride type
Provide their pickup point
Provide their destination address
The chatbot will calculate the distance and the price
User can accept or counteroffer
The system will get the available willing drivers
User selects & confirm driver which meets their taste
The driver & user are paired, and the driver drives to pick user up
At any given time, user can ping the driver-in-transit's current location address
Developing
PickDrive concept was quick to showcase thanks to JAWCE. All I had to do was to focus on the business logic of it and the flow of the conversation with the user. Some parts of the conversation flow defined as templates looks like below
"PICK-DRIVE-MENU":
type: button
prop: rideType
message:
title: PickDrive
body:
- "Hello, I'm PickDrive Assistant ๐"
- "I make your inner-city traveling a breeze."
- ""
- "To start, select your preferred ride type"
buttons:
- Ride
- Standard
- Luxury
routes:
"re:.*": "PICKUP-LOCATION-STAGE"
The template above will render a button on WhatsApp, the routes
field let the engine know that any response (matched by the regex) the user gives will make the engine go to the stage (another template) defined there. The prop
field will save the user input in the session / cache under the key mentioned on the template to retrieve it for later processing.
PICKUP-LOCATION-STAGE:
type: request-location
on-receive: "http://pickdrive.local/api/loc/pickup"
message: "Where would you like to be picked from?"
routes:
"location_request": "DESTINATION-LOCATION-STAGE"
A template to give user the option to send location via WhatsApp. The template includes the on-receive
hook which is a REST endpoint which handles the business logic to save the received user pickup location address for later processing.
From the above, you can get a clear picture of how the chatbot falls in place as defined by the templates.
Remarks
WhatsApp Chatbots can be used to handle different types of projects. What matters is to understand the requirements and drill down to see the feasibility of the requirements against the channel of choice, which can be a chatbot or mobile application or any client system. This quick project demonstrated, by taking advantage of the WhatsApp features, that requirements can be met with proper planning and development.
How did you find this article? Any suggestions? Let me know in the comment section.
Have any questions for me? Let's link up!