Bots - Omnichannel

A bot is a computer program that automatically performs repetitive tasks over the Internet, whose execution by a person would be impossible or very tedious.

Available for
WebChat, SMS, Email, WhatsApp and Messenger


uContact Bots

The bots allow the execution of flows that use a Javascript engine allowing you to perform almost any action if you have the necessary programming knowledge.

From simple answers to transfers, queries to the database or execution of web services are just some of the programmable activities for bots.

To get started with bots you will need to log into uContact with a Supervisor type user with permissions to use the Workflow Designer.

 

 

To start creating bots you must have bot licenses available.

They can be requested by sending an email to Integra Support.


Bot development

This is the core, here its behavior is defined and that it is well created is essential for its implementation.

For this we go to the Workflow Designer, there a blank page will open and on the left, in the activities menu, we will see a dropdown called Bots located at the end of the list.

From here all the activities to be carried out by the bot will be taken.

To consider:

  • You should always start a bot with the BotStartActivity activity

  • You should always end a bot with the FinishInteraction activity

  • FinishInteraction should not be included after a TransferBot activity

Bot Activities

The activities allow to control the operation of the bot.

Here we will describe the function of each activity

Every activity have a field Description

  • Not mandatory for the activity works

  • It’s use to describe the activity when it’s designed


BotStartActivity

This activity is the first of the flow, it must always be included in all the created flows, it indicates to the bot where the activities begin.

  • In the name field, it will include the name for the bot to show it in the campaigns settings

  • botTimeout is the time in minutes the bot waits without receiving a response to finish the interaction.

  • msgBotTimeout it’s to include a message to be sent when the timeout it’s reached.

  • Over msgBotTimeout you will see a dropdown menu to set if you are creating a Bot or a Function

    • 1 Bot = 1 Bot licence - You can’t create a bot without licences.

    • 1 Function = 0 Bot licence - Functions are available without licences, but they aren’t displayed in the campaign settings.


SendMessage

With this activity we will interact with the client, it allows to send a message after each time the client writes. This field can work in 3 ways

Send a simple message

To do this we simply write the message you want to send in the message field.

Message with variables

In messages it is also possible to include variables using ${variable}

This will cause the message to replace the variable with the value it previously acquired.

Send options

After introducing yourself, you may want to give the client options and thus make decisions based on their response. To do this, you must write the options in the message field, indicating the option number and separating them with Enter.

In webchat, the client will receive a menu in which he can select the options with a click.

On other channels, it will look like a normal message.


IsOnTime

This action allows evaluating a response and activating a route or another depending on the time that is entered.

  • Schedule
    The format must be:
    mon,tue,wed,thu,fri,sat,sun;09:00-18:00

You can add more schedules by connect them with “&“

mon,tue,wed,thu,fri;09:00-18:00&sat,sun;10:00-13:00

Example:
The client writes to the bot and selects to speak to an agent. After reading the response, you can decide to send it to one campaign or another depending on the time the interaction is.


Evaluate

Evaluate an answer and based on it decide one way or the other, evaluate can be chained one after the other in case we have multiple options and each one performs different actions.

  • Blank area
    This is where you enter Js code to evaluate options

If the variable is fulfilled it will go through the green path that comes out of the evaluate, if the variable is not fulfilled it will go through the red one.


ReadMessage

With this option the bot will read the response sent by the client and then be able to evaluate it or save it in a variable.

  • variable
    Name of the variable that will have the response.

  • timeout
    Waiting time to continue the flow, if this time is exceeded the content of the variable will be empty.

This is useful to create alternative flows to repeat questions if they aren’t answered.


ReadFileMessage

This option is similar to the previous one except that it is used to save an image after requesting it and thus it will successfully reach the workflow.

 


Procedure

This activity allows you to execute JavaScript code. For example, if you want to parse a response from a web service or increase the value of a variable, you can do it here.


ExecWebService

Allows to execute a Web Service

  • variable
    Name of the variable containing the WS response

  • method
    Method that the WS will use, these can be: Get, Post, Put and Delete

  • url Address
    where the WS is located

  • body
    WS body content

  • headers
    All headers that the WS carries, these are indicated header: content

  • content-type
    The content type that is sent in the WS

In this activity, both external web services and those of uContact can be used, for example, to make calls.

See uContact API's


ExecQuery

Here you can query the database.

  • variable
    Name of the variable containing the query result

  • blank area
    This is where the SQL query is written.


Disposition

It allows to create dispositions to the interaction with the bot, in this way you can track the interactions.

The dispositions are inserted directly in the DB, therefore they do not necessarily need to be created in the system, even if they are created in uContact they will not execute actions such as schedule or respool.


TransferBot

With this option you can transfer the interaction from a bot to a campaign on the same channel that is being used.

For it to run correctly, we must indicate the exact name of the campaign to which you want to transfer in the destination field.

If you use this function it is recommended not to use the same bot for 2 campaigns on different channels since the bot will not be able to transfer to another channel.

When the interaction arrives, the agent will see the conversation between the client and the bot


LogOp

Allows you to print a variable in the IntegraServer log.

formato:
${log}

Commonly used for creating or debugging workflows.


FinishInteraction

This action must be at the end of each flow, it indicates to the bot that its flow has ended and closes the interaction with the client.

After a FinishInteraction, the webchat client will see a message to leave the chat or stay in it and see the conversation, but the calls and the text area are disabled.


SetClientName

This activity takes the content of a variable and assigns it to the interaction's customer name and in turn assigns it to the bot's CLIENT_NAME global variable.

  • name
    Name of the variable to be used as CLIENT_NAME

Example:

  1. In a message the client is asked to enter his name, followed by a ReadMessage that allows taking his response within a variable, that variable is entered in SetClientName, then in the flow if we send a message with the global variable CLIENT_NAME, the value will be used of the variable in SetClientName.

  2. When the interaction reaches an agent, the name of the customer will be visible with the value of the variable entered in SetClientName.


SendAttachment

Through this activity it is possible to send files to the client.

  • url
    The files will be uploaded in the folder etc / IntegraServer / web / attachments and their type must be indicated

    • image

    • Audio

    • video

    • application / pdf

Usage example:

application/pdf|20200504/filename.pdf

to send a file found in etc/IntegraServer/web/attachments/20200504/filename.pdf


SendEmail

Allows to send emails.

  • template
    Name of the email template you want to use

  • variables
    Within the template we can have variables to replace ${example}, in this field we must indicate all the variables of the template to replace and the value they will have in the following format:
    example:value

The template variables can be replaced by other variables that we have in the bot even by global variables.

There are customer data that are obtained from the interaction, they can be used in different activities.

The global variables are:

For all channels

  • CHANNEL
    Channel through which the client is contacted

  • GUID
    Interaction assigned guid

  • CLIENT_ID

    • SMS/WhatsApp
      Client phone number

    • Webchat
      Content of the Email field of webchat

    • Messenger

Webchat

  • PHONE_NUMBER
    Content of the Phone field of webchat

  • CLIENT_NAME
    Content of the Name field of webchat

SMS - WhatsApp

  • SMS_PROVIDER_TYPE
    SMS provider through which the interaction arrives

Messenger

  • CLIENT_NAME
    Facebook’s client name

  • PAGE_NAME
    Name of the page through which the interaction arrives

Email

  • EMAIL_SUBJECT
    Contains the text corresponding to the subject of the received email.

  • EMAIL_BODY
    Contains the body of the received email

  • When you create the first flow for bots, the bots context will also be created, it will list all the flows created for bots.

  • Before creating the first flow, the bots context will not exist.

  • When you create an email bot, remember to consider the possible responses to the emails sent.

Bot Functions

Function bots are bots that are used as functions. Its purpose is to be able to modularize certain sections of the bots in order to facilitate their development, testing, and maintenance.

Function bots do not consume bot licenses and are uploaded to the server with the context 'botsFunction'.

The context 'botsFunction' will not exist until the first BotFunction is created

All bot activities can be used in BotFunctions, but they will start with BotFunctionStartActivity instead of BotStartActivity.


BotFunctionStartActivity

In order to create a bot function, we have the BotFunctionStartActivity.

This activity, unlike the BotStartActivity, only has the 'name' field.

In other words, the initial activity of a function bot does not have the 'bot_timeout' field, or the 'timeout_message' field, which means that the timeout that will be taken into account is that of the Bot that calls the function bot.


GoToFunction

This activity allows you to nest both bots and bots functions.

Suppose that you have a bot named B and a function bot named BF and B has the GoToFunction activity and in the name field it has name = "BF" assigned.

When executing the GoToFunction activity, bot B execution stops and BF begins to execute. After BF finishes executing, it will return to B to continue executing the following activities.

It is in this way that it is possible to nest several bots or bots functions to an initial bot.

  • name
    Field containing the name of the bot or BotFunction to which control will be passed once this activity is executed.


Bot Administration

Since update 6.275 in the configuration of SMS, WebChat and Messenger campaigns we will see a drop-down menu called Bot Name, when it is displayed all the created bot flows will be listed.

After selecting the desired bot for the campaign, simply press the Save button and your campaign will start working with bots!

  • The interactions that are open at the time of the change will not be affected by it, the same as those that are in the queue.

  • A campaign with bots does not need to include agents, the bot will take the interactions and distribute them to other more specific campaigns.

  • The interactions that are generated after making the change will start using the bot.

  • The chats with the bots are recorded and can be consulted in the recordings of their respective channel

  • The bots fulfill the function of an agent, this allows us to even make reports obtaining the bot's data.

  • In the message tables of each channel, the agent parameter is the name of the bot.


Create the first Bot

In this section we will see how to create a basic flow, as an example and practice, that contains the following actions:

  • Presentation - SendMessage

  • Options - SendMessage

  • Get reply - ReadMessage

  • Evaluate the answer - Evaluate

  • End interaction and make disposition - Disposition

  • Insert a user into a table - ExecQuery

  • Transfer to a campaign - TransferBot

  • Check the system version and save the variable - LogOp

  • Use the variable in a response and end the interaction - SendMessage

 

We will start by adding the BotStartActivity action and giving the bot a name.

This name is the same name that will be shown in the settings drop-down menu.


Then we will add two SendMessages that will be sent in a row.

The first will be our presentation, in it we will warn the user to select one of the options that we will give him below.

In the second we will give the options, making one per line and starting with number and hyphen.


In this instance the bot waits for the client's response, for this we must add the ReadMessage activity and our flow will look like the following:

Now we will add the Evaluate to analyze the response obtained. We put 4 options so we will use 4 Evaluates.

In each one we will indicate the condition that the variable must have for it to be valid


For each option we will add its destination, that is, in the second and fourth Evaluate we will use ExecQuery and in the third a TransferBot.

In the first ExecQuery we will write an insert, in the dropdown we select the database in which it is performed and in the variable we will put a name to use later in the response, in this case it is result.

In the second, it will make a query for the version of the system, in the drop-down we select the database in which it is performed and in the variable we will put the same name to use later in the response, in this case it is result.

In the TransferBot we will simply put the name of the campaign to which the client will be transferred.


So far it only remains to add a SendMessage returning the response and followed by a FinishInteraction.

Now it only remains to join our flows or adjust it to our needs by adding dispositions, logs or WS and they would have something similar to the following:

After finished we just activate it, add to the campaign and your bots will start to work!

 

Simple bot example

 


This is the introduction to Bots.

Soon we will add posts and videos about it.