Best Practices

Funnel Your Users Through Topics With Buttons

Avoid Repeating Yourself

Smart Substitutions

Resetting The Bot Flow

Easter Eggs

Funnel Your Users Through Topics With Buttons

Buttons are an incredibly powerful tool to ensure that your users go through your bot's experience in the way that you envisioned. Giving users explicit options via buttons leaves less room for error—and less room for your bot to seem confused or unable to handle a situation.

We recommend transitioning to a new topic right after you present users with buttons. In this new topic, create triggers that correspond to each of your button options, and have a catch-all trigger that repeats the options.

A good example of this is for a "help" use case. When a user asks for help, give them a list of options so they are not confused, and have specific triggers for each option. For example in a default topic you may have:

+ [*] help [*]
- How can we help you? ^buttons("Operating Hours", "Services", "Prices", "Go Back") {topic=help}

And in your "help" topic:

+ operating hours
- We are open 24/7. ^buttons("Operating Hours", "Services", "Prices", "Go Back")
 
+ services
- We provide a wide variety of services, ranging from doodads to thingamajigs.  ^buttons("Operating Hours", "Services", "Prices", "Go Back")
 
+ prices
- Our policy is name-your-own-price! ^buttons("Operating Hours", "Services", "Prices", "Go Back")
 
+ go back
- Going back to the default topic! {topic=default}
 
+ *
- I'm sorry, I didn't quite understand what you said. How can we help you?  ^buttons("Operating Hours", "Services", "Prices", "Go Back")

Avoiding Repeating Yourself

The example above would be much nicer if you didn't have to keep writing the ^buttons() direction over and over—changing the options would be huge pain. There is a way to avoid repeating yourself by using the @ sign to redirect and append the response of the help trigger. The following will produce the same results as the "help" topic above:

+ operating hours
- We are open 24/7. {@ help}
 
+ services
- We provide a wide variety of services, ranging from doodads to thingamajigs. {@ help}
 
+ prices
- Our policy is name-your-own-price! {@ help}
 
+ go back
- Going back to the default topic! {topic=default}
 
+ [*] help [*]
- ^buttons("Operating Hours", "Services", "Prices", "Go Back")
 
+ *
- I'm sorry, I didn't quite understand what you said. How can we help you? {@ help}

The {@ help} tells your bot to also include the response for help at that point in its response.

Smart Substitutions

A smart substitution can go a long way. Make use of the Rivescript sub concept to replace words the user says with substituted text before matching against triggers.

! sub jimmy = jim
! sub jimster = jim
! sub james = james
! sub jimmyjim = jim
! sub jamie = jim
! sub jimbo = jim
! sub jdawg = jim
 
+ my name is jim
- Hi Jimbo! How are you today?

Resetting The Bot Flow

Both while you are developing your bot and occasionally when it is live, you might want to "reset" a user's experience with a bot and start them at the beginning of everything. We recommend having a few special triggers in your default topic that does this. Something like:

+ (restart|quit|start over|esc)
- Alright, I'm resetting everything I know about you and starting over. Say "hi" to restart. {topic=default} <set name> <set email>
Recall that using <set name> clears data associated with name.

Easter Eggs

We love easter eggs! While you're creating the conversational copy for your bot, it's not necessary for you to make all the triggers you’ve included in a topic known to the user. Bot users love trying to discover these easter eggs themselves.

+ are you [a] (human|bot)
- I’m as much of a <star> as you are!

Easter eggs are great because they show off your brand or company's personality. Just like the small talk you may have with a bank teller or a customer service representative on the phone, the dialogue you draft for your bot can leave a user smiling and make the entire conversation more fun and engaging.