Callable Journey

Understanding the Quickwork. Quickwork is a no-code, API-based SaaS platform with pre-integrated apps to automate business workflows.

Callable Journey lets you call another journey within a current journey enabling the execution of both the journeys (the current and the called) synchronously or asynchronously, depending on your requirements. Callable journeys are similar to regular journeys except that they are called/triggered with the help of a call/event in the actions section of another journey instead of having a typical trigger event in the same journey.

Callable Journeys are usually used to replace a common set of actions that need to be repeated in many journeys. Using a callable journey enables a user to write those actions down once and use them wherever needed. This reduces the complexity of building lengthy journeys and makes understanding easier.

Advantages:

  • Easy understanding: Breaks down a long journey into a series of steps and clubs the standard set of actions into a single journey. Later, call that common journey in other journeys whenever those standard sets of actions are required. Thus the complexity of length gets reduced.

  • Easier to test: By grouping a similar set of actions instead of calling them repeatedly, one can test a journey more precisely.

  • Quick sharing across journeys: By using callable, one can create journey A, say for error policy, and then call it in other journeys B, C, and D and create a centralized error notification system. This will reduce redundancies and save time for the users.

Figure 1: Callable Journey execution mechanism

Use case

"Whenever a manager specifies the employee name on Quickwork Chat, check the employee's daily task status recorded in a designated sheet and send a message with details of the same. If the name entered is correct and the record is present, then reply with the exact number of tasks in the open, in progress, and done stages of that employee. Else, reply with a message saying that the record for the name entered could not be found.

To get this use case done, two journeys (a parent journey and a child journey) are to be built and executed asynchronously. Let's begin!

Creating a Google Sheet record

First of all, let's have a Google Sheet containing a sample record of a few employees' daily tasks:

Figure 2: Google sheet record

The name of the sheet is Daily Task Sheet. We'll be parsing this sheet and its header elements such as User, Open, InProgress, and Done to the action fields of the journey we create.

Configuring the child journey: Daily Tasks Callable Journey

‌Let's configure our callable journey first so that we can call it later in our other journey.‌

Configuring a Callable Journey's trigger

Go to Quickwork and create a new journey, say Daily Tasks Callable Journey. Let's start configuring the trigger:

  1. Search and select the Callable journey option in the App field drop-down displayed right below the New Trigger block.

  2. Select the New Call trigger event from the Triggers list right next to the Apps drop-down menu.

  3. In the Name field, provide the name for this journey i.e., Get daily tasks in this case. Note: Input provided in the Name field becomes the actual name of the child journey.

  4. In the Request Type field, select application/json. Repeat the same for the Response Type field too.

  5. Provide a sample JSON input in the Input field. E.g., {"User": ""}. Note: Sample JSON is a syntactical structure in which you want to get the response. For string data {"user": "A"} and for integers {"User": 1}

  6. Similarly a sample JSON output in the output field. E.g., {"UserFound" : "", "User" : "John", "Open" : 2, "InProgress": 1, "Done": 1}

Figure 3: Configuring the Callable Journey-New call trigger

Configuring Google Sheets action

To do so, follow these steps:

  1. Under the Steps section, click on the Simple Action button. Choose the Google Sheets app from the drop-down menu in the App field.

  2. Select the action, Search cell using query, from the drop-down menu in the Actions field.

  3. For authorization, select an existing account or create a new account to authorize and connect Google Sheets. If you are not logged in to your Google Sheets account, you will be asked to do so.

  4. Once a connection is created, the following fields will open up in which you need to enter the following details:

    1. Select the spreadsheet, Daily Task Sheet, under the Spreadsheet drop-down field.

    2. In the Query String field, type Select * Where B=' ' This query will operate on the User column in the Google Sheets.

    3. Specify the same sample response in the Sample response field as provided for the trigger i.e., {"UserFound" : "", "User" : "John", "Open" : 2, "InProgress": 1, "Done": 1}

    4. Select Sheet 1 for the Sheet field:

Figure 4: Configuring the Google Sheets action

Using If Else condition‌

To continue configuring the journey, click the Add a step button (+ icon) and click on the Business Logic button. Then, select the If Else Condition block. You'll get a tree-structured if...else block where you need to specify the if condition and configure the required actions.

In the Left Value field and pass the data pill from the Data Tree Output of the Google Sheets action.

Select the Greater than condition from the drop-down menu in the Condition field. In the Right Value field, enter 0 as the filter keyword. Once successfully done, your If Condition block will look like the following screenshot with a heading as if rowsCount greater than 0:

Figure 5: If Condition

The If condition we have specified here ensures the count of the rows in Google Sheets should not be 0, otherwise the journey will directly jump to the Else condition.

Configuring the action under If block

To configure this, follow these steps:‌

  1. Choose the Callable Journey app from the drop-down menu in the App field.

  2. Select the action, Return Response, from the drop-down menu in the Action field.

  3. Select Success in the Response type drop-down menu field and type Yes in the User Found field.

  4. Now pass the relevant data pills to each relevant input field as shown in the following screenshot:

Figure 6: Callable Journey action under the If block

When the If condition is satisfied, the journey will execute this block and respond to the user accordingly.

Configuring action for else condition

If the column field value is equal to 0 i.e., there's no user record in the Google Sheet, then the action defined in this block will execute. Take a look at the following steps to configure:

  1. Choose the Callable Journey app from the drop-down menu in the App field.

  2. Select the action, Return Response, from the drop-down menu in the Action field.

  3. Select Success in the Response type drop-down menu field and type No in the User Found field.

  4. Here, you don't need to pass the relevant data pills to each relevant input field:

Figure 7: Configuring the Callable Journey under the Else block

Once you are done configuring these actions, your child journey structure will look something like this:

Figure 8: The child journey

Now, save and start this journey. This journey acts as a repository that you can call into other journeys without adding the same steps again and again that this journey includes.

Configuring the parent journey

To get the automation-ready as per our use case, we will be configuring the Quickwork Chat trigger, its action under If Else condition, and then call the child journey Get Daily Tasks.

Configuring the Quickwork Chat trigger

To start configuring a Quickwork Chat trigger, you need to first create a human agent service named Demo and deploy it on a webpage successfully. Click here to know more.

Now, create the parent journey and name it as Send message on QC. To begin configuring this journey, follow the steps given below:

  1. Choose the Quickwork Chat from the Apps drop-down menu given right below the New Trigger button.

  2. Select the trigger event, New text message, in the Trigger Event field.

  3. Connect Quickwork Chat by either selecting an existing connection from the drop-down or by creating a new connection. To create a new connection, follow these steps:

    1. Click the Link Account button.

    2. The Connect to Quickwork Chat window will pop up. Enter the Connection Name, API Key, and the Inbox ID respectively.

    3. Click the Link Account button. Your connection is now established.

    4. Now click on the input of the Event field and write a name for the event whenever a new text message is received.

    5. The journey builder will return a Webhook URL that looks somewhat like this: https://automation.quickwork.co/staticwebhook/api/quickwork_chat/notify?

    6. Copy it. Now go to the Quickwork Chat support panel and enter the settings window or simply click here and select your inbox to edit its settings.

    7. Navigate to the Webhook section with the help of the top navigation bar and add the webhook copied and click on the Save Changes button:

Figure 9: Configuring Quickwork Chat trigger

Configuring the ask employee name action

In this step, we will ask the user for the name whose record needs to be checked. For this, we will be using the Ask question action of the Quickwork Chat app:

  1. First, choose Quickwork Chat as the app from the drop-down menu in the App field.

  2. Now select the Ask Question action from the drop-down menu in the Action field.

  3. In the User Question field, you need to type the question you want to ask. In our case, we can add something like: Enter the name of the employee whose record you want to check.

  4. Now select Text as the Answer Type as we expect the answer to be in simple and plain text format.

  5. For Conversation ID, we need to add the Conversation ID we receive in the Data Tree Output of our trigger.

  6. The Retry help field is to display suggestions whenever the user enters an invalid answer. Here we can add something like Enter a valid name to match our use case:

Figure 10: Configuring Quickwork Chat-Ask employee action

Calling the child journey

This is a crucial part of the journey in terms of execution. Follow these steps:

  1. Click on the Add a step button (+ icon) and then click on the Simple Action button to add a new simple action.

  2. Choose the Callable Journey app from the drop-down menu in the App field.

  3. Select the Call journey action from the drop-down menu in the Action field.

  4. The name of the child journey we created will automatically appear in the Name drop-down menu. Select Get daily tasks. Note: Ensure the child callable journey is in the execution state. If not, the name will not appear in the drop-down list.

  5. The execution of both the journeys should be synchronous, i.e., the parent journey will start its execution only when the child journey execution finishes. Hence, select No from the Asynchronous drop-down field.

  6. In the Child Journey Input field, drag and drop the data pill from Quickwork Chat's Ask question action output:

Figure 11: Configuring Callable journey to call the child journey

‌Using If Else condition

To progress configuring the journey, click the Add a step button (+ icon) and then click on the Business Logic button. Then select the If Else Condition block. You'll get a tree-structured if...else block where you need to specify the if condition and configure the actions.

Now, in the Left Value field, add the User Found data pill by clicking on the Callable Journey action under the Data Tree Output window on the right-hand side of the automation builder.

Select the Equals condition from the drop-down menu in the Condition field. In the Right Value field, enter Yes as the filter keyword. Once successfully done, your If Condition block will look like the following screenshot with a heading as If UserFound equals Yes:

Figure 12: If Condition (parent journey)

‌Configuring Quickwork Chat action under If Condition

  1. Click on the Please choose an action bar.

  2. Choose the Quickwork Chat from the App field drop-down menu.

  3. Select the trigger event, Send text message, in the Action field.

  4. In the Message field, type type the message as shown in the screenshot below and drag and drop the data pills from the Data Tree Output of the callable action as shown here:

Figure 13: Message syntax

‌ 5. In the Conversation ID field, pass the Conversation ID data pill from the Quickwork Chat's New text message trigger output:

Figure 14: Quickwork Chat action under If Condition block

Configuring Quickwork Chat action under Else condition

  1. Clone the Quickwork Chat action configured under the If condition and place it under Else.

  2. Specify No Record Found under the Message field and pass the Conversation ID data pill in the Conversation ID field from the Quickwork Chat's New text message trigger output:

Figure 15: Quickworj Chat under the Else block

Once you have completed configuring the actions, your complete journey will look like this:

Figure 16: The parent journey

Executing the journey

Save your journey changes and click the Start & Save button. Now, go to the Quickwork Chat widget on your customized webpage.

Here, we will perform A/B testing to know the accuracy of the Callable Journey execution. First, we will specify a valid user name to QW Chat whose record is saved in the Google Sheets. Second, we will specify an invalid user name to see how callable journey responds.

Execution on valid input

In the Quickwork Chat window, type John as a user name. You'll get its task details as per the Google Sheets record:

Figure 17: Quickwork Chat positive response

To get the insights into this execution, go to the History tab of both the journeys (parent and child) and click on the latest execution statuses. Switch between input and output tabs of events and actions to get a clear idea about the flow of data from one step to another.

Execution on invalid input

In the Quickwork Chat window, type Bill as a user name. You'll get a negative response as its details are unavailable in Google Sheets:

Figure 18: Quickwork Chat "user not found" response