Voximplant provides a built-in database for key-value pairs, available throughout the application.
You can store unlimited key-value pairs in the database, your keys can be up to 200 characters string, your values can be up to 2000 characters string.
You can use the Key-Value Storage module to mask phone numbers, for example, when creating a delivery service solution. An order number can be a key, and a courier's and customer's phone numbers – the values. Thus, the courier and the customer are connected by the order number and do not know each other's phone numbers.
In this article, we create a simple scenario that “knows” how many times a user called a number.
- Create an application.
- Create a scenario.
- Create a routing rule and attach it to the scenario.
- Create a user to log in your client.
You need a working web or mobile application in order to make calls. Refer to the Basic call functionality to learn how to create it.
You can use our web phone to make a call.
We declare a variable to make a comparison between a call counter and the initial value possible. Then we try to retrieve the totalCalls value from the application storage. If there is no value, we create such a variable in the storage:
The next action to perform is to increment the value in the storage.
Each promise rejection should be handled as has been shown in the example above, otherwise, your scenario fails 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.
Test your application
Open https://phone.voximplant.com/ and log in with your credentials. After successful login, enter an arbitrary string and click Call. If everything went properly, you hear a synthesized greeting!