npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@nqkdev/botpress-rivescript

v2.1.0

Published

Simple scripting language for chatbots with a friendly, easy to learn syntax

Downloads

4

Readme

botpress-rivescript

RiveScript is a simple scripting language for chatbots with a friendly, easy to learn syntax.

botpress-rivescript implements the RiveScript language as an incoming middleware and adds extra support for executing arbitraty code. Combining the simplicity of RiveScript and the flexibility of Botpress allows people to create very complex and rich dialogs, including sending Cards, Quick Replies, Buttons, Webviews, etc...

Supported connectors: botpress-messenger

Get started

botpress install rivescript

The rivescript module should now be available in your bot UI, and the APIs exposed.

Features

Multi-files

You can split your dialog into multiple Rive files. By default, two files are provided (star.rive and begin.rive), as advised by the official RiveScript documentation.

Conversation Simulator

There's a built-in conversation simulator so that you can test your scripts right from the interface. The simulator also supports JS Code execution, including asynchronous invocations.

Variable Injections

User Profiles

If provided, the content of the MiddlewareEvent['user'] is injected into the variables. For Facebook, first_name, last_name, timezone, locale, gender, avatar_url are available.

+ what is my name
- According to your facebook profile, your name is <get first_name> <get last_name>

Others

The platform is injected in the user variables as the platform name.

+ what platform am i using
- Your talking to me on <get platform>, silly!

And the original message from user input under text name.

+ *
- Your query: <get text>

Subroutines

wait MS

+ toc toc
- <call>wait 2000</call>who is there?

Running JS code in scripts

+ execute
- JS: console.log(rs, bp, event, send) // all available

+ log
- JS: bp.logger.info('Hello from RiveScript')

+ quick replies
- JS: bp.messenger.sendText(event.user.id, 'Buy?', { quick_replies: ['Yes', 'No'] })

To execute your own script, you can register it to bp then use it directly in rivescript

In your index.js

bp.hello = (bp, send) => {
  bp.logger.info('Will send from a custom script !')
  send('This is a reply !', { quick_replies: ['Yes', 'No'] })
}

In your rivescript

+custom
- JS: bp.hello(bp, send)

UTF-8 Support

You can enable UTF-8 input parsing by either one of these methods:

  • Set the RIVESCRIPT_UTF8=true environement variable
  • Call bp.rivescript.setUtf8(true) in your bot

Read more about RiveScript and its UTF8 support here

API

GET /api/botpress-rivescript/scripts

List all the scripting files and their content.

POST /api/botpress-rivescript/scripts

Create or replace a Rive scripting file. This will automatically trigger an Engine reload.

Body

{
  name: string, // *required*, the name of the Rive scripting file
  content: string, // *required*, the full content of the script, must be valid RiveScript language
  overwrite: boolean // defaults to *false*
}

Response

Status 200

DEL /api/botpress-rivescript/scripts/:name

Delete a scripting file. This will automatically trigger an Engine reload.

POST /api/botpress-rivescript/simulate

Simulate an incoming message into the RiveScript engine. Does not pass through the middlewares, goes directly to the RiveScript engine. Returns a response.

Body

{
  text: string // *required*, the text to send to the RiveScript engine
}

Response

"Hello, Human!"

POST /api/botpress-rivescript/reset

Restart a conversation from scratch, erasing all variables or previous conversational state.

Community

Pull requests are welcomed! We believe that it takes all of us to create something big and impactful.

There's a Slack community where you are welcome to join us, ask any question and even help others.

Get an invite and join us now! 👉https://slack.botpress.io

License

botpress-rivescript is licensed under AGPL-3.0