Lesson 4A - Absolute References
One type of reference is an absolute reference. The easiest way to understand an absolute reference is to see it in action.
Here's an example that sets the startup object for a flow using an absolute reference:
inboundCall:
name: Archy Demo
defaultLanguage: en-us
startUpRef: /inboundCall/menus/menu[startingMenu] <-- this absolute reference
initialGreeting:
tts: Hello, this is the initial greeting.
menus:
- menu:
name: Main Menu <-- points to this menu
audio:
tts: You are at the Main Menu, press 9 to disconnect.
refId: startingMenu
You can build a reference string to an object by walking the YAML from the YAML's root and generate a path to the object you want to reference. The rules are simple when building a reference string:
- When accessing an item in an array, to specify the item within the array you need to supply both the item type as well as the item's reference identifier value. To do so, you add
/<item_type>[<item_reference_id>]
notation to the reference string. - When accessing a property that is an object, you add
/<property_name>
to the reference string.
Using the two rules above, here are the steps that we performed to build out the reference string that refers to the 'Main Menu' menu:
Step 1. Reference: '/inboundCall'
We start by accessing the inboundCall property from the root.
Step 2. Reference: '/inboundCall/menus'
Next we access the menus property.
Step 3. Reference: '/inboundCall/menus/menu[startingMenu]'
Finally, within the menus array we want to find a 'menu' object whose refId
property is 'startingMenu'.
This type of reference is called an absolute reference
because it specifies a full path for Archy to traverse starting from the YAML root. Absolute references are easy to identify because they start with a '/' at the beginning.
OK, now you try building an absolute reference. For this inbound email flow YAML:
inboundEmail:
name: Default Inbound Email Flow
defaultLanguage: en-us
startUpRef: ??? <-- what is the reference string we should
states: use here?
- state:
name: Initial State <-- if we want to reference this state
refId: initialState
actions:
- disconnect:
name: Disconnect
Hint: You're going to use the 'initialState' refId value.
Answer: /inboundEmail/states/state[initialState]
Tutorial Main | Previous Lesson | Next Lesson
Archy - Ver. 2.33.1, generated on January 3, 2025