Configure Regular Expressions
Regular expressions are templates of questions and messages for which the chatbot can send replies. You can find regular expressions on the chatbot control panel:
To create a regular expression, you must have a good knowledge of a special formalized query language. The idea of the language is that some characters of a message (question) are replaced by such special characters as ^ $ * + ? { [ ] \ | ( ). They make questions more universal.
Imagine that customers sent the following questions:
- Hello! Tell me how do I collect my goods?
- Could you tell me how to collect the goods?
- I don't know how to collect the goods. Please, tell me about that.
These questions are different, but they have something in common:
- All of them have a sequence of words “how”, “collect”, and “goods”.
- Chatbot must send the same answer to these questions.
If you want to teach the chatbot to answer these questions, do the following:
- On the BotApp24 control panel, click
.
- On the Add Item window, fill in the fields:
- In the first field, specify the reply that the chatbot must send.
- In the second field, specify a regular expression. For example, you can use the following regular expression for these messages:
/.*How.*collect.*goods.*/miu
In the example below, you can find a detailed description of this regular expression. - In the State drop-down list, select Switched on.
- Save your changes.
- Refresh the browser page.
- Make sure that the regular expression has the Switched on value in the State column.
- Configure the Open Channel and test the chatbot
IMPORTANT. If your regular expression contains an error, you won’t receive an automatically generated reply from the chatbot.
Grant edit rights in the Open Channel List and General Settings entities in the open channel rights settings. If these items are disabled, the bot will not work.
To modify the regular expression, click . In the dialog box that opens, make necessary changes or delete the regular expression.
Example. Create Regular Expression
Regular expression /.*How.*collect.*goods.*/miu can be applied to generate an answer for the following three questions:
- Hello! Tell me how do I collect my goods?
- Could you tell me how to collect the goods?
- I don't know how to collect the goods. Please, tell me about that.
All regular expressions start with / and end with /miu.
A period (.) may replace any character, except for a line break. An asterisk (*) declares that a character can repeat 0 or more times until the word specified in the regular expression is met. On the picture below, you can read how it actually works:
Sentence “Hello! Tell me how do I collect my goods?” has phrase “Hello! Tell me” before word “how”. This part of the phrase consists of letters, an exclamation point, and spaces. The period character replaces any of these characters. If there was only a period, then only one character could be before word “how”, for example, a space character or not character at all. An asterisk declares that any number of character can be before word “how”. This principle explains why a period and an asterisk is between other words.
You can find the list of special characters in topic "Special Characters for Regular Expressions". We recommend that you check regular your expressions in the special services, such as ”Regular Expressions”. Keep in mind that if your regular expression contains an error, you won’t receive an automatically generated reply from the chatbot.
- Installing Application
- Channels connection
- Messenger integration
- WhatsApp integration
- WhatsApp Business API integration
- Telegram integration
- Viber integration in Bitrix 24
- Telegram bot integration
- Integration of Avito
- How to start a dialogue with a Telegram user
- Send message first from CRM
- Duplicate leads and deals
- About BotApp24
- Install BotApp24
- Teach Chatbot
- Create Chatbot
- Connect Chatbot to Bitrix24
- Add Chatbot to Open Channel
- Test Chatbot
- Configure Data Collection
- Chatbot Response to WhatsApp Calls
- Setting up a chatbot to collect feedback
- Configure Regular Expressions
- Special Characters for Regular Expressions
- FAQ. BotApp24