Process Flow [v4.8.2]

For versions:4.8.2

Click ‘Download’ button to show summary or download as PDF for offline viewing.

Process Flow

The process flow module built in to simplify the integration development between virtual assistant and backend business service. The function of process flow is to perform virtual assistant proactive reaction and ability to accept instruction from other system.

Process flow eliminates the hardship of managing SDK to not be all over the place. It is a collection of a node that will do different actions based on the predefined rule to achieve business process output in a linear process, giving privilege to collaborate with external source API.

To view use case of process flow please refer to : https://www.3dolphins.ai/2020/02/05/integrating-bot-with-externally-sourced-data/

Login as ‘Trainer‘, for the 3Dolphins SRM login mechanism, do the steps described on the ‘Login‘ page,

Images 1. Login Page

Select the ‘Bot Settings‘ menus, and on the dropdown menus select the ‘Process Flows‘. Then you will be redirect to process flow page, such as images below.

Images 2. Process Flow Page.

Component explanation :

IconIcon NameDescription
Start For simulation requests that will be received by the workflow.
Execution of workflowTo execute the program by taking instructions and data needed from the process flow that has been made.
Add WorkflowTo add a new component (node).
Save WorkflowTo save the design of the process flow that have been made.
List of WorkflowWorkflow that was available in system. Each the workflow is success saved (created), a workflow will appears in the list of workflow. You can search workflow based on workflow name, edit workflow and remove workflow.
Workflow LogEach time a workflow runs, a log entry is created. Log entries record the date and time the workflow was run, the data it operated on, status (success or failure of the workflow), description of status, component workflow, thread id and execute time.
Zoom InTo adjust the page so that the workflow seems to be large.
Zoom OutTo adjust the page so that the workflow seems to be smaller.
ResetReset the zoom level on the current page.

Start

This feature works for simulation requests that will be received by the workflow.

Images 3. Start (Request Body Example)

Component of Workflow

Process flow in the 3Dolphins system, consists of eight (8) components of workflow, i.e :

  1. Webhook
  2. Execute Command
  3. HTTP Request
  4. MVEL Function
  5. Execute Workflow
  6. Timer Interval
  7. Send Message
  8. Send Email
Images 4. Component of Workflow

MVEL Function

MVEL has largely been inspired by Java syntax, but has some fundamental differences aimed at making it more efficient as an expression language, such as operators that directly support collection, array and string matching, as well as regular expressions. MVEL is used to evaluate expressions written using Java syntax.

In addition to the expression language, MVEL serves as a templating language for configuration and string construction. To view example of MVEL expression language please refer to : http://mvel.documentnode.com/

Images 5. MVEL Function

Field component explanation :

MVEL Script NameThe node_id of the workflow component.
MVEL ScriptThis section for develop script from a series of process flow.
MVEL OutputOutput from MVEL script.
Evaluate To run the node.
EditTo save the node.

MVEL Sript

For example, type the script to get information about a national calendar of all 2020 holidays, such as images below.

Images 6. MVEL Script

A detailed description of the script, can be seen in the table below :

NameDescription
SizeTo get the number of public holiday objects from
“response”: {
    “holidays”: [
which is on the response of node ‘HttpHoliday‘.
import java.text.ParseException;To Import class of java parse exception
import java.text.SimpleDateFormat;To Import class of java simple date format
import java.util.Date;To Import class of java simple date format date
import java.time.LocalDateTime;To Import class of java local date time
SimpleDateFormat sdf = new SimpleDateFormat(“yyyy-MM-dd”);To declare sdf variable as ‘simple date format’ with yyyy-MM-dd format
def getHoliday()To declare a function (get holiday)
result = “”;Declare a result variable with an empty value (“”).
Date now = new Date();To declare a variable now as a date, the value is the variable date in the declaration.
for (int i=0;i<size;i++)looping formula
Date date = sdf.parse(response.response.holidays[i].date.iso);To declare a variable now as a date, the value is a public holiday date.
if (date.after(now) && response.response.holidays[i].date.iso.length < 12)The formula for knowing whether the date of the public holiday is past from the date of the variable now in the declaration, and the ISO date must be under 12 letters.
result += response.response.holidays[i].date.iso + ” : ” + response.response.holidays[i].name +”\n”;If the formula = true, will display response (date.iso and name of public holiday)
return result;Returns the result of the getHoliday function
return getHoliday();Return the result of the MVEL function has been made.

MVEL Output

Output from MVEL script (display information about a national calendar of all 2020 holidays).

Images 7. MVEL Output

Http Request

You can send requests in process flow to connect to APIs you are working with or integrating with a third-party API.

Http Header

If you have a request you want to run, you will need to know the method, URL and other optional key and values.

Images 8. HTTP Header.

Field component explanation :

Http Request NameThe node_id in the workflow component.
MethodIn currently, Method of HTTP Request is supported ‘GET’ and ‘POST’.
URLThe API you want to hit (the link you want to access). The URL is dynamic, URL can use parameters, depending on the variable to be displayed.
KeyVariable name (can use parameters that don’t have to be static).
ValueValue of the variable (can use parameters that don’t have to be static).
+ Http HeaderButton to add header (keys and values).
PlayTo execute the node_id that was made.
AddTo save the node_id in a workflow.
Request Methods

Currently, you can use the GET and POST method for retrieving data from an API in process flow.

Setting Request URLs

Each request you send in process flow requires a URL representing the API endpoint you are working with. Each operation you can perform using an API is typically associated with an endpoint. Each endpoint in an API is available at a particular URL, this is what you enter into process flow to access the API.

  • If you’re building an API, the URL will typically be the base location plus path. For example :

Description of URL :

  1. {URL}   : Used to pass information to the destination.
  2. {Path}  : Location of data on the server.
  • If you’re using a third-party API, your API provider will supply the URLs you need, for example within their developer documentation.
  • You can optionally type query parameters into the URL field. Any word after the question mark (?) in a URL is considered to be a parameter which can hold values. The value for the corresponding parameter is given after the symbol “equals” (=). Multiple parameters can be passed through the URL by separating them with multiple “&”. For example :
  • URL provides dynamic variables that you can use in your requests. Each variable name represents its key, so referencing the variable name allows you to access its value. The variable name typically taken from the previous process.

Consider the workflow example below.

Images 9. Local Currency Workflow

In the image above (Images 9. Local Currency Workflow), we take the example of the ‘askCurrency’ process. This process is to provide a feedback response to requests sent.

This ${mvNow.response} variable is to contain the response of the ‘mvNow’ process. Or, you can add ${mvNow.response} using the response (output) from the ‘mvNow’ process, such as images below.

Consider the workflow example below.

Images 10. Add Gitlab Issue Workflow

In the image above (Images 10. Add Gitlab Issue Workflow), we take the example of the ‘addGitlabIssue’ process. This process is to provide a feedback response to requests sent, this response is in the form of an ‘title’ object whose value is ${response.title}. This ${response.title} variable is to contain the response title of the ‘transformIssue’ process.

Images 11. Add Gitlab Issue Workflow – HTTP Header of addGitlabIssue

The ${response.title} variable will not be able to process on ‘getChatlink’. Because, before the ‘getChatLink’ process there were 2 processes i.e ‘addGitlabIssue’ process and ‘getToken’, when you input the variable ${response.title} in ‘getChatlink’ the system will be confused to determine the title variable to be accommodated, whether the variable to be accommodated is a response from the ‘addGitlabIssue’ process or a response from the ‘getToken’ process.

Setting Request Header

Some APIs require you to send particular headers along with requests, typically to provide additional metadata about the operation you are performing. You can set these up in the Headers tables. Enter any key-value pairs you need and process flow will send them along with your request. Variables allow you to store and reuse values in your requests. Using variables increases your ability to work efficiently and minimizes the likelihood of error.

For example, to include a authorization in the request headers, you can set header in the request node id ‘getToken’, This request serves to retrieve the token variable from the API contained in the URL and will hold the variable as a response.

Images 12. Add Gitlab Issue Workflow – HTTP Header of getToken

To get a token from the 3Dolphins application, a request body in the form of a 3Dolphins account is required. This 3Dolphins account functions as authentication on API Rest, so only 3Dolphins users can use the 3Dolphins API.

Images 13. Add Gitlab Issue Workflow – HTTP Body of getToken

When the request is executed, then the response will be obtained in the form of an access token.

Images 14. Add Gitlab Issue Workflow – HTTP Response of getToken

Consider the workflow example below.

Images 15. Add Gitlab Issue Workflow

In the image above (Images 15. Add Gitlab Issue Workflow), we take the example of the ‘getChatLink’ process. This process is to provide a feedback response to requests sent, this response is in the form of an ‘Authorization’ object whose value is ‘${getToken.response.token}’. This ‘${getToken.response.token}’ variable is to contain the response token of the ‘getToken’ process.

Images 16. Add Gitlab Issue Workflow – HTTP Header of getChatLink

Http Body

The ‘http body’ tab in process flow allows you to specify the data you need to send with a request. You can send various different types of body data to suit your API.

If you’re sending body data, make sure you have the correct headers selected to indicate the content type your API may need to process the received data correctly. Typically you will use body data with POST requests. Consider the workflow example below.

Images 17. Add Gitlab Issue Workflow

In the image above (Images 17. Add Gitlab Issue Workflow), we take the example of the ‘getToken’ process. to get access token requires a request body such as 3Dolphins account. This 3Dolphins account functions as authentication on API Rest, so only 3Dolphins users can use the 3Dolphins API.

Http Response

Once your headers and other request details are set up, you can click Play to run your request and examine the Response received from the API server. If your request does not work as expected, check out some error. Consider the workflow example below.

Images 18. Add Gitlab Issue Workflow

In the image above (Images 18. Add Gitlab Issue Workflow), we take the example of the ‘addGitlabIssue’ process, to be able to add issues to gitlab, needed the destination URL (server API) and parameters will be sent to the gitlab. For example in the ‘addGitlabIssue’ process, the parameters that will be sent are title, description and label. When the ‘addGitlabIssue’ process is run, you will get a response (this response will be sent to gitlab) like in the picture below.

Images 19. Add Gitlab Issue Workflow – HTTP Response of addGitlabIssue

Webhook

Webhooks are user-defined HTTP callbacks. Webhooks allow you to build or set up integrations. They are usually triggered by some event, when that event occurs, the source app makes an HTTP request to the URI configured for the webhook.

Images 20. Add Gitlab Issue Workflow – whAddGitlabIssue

A detailed description of the webhook setting can be seen in the table below :

FieldDescription
NameThe node id of workflow component.
Webhook PathPath of the webhook
White ListIP or hostname can access to the webhook (e.g 10.1***domain.com).
URLThis field will be filled automatically.
Response ExpressionTo simulate the results of the body.
AddButton to add node id in workflow process.

Setting Webhook URLs

The URL on this webhook is the default and will be filled automatically when you create a workflow process and add webhook components.

Description of URLs :

  • {URL}                   : Used to pass information to the destination.
  • {Path}                  : Location of data on the server
  • {workflow_id}      : ID that are automatically created when creating a workflow process.
  • WF                      : Code from workflow process (default)
  • {node_id}            : ID obtained from the field name. {webhook_path} : The keywords entered in the webhook path field (e.g whAddGitlabIssue).
{node_id} and {webhook_path} will automatically be created when adding a node in the workflow process. When a node has not been added, {node_id} and {webhook_path} are {empty}.

Using Dynamic Variable in Response Expression

Consider the workflow example below.

Images 21. Add Gitlab Issue Workflow

In the image above (Images 21. Add Gitlab Issue Workflow), we take the example of the ‘whAddGitlabIssue’ process. This process is to provide a feedback response to requests sent, this response is in the form of an ‘issue_no’ object whose value is ${addGitlabIssue.response.id}. This ${addGitlabIssue.response.id} variable is to contain the response id of the ‘addGitlabIssue’ process.

To display the response of dialog, you can use the value of success using ${wf.success} variable. ${wf.success} variable serve to define workflow process is true or false. For example, if we set the value of success using $ {wf.success}, when the workflow process starts and in the middle of the process an error occurs, the value success will automatically define that the process is false.

A detailed description of the response expression can be seen in the table below :

Field NameDescription
ValueThe value of output
OutputResponse output from MVEL function
SuccessTo display the response of dialog.
– If success : true, will display a success response.
– If success : false, will display a fail response.
– If success : ${wf.success}, to define workflow process is true or false.
Agent– If Agent : True. A dialog will direct to agent,
– if Agent : False. A dialog will direct to Bot,
Next– If Next : True. will direct to next entity.
– If Next : false. will not direct to next entity.
RepeatTo repeat of dialog.

Send Email

You can set up your custom workflow to send e-mail messages to other user. The available fields for an e-mail message are to, cc, subject, and message. These fields can contain both static text and text that is generated dynamically from workflow lookups.

Images 22. Add Gitlab Issue Workflow – emailProductLead

Field component explanation :

Email NameThe name of the node id, in the workflow component.
Email AddressIn this field, you can choose an email address that matches the email address registered with OmniChannel.
ToThis field will be used as the recipient of any message to the email that’s sent.
SubjectCreate the subject line for your form’s email.
MessageEnter a custom message that will appear in the notification emails that are sent. Insert images or links from your form’s entries.

Timer Interval

Timer interval enable you to control the workflow using a time condition. You can use timer interval for creating a delay before running an next process.

Images 23. Timer Interval

Field component explanation :

Interval nameThe node_id in the workflow component.
DelayField for input how long the process is delay based on the time unit.
Time Unit (second/minutes/hours/days)To choose time unit for the node id.

Send Message

For example, add workflow of reminder message.

Images 24. Reminder Workflow

To display the message reminder, an timer interval is needed. Timer interval enable you to control the workflow using a time condition. You can use timer interval for creating a delay before running an next proses. For example, set interval message to 5 second.

Images 25. Reminder Workflow – reminder1Mins

When the ‘reminder1Mins’ process finishes running according to the specified time interval, the process flow will automatically move to the next node_id which is ‘sendReminder’. ‘SendReminder’ functions to send a reminder message that will be sent to the customer.

Images 26. Reminder Workflow – sendReminder

Field component explanation :

Message NameThe node_id in the workflow component.
Linklink will automatically filled (example : domain.com/apiv1/graph/tickets/sendMessage)
UsernameUsername of user on the 3Dolphins system.
PasswordPassword of user on the 3Dolphins system.
Ticket NumberRetrieve the ticketNumber variable from the request body.
Channel TypeSelect a channel to send message (Channel has been registered in the omnichannel)
Message IDMessage ID can be written freely (free text).
Reply AgentIf the message is sent by a bot, then write the agent reply as ‘Bot’, however if the message is sent by the agent, the agent reply is written as ‘Agent id’.
MessageEnter a custom message that will appear in the notification message that are sent on the channel selected.

In the image above (Images 26. Reminder Workflow – sendReminder), we take the example of the ‘${intent.ticket.ticketNumber}’ variable. This process is to provide a feedback response to requests sent, this response is in the form of an ‘Ticket Number’ object whose value is ‘${intent.ticket.ticketNumber}’. this ‘${intent.ticket.ticketNumber}’ variable serves to retrieve the ticketNumber variable from the request body.

For example : when a customer sends a message, the customer automatically sends a request (extension request) to the flow process. An example of this extension request can be seen in the image below.

Images 27. Start (Request Body Example)

In the extension request there is some data that may be needed by the developer, such as an account ID, ticket number, etc. For example, when retrieving the ticket number from the request extension, the method of writing is: $ {intent.ticket.ticketNumber}.

Setting Message URLs

The URL on this message is the default and will be filled automatically when you create a workflow process.

Description of URL :

  • {URL}                    : Used to pass information to the destination.
  • {Path}                   : Location of data on the server

Execute Command

execute command on the host.

Images 28. Execute Command

Field component explanation :

Command NameThe node id, in the workflow component.
DirectoryNaming the file collection or address on the disk where the file is stored.
ShellCommand translator program typed, in the prompt.

For Example :

In this case, we will execute the ‘testing.sh’ file in the ‘/opt’ directory, with a note that bash is an active shell.

Images 29. Test Execute Workflow – executeFunction

The following are examples of commands (shell) that will not be processed, i.e :

  1. ls
  2. :(){:|:&};:
  3. rm
  4. /dev/
  5. wget
  6. mkfs
  7. ^foo^bar
  8. dd
  9. char
  10. chmod
  11. cp
  12. mv
  13. scp
  14. passwd

These commands are in command.block

Execute Workflow

To run other workflows that are in the workflow list.

Images 30. Execute Workflow

Connector Setting

To create rules before enter the node that will be executed.

Images 31. Connector Setting

Integration

At the top right side, click the ‘Add Component‘ button.

Images 32. Process Flow Page

Choose the component in accordance with the flow process to be made.

Images 33. Add Component of Workflow

For example, create the process flow of public holiday. If a process flow has been made, click the ‘Execute‘ button.

Images 34. Public Holiday Workflow

Wait the execution of workflow is done, if the execution of workflow is success, then the workflow can be used for integration with dialog.

Images 35. Exectute of Public Holiday Workflow

To integrate process flow with dialog, select the ‘Bot Settings‘ menus, in the drop down menu, select ‘Dialog Flows‘ and click the ‘New Dialog‘ button.

Images 36. Dialog Flow Page

At the integration process, click toggle ‘FINAL‘ to integrate process flow on dialog.

Images 37. Dialog Flow Page – Integration

Select ‘workflow service‘ and select the process flow in accordance with the dialog that has been made.

Images 38. Dialog Flow Page – Integration (Add Workflow Service)

After save and build dialog, attach your dialog that has been made on the bot. Select the ‘Bot Settings‘ menus and click ‘Bot Manager‘. Then, select bot and click the ‘Dialog‘ button.

Images 39. Bot Manager Page

In the pop up, search dialog and click the ‘Attach‘ button.

Images 40. Bot Manager Page – Attach Dialog

And then do the test of dialog. You can test the dialog using the emulator or using conversation chat of customer. For example, test the dialog using the conversation chat of customer, such as images below.

Images 41. Live Chat Customer – Test Dialog of Public Holiday

List of Workflow

Workflow that was available in system. Each the workflow is success saved (created), a workflow will appears in the list of workflow.

In this trainer screen, the trainer can :

  1. Search workflow based on workflow name.
  2. Edit workflow.
  3. Remove workflow.
Images 42. List Of Workflow

Edit Workflow

After a workflow is success created, you may need to make changes or modify the workflow.

In this edit screen, the trainer can :

  1. Add New Activity.
  2. Remove Activity.
  3. Clone Activity.
Images 43. Edit Public Holiday Workflow

Remove Workflow

Deleting a workflow will terminates and removes the workflow from the list of workflows. To delete a workflow, at the top right side, click the ‘List of Workflow‘ button.

Images 44. Process Flow Page

For example, in the pop up list of workflow, select workflow name ‘Testing‘ and click the ‘Remove‘ button.

Images 45. List of Workflow

After a workflow is deleted, will appears success notification and the workflow is no longer available in the list of workflow.

Images 46. Success Notification of Remove Workflow

Workflow Log

Each time a workflow runs, a log entry is created. Log entries record the date and time the workflow was run, the data it operated on, status (success or failure of the workflow), description of status, component workflow, thread id and execute time.

In this trainer screen, the trainer can :

  1. View all workflow run.
  2. View why a workflow failed if an error occurred.
  3. Filter log based on range date.
  4. Search log based on workflow name.
Images 47. Workflow Log

Filter Log Based on Range Date

Choose the range date ‘From 11/02/2020‘.

Images 48. Filter of Workflow Log

Choose the range date ‘To 13/02/2020‘.

Images 49. Filter of Workflow Log

The system will display the workflow log with range date from ‘11/02/2020′ to 13/02/2020‘.

Images 50. Filter Workflow Log Based On Range Date ‘11/02/2020′ to 13/02/2020‘.

Search Log Based on Workflow Name

Type your workflow name in the search column, and then suggestion of workflow name will appears such as images below.

Images 51. Search Workflow Log – Suggestion of Public Holiday

Select and click suggestion of workflow name, and log will appears based on workflow name selected.

Images 52. Search Workflow Log Based On Public Holiday.
Was this article helpful?
Dislike 0