We have recently refreshed our branding across our offerings and changed the names of our pricing plans. If you have signed up before Aug 9, 2021, please click Previous plans to view your applicable plans.
We assure you that this change will not impact your product experience, and no action is required on your part.


Setting up dialogs in your bot builder to send out preset responses to customers is pretty straightforward. You can also dynamically populate values in your dialogs to help your customers with contextual responses.


The bot builder provides you with commonly used functions for your daily operations, such as fetching current date, separating strings by a delimiter, manipulating date and time, etc. These Functions act as placeholders and take care of populating values for these fields dynamically. What’s more, you can also define how you want each function to behave or collect information by declaring them as Inputs. The inputs are predefined for each function, and you can also use placeholders from other dialogs, API, or custom/default properties for each of these functions.


For example, you can ask your customer their name, and while saving it, you can use a function to ensure that it is saved in the title case. Listed below are the explanations for the functions offered by the bot builder. You can use the corresponding function in your dialog to dynamically populate values in your bot.



Function name and description
What inputs do you provide?
Examples
Split
Split a text string at the specified separator and returns the value based on the specified index.
Input text:
The text that needs to be split

Separator:
The character at which you need the text to be split

Index:
The position of the text that needs to be returned. The index position of the string before the separator is zero, and the index position of the string after the separator is one.
Input text:
support@freshchat.com

Separator:
@

Index:
0

Output:
support
Convert to title case
Convert the formatting of a text string so that it is stored in the title case where the first letter of each word is capitalized.
Input text:
The text that needs to be converted to the title case

Input text:
customer service

Output:
Customer Service

Get days between
Returns the count of the number of days between two specified dates (inclusive of the end date)
Start date:
The date from when the counting should start (not included)

End date:

The date till when the counting should continue (included in the count)

Format:

The format in which you are specifying the dates
Start date:
01-01-21

End date:

01-01-22

Format:

dd-MM-yy

Output:
365

Add minutes to date
Adds the specified number of minutes to the specified date
Input date:
The date to which the minutes need to be added

Minutes:

The number of minutes that need to be added to the input date

Format:

The format in which you are specifying the date and time

Input date:
01-01-21 00:15:00

Minutes:

51

Format:

dd-MM-yy HH:mm:ss

Output:

01-01-21 01:07:00
Add hours to date
Adds the specified number of minutes to the specified date
Input date:
The date to which the hours need to be added

Hours:
The number of hours that need to be added to the input date

Format:
The format in which you are specifying the date and time
Input date:
01-01-21 07:04:00 AM

Hours:
12

Format:
dd-MM-yy hh:mm:ss a

Output:
01-01-21 19:04:00
Add days to date
Adds the specified number of days to the specified date

Input date:
The date to which the days need to be added

Days:
The number of days that need to be added to the input date

Format:
The format in which you are specifying the date

Input date:
01-01-21

Days:
12

Format:
dd-MM-yy

Output:
13-01-21

Add days to date with timezone
Adds the specified number of days to the specified date that is denoted along with the timezone

Input date:
The date to which the days need to be added

Days:
The number of days that need to be added to the input date

Format:
The format in which you are specifying the date

Timezone:
The timezone that needs to be denoted along with the date
Input date:
01-01-2021 04:15:00 AM IST

Days:
7

Format:
dd-MM-yyyy hh:mm:ss a z

Timezone:
IST

Output:
08-01-2021 04:15:00 AM IST
Add working days to date with timezone
Adds the specified number of working days to the specified date that is denoted along with the timezone

Please note that, as of today, this function will only account for five working days per week — and will not take into account other holidays or weekday schedules.
Input date:
The date to which the working days need to be added

Working days:
The number of working days that need to be added to the input date

Format:
The format in which you are specifying the date

Timezone:
The timezone that needs to be denoted along with the date

Input date:
01-01-2021 04:15:00 AM IST

Days:
7

Format:
dd-MM-yyyy hh:mm:ss a z

Timezone:
IST

Output:
12-01-2021 04:15:00 AM IST

Add working days to date
Adds the specified number of working days to the specified date.

Please note that, as of today, this function will only account for five working days per week — and will not take into account other holidays or weekday schedules.

Input date:
The date to which the working days need to be added

Working days:
The number of working days that need to be added to the input date

Format:
The format in which you are specifying the date
Input date:
2021-31-01

Days:
7

Format:
yyyy-dd-MM

Output:

2021-09-02
Format date:
Changes the format of the date present, to a different, specified format
Input date:
The date whose format needs to be changed

Format:
The existing format of the specified date

Format:
The format to which the date needs to be updated
Input date:
2021-31-01

Format:
yyyy-dd-MM

Format:
dd-MM-yyyy

Output:
31-01-2021
Extract from list elements:
Split each element in a specified list based on the specified delimiter and returns one value for each element, based on the index value specified

Input list:
The list of elements from which a value needs to be extracted for each list element

Delimiter:

The character or sequence present in each list element. The function will split each list element at this character.

Index:

The position of the text that needs to be returned. The index position of the string before the delimiter is zero, and the index position of the string after the delimiter is one.
Input list:
Room#101, Room#102, Room#103, Room#104

Delimiter:

#

Index:

1

Output:
[101, 102, 103, 104]
Append content:
It takes the specified appended content and appends it to the specified main content 
Main content:
The content to which the text needs to be appended

Appended content:
The content which needs to get appended
Main content:
Hello

Appended content:
 World

Output:
Hello World
Split into list:
Splits the specified string into a list based on the specified delimiter
Main content:
The content that needs to be split into a list.

Delimiter:
The character/string that needs to be used to split the main content into a list.
Main content:
Option 1 and Option 2 and Option 3 and Option 4

Delimiter:
and

Output:

[Option 1, Option 2, Option 3, Option 4]

Extract from list:
Fetches any element from a list based on the specified position (index) of the element
Input list:
The list of elements from which the element needs to be extracted

Index:
The position of the text that needs to be returned. The index value starts from zero for the first element.
Main content:
Option 1, Option 2, Option 3, Option 4

Index:
2

Output:
Option 3
Count working days:
Counts the number of working days between the two specified days.

Please note that, as of today, this function will only account for five working days per week — and will not take into account other holidays or weekday schedules.
Date 1:
The date from when the counting should start

Date 2:
The date till when the counting should continue (included in the count)

Format:
The format in which you are specifying the dates
Date 1:
24-12-2021

Date 2:
06-01-2021

Format:
dd-MM-yyyy

Output:
11
Add integers
Adds any two specified integers
Input integer 1:
The first integer to which the second integer needs to get added.

Input integer 2:
The second integer which will get added to the first integer.
Input integer 1:
123

Input integer 2:
4

Output:

127
Get length
Returns the length of the specified string
Entity:
The string whose length is required
Entity:
Customer Service

Output:
16
Get current date:
Returns the current date in the specified format
Format:
Specify the format in which you need the current da
Format:
dd-MMM-yyyy hh:mm:ss a z

Output:

12-Feb-2021 02:11:23 PM UTC

Compare dates:
The function will compare the primary date with the secondary date and then returns:

1, if the primary date is greater than the secondary date.

0, if both dates are the same

-1, if the primary date is lesser than the secondary date 
Date 1:
The primary date

Date 2:

The secondary date

Format:

The format in which the dates have been entered
Date 1:
11-02-2021

Date 2:

03-02-2021

Format:
dd-MM-yyyy

Output:
1
Compute:
The function calculates the value of the specified expression, and returns the output with up to two decimal points
Input expression:
The expression that needs to be computed
Input expression:
8/(2*4) + (8/2)*4

Output:
17.00
Get JWT:
The function will take the respective inputs and give a JWT token as output
Claims:
A valid JSON expression that needs to be encoded. These claims include but are not limited to the issuer, subject, audience, etc.


JWT secret key:
Use a string to sign the header and payload content that is being encoded. 


Expiry (seconds):
Define the period of time (in seconds) for which the JWT will be valid.


Algorithm identifier:
Choose between HS256, HS384, or HS512 as the algorithm (signing or encryption) to use to process the data contained in the JWT.

Claims:
{

  "sub": "1234567890",

  "name": "John Doe",

  "iat": 1516239022

}


JWT secret key:
your-256-bit-secret


Expiry (seconds):
120


Algorithm identifier:
HS256

Get JWT:
The function will take the respective inputs and give a JWE token as output

Claims:
A valid JSON expression that needs to be encoded. These claims include but are not limited to the issuer, subject, audience, etc.


JWT secret key:
Use a string to sign the header and payload content that is being encoded. 


Expiry (seconds):
Define the period of time (in seconds) for which the JWT will be valid.


Algorithm identifier:
Choose between HS256, HS384, or HS512 as the algorithm (signing or encryption) to use to process the data.


JWE secret key:
Use a string to sign the header and payload content that is being encoded.


Source header:
Use a string to specify the source header

Claims:

 

 "sub": "1234567890",

  "name": "John Doe",

  "iat": 1516239022

}


JWT secret key:
your-256-bit-secret


Expiry (seconds):
120


Algorithm identifier:
HS256


JWE secret key:
your-256-bit-secret-part-two

Source header:

"alg": "HS256",

  "typ": "JWT"


Encode to base64:
The function will encode Username and Password with base64 encoding.

Username:
The username that needs to be encoded

Password
The password that needs to be encoded
Username:
John.doe@saulsstore.com

Password
AlwaysUseStrongLongPasswords
Ternary Operator:
This function behaves exactly like the ternary operator, using three values. It compares the first two values, and assigns one value if true and another value if false. 

LHS & RHS:

LHS and RHS can be any inputs, and this function will compare them.


Operator:

Define what the comparison between the LHS and the RHS needs to be using one of the following operators: Equals, Not equal, Greater than, Lesser than, Greater than or equals, Lesser than or equals.


If true

Define the value that needs to be output if the comparison is true


Else

Define the value that needs to be output if the comparison is not true

LHS:

Order status


RHS:

Delivered


Operator:

Equals


If true

Your order has been delivered


Else

Your delivery is still pending.



We have only used a few formats in our examples. You can make use of any of the standardized date and time formats.

All the input fields can take inputs from existing placeholders, such as dialogs, APIs, and parameters. Similarly, you can use the output from any function as a placeholder elsewhere.