Advanced lesson: Task editor and Expression Help
Architect’s task editor helps you group the related steps of a more comprehensive process. In many cases, you’ll use expressions to build these complex call flow calculations. Architect also offers a concentrated, comprehensive list of elements to assist you with expression building. We’ll explore some of these areas in this lesson.
Here, we want to build a task sequence that determines the following information about the current call:
- Time of day (morning, afternoon, or evening)
- Caller’s name
- Current day of the week
Next, we want the system to play the information back to the caller in the form of an audio sequence. When the caller enters the flow, he or she hears “Good [morning, afternoon, or evening], [name of caller]. Today is [day of the week].” Additionally, Friday callers will hear about Saturday’s new operating hours with this message: “A friendly reminder that our hours of operation for Saturday have changed. If you need to reach us tomorrow, we will be available from nine until noon.”
Objectives
Create a task that collects information for and about the current call, and plays that information back to the caller
Estimated time to complete: 40 minutes
Additional resources
Tasks
- From the Architect Home page, click the Inbound Call Flows tab.
- Add a new inbound flow, including a unique name and, optionally, a short sentence or phrase to further describe this call flow. In our example, we name the inbound call flow Weekday.
- Create a new Reusable Task and set it as the starting task.
- Name the task Day of the week.
- For the Initial Greeting, optionally record a prompt or add TTS to greet the caller.
- Click Edit Task.
Begin building the starting task by adding audio to the task, then create a decision action that directs the flow to pull the current day of the week from a string collection.
- Drag a Play Audio action into the task editor and title it Initial audio.
- Record a prompt or add TTS to greet the caller:
Thank you for calling.
- Drag a Decision task below the Play Audio task, and then drag an Update Data action below the Decision action’s No path.
- Name the Update Data action Days of the Week.
- Click the arrow at the end of the Add update statement drop-down list and do the following:
- Click Create Collection.
- Select String Collection.
- In the Variable Name box, type Flow.DaysOfTheWeek.
- In the Value To Assign box, click + String.
- In the Item box type Sunday.
- Repeat step 7 to add the remaining days of the week.
Your collection should look like this:
Here, continue the sequence by adding an Update Data action to retrieve the current day from the call.
- Drag an Update Data action below the Days of the Week Update Data action.
- Name the action Today.
- Click the arrow at the end of the Add update statement drop-down list, select String, and do the following:
- In the Variable Name box, type Flow.Today.
- In the Value To Assign box, switch to expression mode and open the large expression editor. The Edit ‘Value To Assign 1’ expression dialog box opens.
- Begin typing Get. A list of available functions appears in a drop-down list.
- Assume you are not sure exactly which expression to use here and in the drop-down list click the ? next to GetAt. The Expression Help opens, and we see that this particular function retrieves an item at a specific location in a collection. This looks like the function we want to use. You can optionally learn more about it by expanding the Implementation section for more details and examples of use.
- When finished, click X in the upper right corner to close the Expression Help.
- Back in the ‘Edit Value To Assign 1’ expression dialog box, finish typing GetAt and press Enter. Notice that the cursor is positioned inside the set of parentheses.
- Ensure the cursor is positioned inside the GetAt parentheses, begin typing Flow., and select Flow.DaysOfTheWeek from the list that appears.
- With the cursor positioned just before the close parenthesis, add a comma and begin typing DayOf. Notice the list of options available in the drop-down list.
- To confirm that you choose the correct function, click the ? next to DayOfWeek. The Expression Help opens, and we see that this particular function obtains the day of the week from the supplied value.
- In the Expression Help, expand the Integer section for more details and examples. This looks like the function we want to use.
- When finished, click X in the upper right corner to close the Expression Help.
- Back in the ‘Edit Value To Assign 1’ expression dialog box, finish typing the DayOfWeek() function.
- With the cursor positioned just before the two close parentheses at the end of the expression, begin typing Flow. and select Flow.StartDateTimeUtc from the list.
- Click Close.
Your final expression should look like this:
GetAt(Flow.DaysOfTheWeek, DayOfWeek(Flow.StartDateTimeUtc))
Next, continue the sequence by adding an Update Data action that directs the system to collect the time of day:
- Drag an Update Data action below the Today Update Data action.
- Name the action Time of Day.
- Click the arrow at the end of the Add update statement drop-down list, select String, and do the following:
- In the Variable Name box, type Flow.TimeOfDay.
- the Value To Assign box, switch to expression mode and open the large expression editor. The Edit Value To Assign 1′ expression dialog box opens.
- Begin typing If. A list of available functions appears in a drop-down list.
- Optionally click the ? next to the If() expression in the list to open the Expression Help. Here, you can explore the function details and expand the implementations and, when finished, click X to close the Expression Help.
- Back in the ‘Edit Value To Assign 1’ expression dialog box, finish typing the If() function.
- With the cursor positioned inside the If parentheses, begin typing Hour and select Hour() from the list that appears.
- With the cursor positioned just before the two close parentheses, begin typing Flow. Notice the list of options available in the drop-down list.
- Select Flow.StartDateTimeUTC.
- Continue the expression so that if the hour is less than 12, the system will read as morning hours. If the hour is less than 17, afternoon or evening.
- With the cursor positioned just inside the last close parenthesis, type <12, "Morning",.
- With the cursor positioned between the last comma and the last close parenthesis, type if(Hour(Flow.StartDateTimeUtc).
- With the cursor positioned just inside the last two close parentheses, type <17,"Afternoon","Evening".
- Click Close.
Your final expression should look like this:
If(Hour(Flow.StartDateTimeUtc) < 12, "Morning", if(Hour(Flow.StartDateTimeUtc) < 17,"Afternoon", "Evening"))
Create the audio sequence that informs the caller of the date and time, depending on collected data.
- Drag a Play Audio action below the Time of Day Update Data action and name it Greeting.
- In the Audio box, click the audio sequence editor button and do the following:
- In the Text To Speech box, type Good.
- Click the Add Data button and in the Data box type Flow.TimeOfDay.
- Click the arrow at the end of the Select Options drop-down list and select Text to speech.
- Click the Add Data button and in the Data box type Call.RemoteName.
- Click the arrow at the end of the Select Options drop-down list and select Text to speech.
- Click the Add TTS button and in the Text to Speech box type Today is.
- Click the Add Data button and in the Data box type Flow.Today.
- Click the arrow at the end of the Select Options drop-down list and select Text to speech.
- Click Close.
Set up the path to take when the system detects if the next day is Saturday and if so, play Saturday hours to the caller. Then complete the task.
- Drag a Decision action into the task editor below the Greeting Play Audio action and title it Is tomorrow Saturday?.
- In the Expression box, switch to expression mode, remove the True text, and type Flow.Today=="Friday".
- Drag a Play Audio action below the Is tomorrow Saturday? Decision action’s Yes path and title it Play Saturday Hours.
- In the Audio box, record a prompt or add TTS to inform the caller of Saturday hours:
A friendly reminder that our hours of operation for Saturday have changed. If you need to reach us tomorrow, we will be available from nine until noon.
- Drag a Jump to Menu action into the last space at the bottom of the task editor.
- Select Main Menu, then validate and save or publish the flow.
Practice
Now it’s your turn. Try creating a similar experience in your own environment. For example, you might set up a greeting specific to play to callers during a particular month, such as “Seasons Greetings” in December. Or you might inform callers of seasonal hours, such as summer hours in July. For additional assistance, refer to the corresponding task instructions and the supporting video.