Callable Journey

Launch another journey using Callable Journey in sync or async. Develop a child-parent relation among two workflows where one calls the other.

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 Journey is 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.
638

Figure 1: Callable Journey execution mechanism


Use case

"Whenever a manager specifies the employee name on Conversation Management, 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:

619

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 Gupshup platform integration and create a new journey, say Daily Tasks Callable Journey. Let's start configuring the trigger:

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

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

  • 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.

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

  • 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}

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

768

Figure 3: Configuring the Callable Journey-New call trigger


Configuring Google Sheets action

To do so, follow these steps:

  • Under the Steps section, click on the Simple Action button. Choose the Google Sheets app from the drop-down menu in the App field.
  • Select the action, Search cell using query, from the drop-down menu in the Actions field.
  • 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.
  • Once a connection is created, the following fields will open up in which you need to enter the following details:
  • Select the spreadsheet, Daily Task Sheet, under the Spreadsheet drop-down field.
  • In the Query String field, type Select * Where B=' alt text ' This query will operate on the User column in the Google Sheets.
  • 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}
  • Select Sheet 1 for the Sheet field:
1164

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 alt text
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:

1482

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:‌

Choose the Callable Journey app from the drop-down menu in the App field.
Select the action, Return Response, from the drop-down menu in the Action field.
Select Success in the Response type drop-down menu field and type Yes in the User Found field.
Now pass the relevant data pills to each relevant input field as shown in the following screenshot:

1110

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:

  • Choose the Callable Journey app from the drop-down menu in the App field.
  • Select the action, Return Response, from the drop-down menu in the Action field.
  • Select Success in the Response type drop-down menu field and type No in the User Found field.
  • Here, you don't need to pass the relevant data pills to each relevant input field:
993

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:

1636

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 Conversation Management by Gupshup integration platform trigger, its action under If Else condition, and then call the child journey Get Daily Tasks.

Configuring the Conversation Management by Gupshup integration platform trigger

‌To start configuring a Conversation Management by Gupshup integration platform trigger, you need to first create a human agent service named Demo Callable Journey and deploy it on a webpage successfully. Click here to know how to create an inbox.

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

  • Choose the Conversation Management by Gupshup integration platform from the Apps drop-down menu given right below the New Trigger button.
  • Select the trigger event, New text message, in the Trigger Event field.
  • Connect to Conversation Management by either selecting an existing connection from the drop-down or by creating a new connection. To create a new connection, follow these steps:
  • Click the Link Account button.
  • The Connect to Conversation Management by Gupshup integration platform window will pop up. Enter the Connection Name, API Key, and the Inbox ID of the Demo Callable Journey inbox.
  • Click the Link Account button. Your connection is now established.
    1. Now click on the input of the Event field and write a name for the event whenever a new text message is received.
    1. Gupshup integration platform returns a Webhook URL as shown here:
  1. Copy it. Now go to Conversation Management and select the Demo Callable Journey inbox to edit its details. Navigate to the Webhook section with the help of the top navigation bar and paste the webhook URL.
  2. Checkmark all the options under the Event section. Click on the Save Changes button:

Configuring the ask question 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 Conversation Management app:
  • Click the Simple Action button. Choose Conversation Management as the app from the drop-down menu in the Apps list.
  • Now select the Ask Question action from the drop-down menu in the Actions list.
  • 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.
  • Now select Text as the Answer Type as we expect the answer to be in simple and plain text format.
  • For Conversation ID, we need to add the Conversation ID we receive in the Data Tree Output of our trigger.
  • 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
1444

Figure 11: Ask question action

Calling the child journey

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

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

  • Choose the Callable Journey app from the drop-down menu in the Apps list.

  • Select the Call journey action from the drop-down menu in the Actions list.

  • 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.

  • 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.

  • In the Child Journey Input field, drag and drop the Answer data pill from Conversation Management by Gupshup platform integration Ask question action output:

1449

Figure 12: Call journey action

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:

1449

Figure 13: If condition (parent journey)

‌##Configuring Conversation Management by Gupshup platform integration action under If Condition

  • Click on the Please choose an action bar.
  • Choose Conversation Management by Gupshup platform integration from the App field drop-down menu.
  • Select the trigger event, Send text message, in the Action field.
  • 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:
860

Figure 14: Message syntax


5. In the Conversation ID field, pass the Conversation ID data pill from the
Conversation Management by Gupshup platform integration New text message trigger output:

1463

Figure 15: Send text message action

Configuring Conversation Management by Gupshup platform integration action under Else condition

  • Clone the Conversation Management by Gupshup platform integration action configured under the If condition and place it under the Else block.
  • Specify No Record Found under the Message field and pass the Conversation ID data pill in the Conversation ID field from the Conversation Management by Gupshup platform integration New text message trigger output:
1452

Figure 16: Send text message under the Else block

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

1470

Figure 17: The parent journey


Executing the journey

Save your journey changes and click the Start & Save button. Now, go to the Conversation Management by Gupshup platform integration 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 Conversation Management by Gupshup platform integration window, type John as a user name. You'll get its task details as per the Google Sheets record:

819

Figure 18: The user found

To get insights into this execution, go to the History tab of both 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 Conversation Management by Gupshup platform integration window, type Bill as a user name. You'll get a negative response as its details are unavailable in Google Sheets:

819

Figure 19: User not found