Implement an Order Tracking Activity
Introduction
When a customer purchases a product online, once the package ships, the customer needs to be able to track the package and obtain a correct estimate of the delivery time.
Flow Builder, through order tracking, allows users to provide an estimate to their customers of the time products are delivered in real time. Partners must provide an exposed API to be integrated with the Flow to provide order tracking.
Scenario
The customer wants to locate their package and obtain an estimated delivery time through WhatsApp.
The user selects order tracking from the menu and provides a product ID. The channel provides the current delivery status of the package.
Actors
- Yalo Studio.
- WhatsApp/Facebook User.
Dependencies and Technical Requirements
The client must provide an API Rest to be consumed by Yalo and return the information to the end-users who requested the status. This module of Yalo's solution depends on the client having API REST services available to be consumed by Yalo and displaying information to the end-users regarding shipment status.
Order Tracking Flow
The Order Tracking activity defines the following steps for the customers to locate their package.
- Provide your order number or your request number. Connect to the system API.
- Wait for the system to locate your package.
- Channel provides any of the following results:
If unsuccessful, deliver an error message.
If the information provided is invalid, it delivers an invalid tracking message.
**If successful, deliver the tracking info.
Start by adding the Order Tracking activity via the Add Activity button.
Expanding the Order Tracking activity will display the internal steps. To expand, scroll over the Order Tracking activity and select Expand activity.
Implementation
Follow these steps to build a custom Order Tracking activity.
- Enter a product ID request step.
- Add a match regular expression condition to match id to API.
- Add a back-to-menu condition
- Add a fallback step
- Add custom LUA code for external API. The API will function with HTTP.GET().
- Enter system wait step.
- Add a go-to condition to move to the next step.
- Enter script track step to manage API response. This will allow you to connect to the response steps. These steps will vary depending on the client's API.
A sample API response is displayed in the following Postman example. The API receives the user id and order id numbers to provide a successful response. The actual payload from the order system would include more information.
Sample API response variables could be:
- user id
- order id
- order status
- ship date
- estimated delivery date
Updated about 2 years ago