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.

1376

Flow Builder - Order Tracking Flow
click to enlarge

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.

  1. Provide your order number or your request number. Connect to the system API.
  2. Wait for the system to locate your package.
  3. 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.

1544

Flow Builder - Order Tracking activity

Expanding the Order Tracking activity will display the internal steps. To expand, scroll over the Order Tracking activity and select Expand activity.

2072

Flow Builder - Order Tracking steps

Implementation

Follow these steps to build a custom Order Tracking activity.

  1. Enter a product ID request step.
    1. Add a match regular expression condition to match id to API.
    2. Add a back-to-menu condition
    3. Add a fallback step
    4. Add custom LUA code for external API. The API will function with HTTP.GET().
2616

Flow Builder - Track order step

  1. Enter system wait step.
    1. Add a go-to condition to move to the next step.
2600

Flow Builder - Wait step

  1. 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.
2686

Flow Builder - Script track step

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
1910

Flow Builder - test