X
X
Xip
Search…
State Naming
While Xip doesn't enforce any naming requirements for your states, we do recommend following the naming conventions outlined below. It provides continuity across your team and across bots.
Most of your states will fall into the say, get, and ask buckets. On the rare occasion that it does not, feel free to select a name that best describes the state.

Say, Ask, Get

Say

Say actions are for saying something to the user.
For example:
1
def say_hello
2
send_replies
3
end
Copied!
Typically we'd send the user to a new state, but sometimes it's as simple as just saying something like in the case of the end of a flow or conversation.

Ask

Ask actions are for asking something from the user.
For example:
1
def ask_weather
2
send_replies
3
update_session_to state: 'get_weather_response'
4
end
Copied!
In the above example, we've asked a question via send_replies and we've updated the session to a new state. This is the state that will be receiving the response. We'll cover state transitions in detail in the Sessions Overview section.

Get

Get actions are for getting and parsing a message from the user.
For example:
1
def get_weather_response
2
handle_message(
3
'Sunny' => proc { step_to state: 'say_wear_sunglasses' },
4
'Raining' => proc { step_to state: 'say_dont_forget_umbrella' }
5
)
6
end
Copied!
In the example above, we're handling two responses by the user. When they say "Sunny" or "Raining". Don't worry too much about the format of handle_message. We cover its usage in the handle_message docs section.
Last modified 9mo ago
Copy link