Currency exchange: we fix the rate for offline offline. VTB24 experience

    Currency exchange is a boring and standard process through which, for one reason or another, everyone goes through. It seems that technically there is already nothing special to do. VTB24 does not think so - we, as a bank, know about several currency exchange problems that are not lying on the surface, which you may encounter suddenly and at the most inopportune moment. And they solved them using IT. What problems and exactly how to solve - read under the cut.



    VTB24 has come up with a new currency exchange service - having fixed the exchange rate online, you can come to the office and exchange currency. The rate can be fixed on the bank's website or in a chat bot on the Facebook messenger. The service allows customers to fix the currency exchange rate for two business days, not counting the day of the order, and make a cash currency exchange, even if the market rate changes.

    The service is available to customers with a card of any Russian bank both for buying and for selling cash currency with fixing the rate online 24/7.

    How did we come to this idea


    There were several prerequisites for the formation of ideas and the creation of a new service.
    These are the most common questions during the holiday season among the population: “Where can I change the currency? Where is the best course? How to change profitably? ”, As well as dynamic changes in exchange rates and a desire for greater certainty on the part of customers.  

    More and more purchases occur online, therefore, banking services are also changing, even for such a conservative market as cash currency exchange. Innovations come, as is usually the case, from the needs of customers.

    When a client has a need to exchange cash, he usually goes to the bank's exchange office, while no one is ever sure that the bank has a sufficient amount of currency - especially if it is large. In the best case, an advanced client will try to call the bank and check about the availability of currency. At the same time, everyone understands that the bank can sell the currency to another client who came earlier, or give it to the depositor, which is often a priority for many banks. In addition, at any time the bank can change course - sometimes it happens 5-6 times a day. All this creates discomfort to the consumer.

    Therefore, it was decided to implement the idea of ​​an online store in which you can fix the rate in real time and at the same time exchange cash currency.

    Thus, the new service solves two problems: 

    1. gives the client the opportunity to fix the rate online and come with the amount of the transaction for cash exchange later at a convenient time.
    2. guarantees the client the availability of the necessary amount of currency or rubles for exchange at the bank's cash desk.

    Someone will say that it is possible to exchange currency in the Internet bank, but it must be taken into account that the transaction is made non-cash and that the amount of coverage must be in advance on the account. Many people prefer to deal with cash and not limit the choice of the bank to those where there is an account and Internet banking.

    We decided not only to implement the service on the site, but also to make it available through popular social networks - for example, a chat bot on Facebook .

    VTB24 is one of the first banks to implement this in its branches, and for a client, interaction with a well-known banking brand with state participation is convenient and reliable.

    Technically, the process looks like this. The user visits the site obmen.vtb24.ru or the chat bot on Facebook and sees the exchange rate, which he can fix for 2 days.

    Then he enters his data - last name, first name, middle name and contact telephone number, if desired, and e-mail. The chatbot saves these parameters for new orders - until the user asks him to delete them. After entering the currency amount, the bot writes in the chat the time period before which the currency must be exchanged, and the amount (10% of the transaction amount) reserved on the client’s account as a guarantee of exchange until the transaction moment - in case of refusal or delay, the bank holds it. A similar reservation is made by travelers booking hotels on the Internet or renting a car, while providing funds on the card as a security deposit.

    After confirming the order, the client goes to the payment page, enters the card details, and if the reservation operation is successful, the next page will receive an order confirmation (number and parameters). A receipt of the order will be sent by e-mail.




    From the point of view of updating courses, the bot and the site are connected to the front-office system of the bank, which gives real-time quotes of the currency (real-time mode - by ticks from the exchange, that is, once per second).



    How did we deal with this?


    To develop the site and chatbot, we attracted partners from EPAM and InspiredGames and
    asked them to comment on the technical features of the project.

    InspiredGames:

    “Our studio has taken on the task of implementing a bot for all major messengers to provide banking services in the field of currency exchange operations. It would seem - nothing complicated, almost an ordinary online store.

    However:

    • the bank provides very dynamic rates. During business hours, they reflect real-time quotes on the exchange, at night (and the service, of course, around the clock) they are also correct. The Bank transfers these quotes to the bot engine using its unique service.

    • reserve preparation and payment (more precisely, blocking of funds) by credit card directly from the bot with the transition to only one web page of the payment system has been implemented (of course, we are working on new payment options in instant messengers).

    At the same time, although the bot is an interface, it also implements functions that are usually associated with the back-end part (receiving the current rates from the bank, AWP for its authorized employees, calculation of data on orders, transactional actions with the payment system, reminders, audit, mentioned above) ...).

    The problem was successfully solved, the service is working, and we would like to talk about several approaches that we have applied. Of course, we will be happy to verify these approaches, and any opinion.

    So, first of all, the choice was whether to use any frameworks or constructors? Microsoft Bot Framework - great, but there is no connector to Viber, and even more so to VKontakte. Other constructors (at least the ones we found) did not have the flexibility we needed. Therefore, we decided to do everything ourselves. As for the infrastructure solution, we thought it would be best to use our usual and familiar use of the RESTful Web API, respectively, IIS, and for convenience, MS SQL as a DBMS (with all views, sharing, a couple of stored procedures and triggers).

    This is all clear. But there are two things that for us were not obvious from the very beginning, and which we did not see in those bots that we met.

    First: modularity.

    The engine (“core”) of the bot “communicates” with both instant messengers and other systems (the specialized part of the bank’s back-office, payment card system) not directly, but through specialized modules - “connectors”. In addition, the data service is separated. Thus there is:

    • a set of connectors to instant messengers and other systems;
    • core (about it a little lower);
    • data service;
    • some other services (an example is a simple but important service of final confirmation of the transaction rate by a bank).

    The interaction of modules, by the way, is also through the REST API.

    When a message arrives from the messenger user, no matter which one, the corresponding connector sends it to the kernel, the kernel analyzes it, generates a response message (this requires both a data service and, often, other services) and sends it back to this connector . This allowed us to:

    • to bring all the specifics and settings of working with different messengers to the level of connectors. Viber, unlike Facebook Messenger, allows you to change the font and colors of the buttons on the keyboard? Great, “color” them in accordance with the brand book right in the connector settings. Does Facebook Messenger have carousels? Very well, we’ll configure the connector to it so that in response to showing the branches, these branches are represented by a carousel. But the bot kernel does not need to “know” about these features;
    • if necessary, to distribute the bot to other messengers, only by developing a new (new) connector and adding it to the pool without touching anything else;
    • - if necessary, distribute connectors and other modules to different hosts.

    Second: the concept of “text-context-subtext”.

    Briefly, within the framework of this concept, the response of the bot core depends not only on the text (semiotically - the geolocation that the user transmits, also the text) of the user's message, but also on the context (in what state the user is in the dialog with the bot, "now", " what the user is talking about now ”), and, further, from the subtext (_history_ of the dialogue, and not only of this particular user,“ what was the conversation about before ”).

    Probably, someone already guessed that such a concept can be implemented in terms of the Miles finite state machine (text-context-> new context-response) with infinite memory (subtext). But if you do not go into details, it is easiest to explain with examples.

    The user sends the bot an “order” message. Text = "order", but not enough to know the text. The kernel accesses the data service and obtains the current context of this user. (For reference - we now have a little over 200 contexts, and they can be configured without programming).

    If the received context is “the user sends a message to the bank employee”, then the subtext is not needed, you just need to send a message to the bank, tell the user that everything has been sent and will contact him after a while, and get into the new context “main menu”.

    If the resulting context is the “main menu”, then subtext is also needed. Namely, the kernel receives a subtext from the data service, consisting of a set of formal (as in the passport) last name, first name, middle name and email address of this user. And now the answer of the bot depends on the subtext. If such a subtext is not empty (which means that the user has previously reported it to the bot), then the bot will offer to use it (or change it if necessary) and place an order. If such a subtext is empty, then the bot as a condition in order to place an order will give out the need to report this data. And when the data is received, the necessary subtext will appear, and the order can be made. The following context is “all user data has been received, continue the order”. Clearly, with all this, a story is accumulating (which, in turn,

    Great, but where is the NLP? True, NLP (Natural Language Processing) is now a very fashionable abbreviation. But for now, even here on Habrahabr, sometimes natural language processing is confused with neuro-linguistic programming. And, like NLP - "programming", NLP - Russian processing now does not work as well as we would like. In addition, there is one more subtlety - in our opinion (and in the opinion of other experts), the user does not want to communicate with the bot as a person. He understands that this is a program, and wants to get a UI like with a program - buttons, colors, pictures ...

    But if you have a lemon, then you can make lemonade out of it. That is why we:
    - preferred to make a “team” (rather than pure chat) bot;
    - we use the NLP service as a module (a service for the kernel, as described above), which, together with the context and subtext, makes it possible to parse in the text what the user wants. This module (depending on the context!) Returns an array of objects that are analyzed by the kernel. A simple example is if the context “placing an order at the stage of selecting the main exchange parameters”, then for the text “500 dollars” this particular service will produce an array:

    {  
       "deal_candidates":  
       [
     {
    "direction": "buy", 
    "amount":500,
    "ISOCode": "USD"},
    {
    "direction": "sell", 
    "amount":500,
    "ISOCode": "USD"}
    ]
    }

    And already in this array, the bot’s core will ask “choose what you want.”

    The result of our experience:

    • convenient transactional bots for financial services can and should be done;
    • "there are proven approaches that these bots (and, accordingly, services) allow you to create quickly, efficiently and, most importantly, scalable and replicable."

    Why the site was chosen not only for the site, but also for the chat bot:

    • Messengers are used by a very large number of users, you do not need to separately search and install a specialized mobile application, just add the bot to your contact list and start a dialogue with it.
    • Operations in the messenger - this is work in the familiar interface - you do not need to relearn or search for the necessary functions, while convenient access to financial transactions is realized.
    • By launching the next bot, the bank takes into account the growing interest on the part of customers in new communication channels.

    VTB24 plans to release chat bots in all available messengers in the future (add Viber and Vkontakte, and also hope to wait for the WhatsApp API to open).

    Also, despite all the difficulties, we will continue to delve into the NLP topic for more convenient user interaction. A chat bot is already working in the personal account on the bank’s website, with which you can chat and get advice and help from him. The results of the work and training of this bot will be implemented in conversion chat bots in instant messengers.

    We also plan to increase the range of financial services offered by chat bots - not only related to foreign exchange transactions.

    Fixing an offline course online is an important new channel for providing services to the population.

    This is a true innovative service, another small step in the digitalization of banking services. The new service makes it possible to exchange cash currency "here and now." At the same time, the bank is getting closer to consumers of the mass segment: it is not necessary to be a VTB24 customer to use the service, it is enough to have a card of any Russian bank.

    For VTB24, this is also a great opportunity to play and test new technologies in order to determine the vector of further development.

    Also popular now: