Sample use case on callable journeys: Efficient order management

This section demonstrates building a callable journey through a sample use case.

Callable journeys can be configured to run either synchronously or asynchronously, depending on the operational requirements. Synchronous execution ensures that the parent journey waits for the completion of the child journey, and is ideal for tasks that depend on the outcome of the called journey. Asynchronous execution, on the other hand, allows both journeys to run independently, which is suitable for parallel task processing.

In the previous section, we understood callable journeys and a scenario where a parent journey is initiated by customer messages via WhatsApp by Gupshup. This journey first extracts the order ID and determines the nature of the customer's request- whether it's for an email change or an update on shipment status. Based on the type of request identified:

  • Child (callable) journey 1 is called if the request pertains to an email update. This journey manages address modifications within Shopify.
  • Child (callable) journey 2 is activated for requests related to shipment status. This journey is tasked with fetching and displaying the shipment information to the customer directly through WhatsApp from Google Sheets.

Building and configuring the child journey is essential before creating the parent journey.

Prerequisites

  • An active WhatsApp by Gupshup account is needed to set up the initial parent journey trigger based on customer messages. Ensure that the account is properly set up to send and receive messages.

  • Access to a Shopify (Private app) account to enable the modification of customer details directly from the journey.

  • An operational Google Sheets account for accessing spreadsheet data related to orders.

Child journey 1 configuration: Address update within Shopify

  1. Select Callable Journey as the trigger app and New call trigger event. A callable journey trigger is mandatory for initiating a child journey.
  2. Enter the name of the callable journey in the Name input field. In this case, it's named Child-Shopify. (It is a good practice to have the journey name the same as in the Name field. This name is used to identify and call this journey from other parent journeys).
  3. For both the Request type and Response type, select application/json. This setting dictates that the data exchanged between the parent journey and this callable (child) journey will be in JSON format, which is standard for handling data in web services.
  4. Configure input and output:
    1. Input: Provide a sample JSON structure that this callable journey expects to receive when called by the parent. For instance, the sample input provided, {"Order ID":"01001","Email":"[email protected]"} suggests that this journey requires an order ID and an email address to process something specific in Shopify.
    2. Output: This field should be configured with the JSON structure expected to be returned by this journey upon completion. It must match the data requirements of the parent journey to ensure seamless continuation of the process. In this scenario, we will leave it empty as no data is returned to the parent journey. The values defined here act as data pills for other actions.
  1. Configure the action:
    1. Choose Shopify (Private App) as the app from the drop-down menu and select Update order as the specific action to perform.
    2. Link the Order ID data pill from the Data Tree Output. This is the identifier for the order that you want to update in Shopify.
    3. Input the Email data pill also from the Data Tree Output. This should be the email ID to be updated.
  1. Save & start the journey. To call a child journey from a parent journey, ensure that the child journey is in execution.

Child journey 2: Shipment status retrieval

  1. Go to journey configuration manager and click + Create Journey.

  2. Select Callable Journey as the trigger app and New call trigger event. Callable journey trigger is mandatory for initiating a child journey.

  3. In the Name input field, enter the name of the callable journey. In this case, it's Child-Google Sheets.

  4. For both the Request type and Response type, select application/json.

  5. Configure input and output:

    1. Input: The Input field shows an example JSON object {"OrderID":"O1001"}, representing the data structure that this journey expects to receive from the parent journey.
    2. Output: The Output field contains a JSON object {"Message":"John"}, representing the data structure that this journey will return upon successful execution. This output can then be utilized by the parent journey for further actions or processing.
  6. Set up Google Sheets action:

    1. This configuration in Quickwork uses the Google Sheets app to perform a search within a specific spreadsheet. The action chosen is Search cell using query, which allows querying specific cells in the Order details spreadsheet. This setup enables targeted data retrieval based on structured queries.
    2. Query string: The Query String with value select * where A=’{Order ID}' is used to search for cells. This query dynamically replaces Order ID data pill with actual order IDs provided during the journey's execution. This field will search for rows where column A of the spreadsheet matches the order ID extracted from the journey trigger.
    3. Sample Response: In the Sample Response field, specify the column names of Google Sheets in JSON format, {"Order ID": "Leanne Graham", "Status": "Sent" }. The column names defined here act as data pills for other actions.
    4. Select or enter the Sheet Id.
  7. Define business logic using Foreach loop:

    1. The loop is configured to process each row of data returned from the initial Google Sheets search. For every individual row (or data entry), the journey will execute the defined actions within the Foreach loop.
    2. This ensures that each piece of data is handled independently according to the journey’s logic.
  8. Response configuration:

    1. Set up the journey to return the status of the shipment to the parent journey, which will then relay this information back to the user via WhatsApp by Gupshup.
    2. The Return response action within a Callable Journey is configured to return a response based on the outcome of a journey. The Response type option is set to Success, which means the journey will send a success response when it executes without errors. The Message field is populated with data from the Status data pill derived from a previous step, allowing the journey to send this status information back to the calling (parent) journey.

  9. Save & start the journey

Parent journey configuration

  1. Set up the trigger:

    1. Open Quickwork and create a new journey.
    2. Select WhatsApp by Gupshup from the Apps drop-down and choose the New text message trigger event.

    1. Connect to WhatsApp by Gupshup by authenticating and linking your account.
  2. Define input query action:

    1. Add a step to ask the customer to enter the choice. Choose WhatsApp by Gupshup and select the Ask Question action.
    2. In the Question field ask the customer to enter the choice.
    3. Set the Answer type to Number, assuming the answer is numeric and enter a suggestion to a user who has entered an answer in an incorrect format to the question asked.
    4. Ask the customer to enter the order ID.
  1. Define conditional check: This step evaluates whether the user's response equals 1. It acts as a decision point in the journey.

    1. If the condition is true (the user inputs 1), the system prompts the user to enter their new email ID via WhatsApp by Gupshup. This step ensures data collection directly through WhatsApp.

      1. Add a step to call the child journey 1. Select Callable journey app and choose Call journey action.
      2. From the drop-down, select the name of the child journey that manages address modifications within Shopify.
      3. Select Asynchronous as Yes. This setting determines if the called (child) journey and the current journey should run concurrently or not. If set to Yes, both journeys will operate in parallel. If set to No, the called (child) journey must complete before the current journey continues its execution.

      📘

      When executing a child process in synchronous mode, both the parent and child processes share the same memory space. This setup increases the likelihood of reaching the memory limit compared to asynchronous execution, where each process is allocated its own dedicated memory. Hence, avoid retrieving large datasets in synchronous mode due to the shared memory constraint, as this can lead to memory overflow issues.

    2. If the user's response does not equal 1 (handled by the Else condition), child journey 2 Child-Google Sheets is called.

      1. This journey could be configured to perform different tasks, such as retrieving information in Google Sheets based on the user’s input.
      2. Asychronous is set to No as the outcome of the child journey is essential for the parent journey to continue.
    1. To display the shipment, add a step to send a message. Choose WhatsApp by Gupshup and select Send message.
    2. In the Message field, configure the message to display shipment status using data pills from the callable journey's output.
    3. Ensure the Sender Id data pill from the initial trigger is passed correctly to maintain the conversation thread.
  2. Execute the journey:

    1. Save & start the journey.
    2. Test the journey by entering a choice, say 2, and order id, in the configured Whatsapp by Gupshup. The shipment status is displayed.

Troubleshooting

  • Test input data: Make sure the input data being passed to the callable journeys matches the expected formats. Incorrect data types or formats can result in unexpected behavior or errors.
  • Cannot see the child journey in the list in the parent journey: Ensure that the child journey is in the execution state.
  • Review JSON structures: Ensure the JSON input and output structures in the callable journeys are correctly defined and match the requirements of the parent journey.

✏️ Tips and recommendations

  • Test each journey component (triggers, actions) independently before integrating them into the full journey. This helps isolate and fix issues more efficiently.
  • Ensure the name of the child journey is same as the name you provide in the Name field. In case the names are different, the child journey may not show up in the list of callable journeys while building the parent journeys.

📚 Additional resources

Concept of callable journey API management overview JSON format documentation Query language reference