Rate this page:


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 incoming call), or manually by running it from the control panel or via management API.

You can have multiple scenarios in one application.


Copy URL

Creating 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.


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

Executing 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.

Scenario tips

Copy URL

Almost every guide in this documentation contains a scenario example as well as some SDK code examples. For instance, the voice call and the video call articles have ready-to-use scenario examples and the code to build a client on Web, iOS, and Android SDKs. Feel free to use the scenario examples in your project.

Every demo client on the Voximplant Github contains a fully working scenario in the Readme.md file. For instance, the Video conference client demo has a ready-to-use scenario, that you need to copy&paste to your application.

Developer onboarding on the Voximplant control panel has ready-to-use scenario templates to start building a simple project of your choice. Feel free to choose a suitable template and take a step-by-step tour on how to create an application for your purpose.

To master writing scenarios manually, we offer full scenario API explanation in the VoxEngine section of our API reference, and scenario code examples with comments in our guides.

Eventually, if you have some troubles with writing a scenario, our support team is ready to help you.

See also

Copy URL

Frequently asked questions

Copy URL

Q: I have several modules imported in my scenario. Do I need to import them to each scenario as well?
A: If you bind all of your scenarios to one routing rule, they execute in one context, that is why you do not need to re-import the modules. It is enough to import them to one of the scenarios.

Q: Can I organize my scenarios to folders?
A: Unfortunately, no. There is a Shared folder for shared ones, and the rest scenarios appear as a list. In the current version of VoxEngine you cannot organize them to folders.

Q: What is the Shared folder in the scenario list.
A: All the scenarios you add to the Shared folder are available for all application within your account. To add a scenario to the shared folder, right-click on the scenario and choose RefactoringMove to Shared.

Q: Do I need to create a separate scenario for processing each type of call, or can I describe the logic in one scenario?
A: It is a best practice to start with one scenario and implement the logic of processing different types of calls within one scenario. You can divide different logic into different scenarios, for example, one scenario sorts and processes incoming calls, and the other scenario processes outgoing calls or call lists.