States

What’s a State?

In a scenario every step is called as state. You can put your actions into state and then when an user arrives that states, actions specified in state is ran. State is not just a wrapper for actions but also a position of individual user/session. Each event has a unique key called sessionId. When the event arrives to scenarios it may trigger state change. So this means session attached to scenario is in that state now, actions specified in that state should run.

Example

For example, you can have a scenario to send welcome emails to registered customers. Incoming register event with sessionId=John is triggering state change and move John into welcomeState which has sendEmail action inside. After transition completed, email have been sent and now John is waiting in welcomeState.

If you have another event like accountClosed to send bye email aka missYou action in goodbyeState. If the incoming accountClosed event has sessionId=John, transition will be happening from welcomeState to goodbyeState and John will be get goodbye email. But if accountClosed has another session like sessionId=Mellisa, nothing will happen for session John, it means it’ll keep staying in welcomeState.

Creating Your First State

State creating is really simple. Just go scenario page and select the scenario you want to add state and then click editor link on top.

Create State