Automation of receiving the client's phone number from an incoming e-mail

8 July 2024

next article
Nataly Shpak

Backend Developer

Nataly Shpak
Automation of receiving the client's phone number from an incoming e-mail

About the author: Natalya Shpak, an experienced backend developer of the Avivi company, has considerable experience in working with CMS systems used in eCommerce projects and designed to bring profit to their customers. To her credit, there are many successful solutions to business tasks that allow customers to get more profit due to the accuracy of realized needs.

Customer information, especially contact information, is always useful for any business. However, obtaining this data is not always easy. In modern conditions, the automation of remote work with clients involves facilitating the processing of incoming information by managers of an established business or startup. The implementation of various sources of information exchange makes it easier for customers to do business with the company, because it allows them to choose the one that is most convenient for them. But on the other hand, the company must take care of the methods of obtaining data from the client, which it needs for further marketing activity. One of the best contacts you can get from a customer is a cell phone number:

  • You can always call back to talk directly;

  • You can find a person on social networks by phone number;

  • It is possible to send SMS, etc.

Today, everyone and everywhere asks for a phone number, so average users are less and less inclined to leave this data when registering for services or making purchases. However, if you use a CRM system, you can get a phone number simply and without putting too much pressure on the customer, for example, through e-mail.

Advantage of CRM

Avivi has been implementing and customizing CRM systems since 2014, and we have unique experience in creating productive solutions for any need. But for my part, I note that the main effectiveness of using the CRM system lies precisely in the ease of processing information and distributing it in the necessary directions. To confirm my words, I propose to consider the method of extracting the client's phone number from the received e-mail. To solve this problem, we will use a method that involves extracting the phone number from the body of the letter upon its arrival in the CRM system. I will only note that for this your CRM must be integrated with the postal service and if this has not yet happened, Aviviv specialists will be happy to help in this matter.

Let's consider the step-by-step implementation of the necessary functionality implemented on the basis of CRM from Bitrix24. Avivi has more than two hundred successful projects of varying complexity regarding the implementation and customization of this product, but for any other CRM, this scenario remains almost identical. The step-by-step script for getting a phone number looks like this:

  1. A webhook is attached to the mail client, which monitors the fact of the receipt of the letter and transmits it to the analyzer;
  2. Conducting an analysis and obtaining the necessary information both from the headers and from the body of the incoming letter. If you can easily get the sender's email address from the properties, then getting contact information, such as a phone number, requires additional analysis of the text in the body of the letter;

  3. Saving the phone number in the appropriate CRM entity: Lead, Contact or Agreement.

How to get a phone number?

Automating the process of obtaining contact information that does not fall under the standard of electronic correspondence involves clearly following the filling templates. Data such as phone number or other can be sent following predetermined patterns. In the future, this will facilitate obtaining the necessary information using an automated processor and further distribution to the appropriate manager of the company. Otherwise, you will have to search for the desired entry in the letter, but this task is also within the power of an experienced developer.

The algorithm for processing the body of the letter presupposes its preliminary cleaning of all information that may be considered technical, and therefore not to affect its further appearance. Unfortunately, a large number of "unnecessary" characters can significantly impair the probability of correct automated analysis, which requires the creation of additional filters and rules. Next, a step-by-step analysis of the tapes and selection of the necessary parts that correspond to known patterns is carried out. For example, a "mask" is used to recognize the phone number, which can be written by the client together, through hyphens, or with spaces.

All received information is converted in accordance with the technical task. For example, a Lead or Agreement can be created, or it can simply be a notification for the responsible manager. These are purely individual moments for each customer, determined by the company's business processes.

Visualization of the algorithm for obtaining a phone number

All of the above can be depicted as follows:

A letter has arrived → The webhook passes the letter to the analyzer → The analyzer receives the sender's e-mail address from the headers of the letter → The analyzer checks the body of the letter for the presence of parts that correspond to known patterns → [Final step, according to the TK (for example, a Lead is created with the sent information).

What should not be forgotten?

Despite the simplicity of the method and clear algorithms, this method has both advantages and disadvantages, about which I have to inform the readers of the Avivi blog. Let's look at the main "pros" and "cons" of the body of the letter for obtaining contact information.


  1. Acceleration of processing of incoming messages by company employees. The manager does not need to read all incoming emails, because only those belonging to clients for which he is responsible are transferred to him;

  2. Automation of work with new clients. The algorithm of actions with clients whose contact information is not in your database can be prescribed separately. For example, creating a new Lead with a request from a new client.


In the event that the contact information does not correspond to existing templates and patterns, which may be the case when the client writes a letter without using automated methods, its further processing may be difficult. For example, a customer decides to write a phone number using a dot as a separator. Customers are extremely resourceful and it is simply impossible to predict all options of their actions.


The use of the automation system for obtaining contact information from the received e-mail increases the level of automation of running a business or a startup and can have a positive effect, such as the response time, reducing the individual burden on the manager. For the client, this will mean a faster response to his request and, as a result, better fulfillment of his order. For the company, this means saving working time, facilitating the work of employees, and most importantly, guaranteed receipt of contact information. So if you are wondering: "Is it worth it or not to automate the processing of incoming letters?", I confidently answer — yes, it is worth it. And the Avivi development team will do its best to make this process happen clearly and harmoniously.

Get more with Avivi!

Similar articles
Apply for a consultation

We will reach out to within 10 minutes