Rate this page:

Scenarios

A scenario is a JavaScript document within a Voximplant application, in which you can implement your logic processing calls and messages. It is in a scenario where you implement when to answer or make a call, when to synthesize or recognize speech and much more.

To execute a scenario, you need a rule. You can execute a scenario either automatically (for example, by an inbound call), or manually by running it from the control panel or via management API.

You can have multiple scenarios in one application.

How to create a scenario

Copy URL

Open your application, select Scenarios on the left menu, and click on the plus icon and give your scenario a name:

Create a scenario

This opens a new tab in the online IDE on the right. This is where you write your code. If needed, you can rename the scenario or change the source code later.

Note

You can upload changes automatically via management API.

Shared scenarios

Copy URL

You can share a scenario between different applications. To do this, move a scenario you want to share to the Shared folder on top of the scenarios list:

Share a scenario

Calling functions from other scenarios

Copy URL

You can use functions from two scenarios in the same application. To do that, you need to add two scenarios to the same routing rule. After that both scenarios execute in the same space, and you can call functions and access variables from both scenarios without the need to import anything.

Connecting two scenarios to the same rule

Execute a scenario

Copy URL

To execute a scenario, you need to create a routing rule and launch it.

There are several ways to launch a routing rule:

  • A management API request

  • An incoming call into the application

  • Manual routing rule launch via the control panel

Read more about routing rules in the next article.