Step
A step is the basic component of a USSD application in USSDK. Steps are connected to each other to create a user journey. When you start a new project, you’re faced with an @entry
step. To create a step, simply drag from a socket and drop unto an empty space. Editing/configuring a step is done in the panel on the right under the Step
tab.
In this part of the documentation, we’re going to describe the anatomy of a step.
Anatomy of a step
Message
This is the message you want to show to the user. It can be interpolated using handlebars. For example you can enter the following message:
Welcome, {{user_name}}! What would you like to do today?
Exciting yet?
Okay, what happens to {{handlebars}}
? They get populated with values from your hook. We will soon learn about hooks. When you provide handlebars in your message, you’ll be required to set their possible max-length. This is so that the final message length can be calculated to not exceed the limit imposed by providers.
Menu
Populate the list of options here. You can also use handlebars for menu item messages. And yes, the values get populated from your hook.
Note
You need to provide at least a message or menu for each step. You’ll find a warning in the Info tab when you’ve forgotten to provide at least either.
You may not be able to deploy an app that has not addressed pending problems
Hook
A hook (short for hook url) is an endpoint that is called before a step is rendered. The hook should return a JSON encoded response. Any key name specified in handlebars (in messages or menu items) will be used to extract values from your response. See /docs/hooks for more details on this topic.
Preview
As you compose a step, a preview is rendered at the bottom of the step panel. This gives you an idea of how a prompt will look like. Saves you the time of