Rate this page:

Key-Value Storage

As you might know, there is an Applications concept in Voximplant. The Applications allow linking scenarios, phone numbers, users, rules, and call queues. To put it simply, an application is the entry point for any Voximplant-based solution, so it’s necessary to firstly create one and then continue with scenarios, rules, etc.

Previously, applications didn’t “remember” any of the actions or calculations made by scenarios, so developers were forced to save values to 3rd party services or their backend servers. If you ever had experience with local storage in web development, our new functionality would seem quite similar as it allows you to save key-value pairs that are unique for each application in your Voximplant account. This is called Key-Value Storage, which is being operated by a new VoxEngine module – ApplicationStorage. Follow the steps below to become acquainted with the principles of its usage.


We suggest creating a simple scenario that “knows” how many times a user called a number. You will need:

  • Voximplant developer account. If you don’t have one, sign up here.
  • Voximplant application, JS scenario, rule, and user. Those will be created during this tutorial.
  • Web client to make a call, we’ll use our webphone at https://phone.voximplant.com/.


First, log in to your account here: https://manage.voximplant.com/auth. On the left menu, select Applications, click New application and create a storage application. Then go to your new application, switch to the Scenarios tab, and create a countingCalls scenario with the following code:

Scenario code

Scenario code

The first line mounts the ApplicationStorage module, the rest of the scenario logic is placed in the CallAlerting handler.

We declare a variable to make a comparison between a call counter and the initial value possible. Then we try to retrieve a totalCalls value from the application storage. If there is no value, we create such a variable in the storage:

try {
    r = await ApplicationStorage.get('totalCalls');
    if (r === null) {
        r = await ApplicationStorage.put('totalCalls', 0);

The next action to perform is to increment the value in the storage.

try {
        await ApplicationStorage.put('totalCalls', (r.value | 0) + 1);

Each promise rejection should be handled as has been shown in the example above, otherwise, your scenario will fail during the execution. See the details here.

After working with the storage, the scenario answers a call with a synthesized message of how many times you called before. When the robotic speech is over, the scenario terminates a call session. That’s it.

When a scenario is ready, go to the switch to the Routing tab of your storage application and click New rule. Name it startCounting; use the created JS scenario in the rule and leave the default call pattern ( .* ).

The last action to perform here is to create a user for your application. Switch to the Users tab, click Create user, set username (e.g., user1) and password, then click Create. We’ll need this login-password pair to authenticate in the webphone.


Open https://phone.voximplant.com/ and log in, using your credentials. After successful login, enter an arbitrary string and click Call. If everything went properly, you’ll hear a synthesized greeting!

We wish you the best development experience with Voximplant. Keep an eye out – more great things to come!