new event method: .match()

Until now, your CSML code might have looked something like this:

say Question(
  "What is your favorite car?",
  buttons=[
    Button("Ferrari") as ferrari,
    Button("Lamborghini") as lambo,
    Button("Mercedes") as merc,
    Button("BMW") as bmw,
    Button("Lada") as lada
  ]
)
hold

if (event match ferrari) remember car = "Ferrari"
else if (event match lambo) remember car = "Lamborghini"
else if (event match merc) remember car = "Mercedes"
else if (event match bmw) remember car = "BMW"
else if (event match lada) remember car = "Lada"
else say "Wrong input"

which is both repetitive and unelegant.

We just introduced a new event method, .match(), that takes any number of arguments and returns the first one that does match (or Null if there is none). This makes the same code very much more readable:

do matched = event.match(ferrari, lambo, merc, bmw, lada)
if (matched) remember car = matched.title
else say "Wrong input"

We now recommend that you use this new feature instead of the old "match" keyword, but of course the old keywords stays 😉

Added documentation about the Event

We have heard that it is sometimes unclear how event works in CSML, and we have also seen that many people don't use it to its full potential. Event is a very powerful but somewhat magical CSML object, and can help you with many things!

We just added a full documentation page to explain better the inner workings of the event object: https://docs.csml.dev/language/the-event

Hope this helps! 🤗

CSML Engine - self-hosted server edition

You can now deploy CSML as a self-hosted web server. CSML Server is the easiest way to spin up a CSML Engine instance in your own environment, be it offline, on-premise, in your own cloud, on your local development machine… simply compile and run the binary, then call its REST endpoints!

CSML server is compatible with any MongoDB database and has a very low memory footprint. It runs even on very small machines!

Head over to our github repository for instructions on how to setup CSML Server.

CSML is open-source. Feel free to give us a ⭐️ on our github repo, open issues or even send us pull requests!

Introducing: CSML Studio CLI

CSML Studio is quick and easy to create chatbots, but for larger projects, the constraints of working in the browser as opposed to your local development setup can sometimes be quite limiting.

Introducing CSML Studio CLI

With the CSML Studio CLI, you can now seamlessly switch between your local computer for development and CSML Studio online to deploy your bot.

CleanShot 2020-08-30 at 11.35.29@2x.png

To setup CSML Studio CLI, simply install the tool with npm install -g @csml/studio-cli (requires nodejs 12+), then using your bot's API keys, you can now run csml-studio init -k MYKEY -s MYSECRET -p path/to/project. This will setup a local development environment where you will be able to manage your chatbot entirely from the comfort of your machine!

Get started with the CSML Studio CLI:

New Studio API endpoints

A number of new API endpoints for programmatically managing your bots on CSML studio have been added. You can now use the Studio API (through an API Channel) to get and update your bots, add or remove flows, build and validate your bots as well as get the latest usage information.

Read the docs: https://docs.csml.dev/studio/api/bot-api

CSML v1.1.0

CSML v1.1.0 is released! Check the release notes on github and leave us a ⭐️ while you are there!

This latest version of CSML is also on CSML Studio. Try all the latest improvements in your bots!

Chatbox Plugin Greeting Message

You can now add a custom greeting message for your website visitors when using the Chatbox plugin:

image-1.png

This is great to drive user engagement to your bot. Try it out now! The documentation is here.

CSML Support for Escape Characters

With the latest CSML v1.1 update, you can now add common characters such as \n, \t, \r, \ and " in your CSML strings. The \ and " character smust be properly escaped (\", \\) while \n, \t and \r can be used directly.

CleanShot 2020-08-20 at 18.15.10@2x.png

CleanShot 2020-08-20 at 18.15.17@2x.png

New Quick Mode for Authoring Functions

We just released Quick Mode, a new authoring experience for simple nodejs custom functions!

Instead of requiring a full deployment package with tons of required configuration options, CSML Studio users can now enjoy the simple experience of an online code editor to quickly create and update simple nodejs functions.

To use Quick Mode (the new default option for creating functions), simply go to Functions > Add Custom Function, add your code here and there, and click Save. It's that easy!

image.png

Read more about Quick Mode in the documentation here: https://docs.csml.dev/studio/getting-started/using-csml-apps#quick-mode

Improved Functions Panel

It is now easier to find Custom Functions and CSML Apps from the Apps Directory, as both sections have now been merged in a single page, with a global search box.

This also helps with the discovery of available Apps, as users don't need to navigate to a second, hidden page to find all the available Apps.

CleanShot 2020-08-20 at 11.42.14 (2).gif

If you haven't already, you should have a look at the CSML Apps Directory!