Skip to content
Noah Petherbridge edited this page Feb 24, 2017 · 11 revisions

Welcome to the RiveScript Community Wiki!

This wiki is a place for the community to share snippets, tutorials, and examples of how to do things in RiveScript. For the most part this Wiki is programming language agnostic, but instead demonstrates concepts and how-to's for developing chatbots with RiveScript.

Contributing

See How to Contribute for guidelines on where you should put your update on this wiki.

Architecture and Background

  • RiveScript's Original Niche - History about RiveScript's design decisions, how it was written during a 'simpler' time of chatbots and why it had difficulty adapting to modern Facebook Messenger style bots, and recommendations for those who want to use it for modern bot development.

Design Patterns

These are universally good tips on how to structure your chatbot's code efficiently. These include programming language example sources for the application side of a RiveScript bot, but their lessons are applicable to all implementations of RiveScript.

  • Make a Single Shared Bot Instance - Instead of writing an app that has to completely load your RiveScript bot from scratch on every request, consider using one shared global instance that can be shared across many requests over the lifetime of the application.
  • Preserving the Original Message - In case you need access to the user's original, untainted message (with capitalizations and symbols left intact), i.e. for use in an object macro.

Security

If you're loading untrusted RiveScript source code into your bot (for example, you're developing a bot hosting platform where users can upload their own RiveScript sources), there may be some security implications to be aware of:

  • Disable Object Macros - Allowing untrusted users to run arbitrary program code is an obvious security vulnerability. Many of the RiveScript implementations support object macros by default, so learn how to disable them to tighten security.

RiveScript Snippets

  • New User Interview - Program your bot to ask new users a series of questions (for their name, age, gender, etc.) upon first meeting them.

JavaScript snippets