Lua

We use Lua programming language in our runtime, but actually there is fast runtime core which handles Lua code and transform the code to a fast chatbot, connected to different environments: web, messengers, hardware assistants.

If you don't familiar with Lua programming language we recommend you to read documentation which describes all features of Lua.

But if you need a simple introduction to basic script writing, you will found it here.

Simple assistant writing

It's simple to write basic chatbots with VxRevenue platform. You have to create a new one case. We call cases any interactive script which handles one task of user activity.

For example, let's create minimal assistant which asks basic user information and send us e-mail with answers. The similar script we use on our website:

local EMAIL = "enter your e-mail here"

Show.Message("Hi! VxRevenue makes cool interactive assistants." ..
    "Please, answer the next questions to help them contact you.")

local name = Ask.Text("What's your name?")
local company = Ask.Text("What's name of your company?")
local mail = Ask.Email("Enter your e-mail, please:")

local subject = "Order: "..name
local letter = "Name: "..name.."\n".."Company: "..company.."\n".."E-mail: "..mail.."\n"

Email.Send("I'm sending a message to their sales manager...", EMAIL, subject, letter)

Show.Message("Thank you! I believe that they contact you soon!")

As you can see there is a standard Lua code with special objects to interact with user. For example, to ask user something we can use Ask object, which contains methods to ask and validate special type of data, like Phone or Email.

To call any method of Ask object we have to type:

Ask.Text("Enter your name, please:")

The result which this methods will returned we can bind to a variable (variable is a stored piece of data):

local username = Ask.Text("Enter your name, please:")

Later you can use this variable in other question or to prepare report or request from user. In the following source we concatenate string (textual data user sent) with our message and show it to the same user:

Show.Message("Hi, dear "..username.."!")

Two dots operator .. is a standard Lua's operator to join two strings. Also in the example above we used Show object which helps us to show some information to the user in a suitable format. Method Message shows any text to a user and moves to the next command in the script.