Skip to content

Logic of creating contacts and deals in the CRM system

1.An inquiry enters the system 2. Check whether the record is a duplicate. Inquiry A is considered a duplicate if:

  • there is an inquiry B with the same contact details and the same type as inquiry A;
  • inquiry B was created earlier than the current one or at the same time as the current one;
  • the difference between the creation times of the inquiries is no more than 3 seconds;
  • if inquiries A and B were created at the same time, inquiry B must either already be processed or be in processing at the moment inquiry A is checked for duplication;

If the inquiry is a duplicate, it is marked as a duplicate and processing stops. 3. Inquiry validation.

  • contact details must be specified (phone or e-mail); if neither a phone nor an e-mail is specified, the inquiry is not valid
  • the phone number must contain at least 6 digits
  • the e-mail must be passed in a valid format

If the message is not valid, a validation error record is saved and processing of the inquiry stops. 4.Check whether such a contact exists in the CRM. The contact is searched for by a matching phone number or email address.

  • If the contact is found, the system checks whether the inquiry contains any contact details that are missing from the CRM (for example, the CRM has only an e-mail, while the inquiry has both an e-mail and a phone). If so, the missing data is added to the contact.
  • If the contact is not found, a new contact is created.

  • If the inquiry specifies that a new deal should be created in any case (the create_new_lead attribute is set to ‘1’), a new deal is created immediately and step 6 is skipped.

  • If the contact exists, the system checks whether it has a deal. (If a new contact was created at step 4, it does not have a deal yet).

  • If the deal exists, its status and last modification time are checked.

  • If the deal status is in the “Not counted” or “In progress” group, the system checks whether the inquiry is a technical duplicate. Technical duplicates are repeated webhooks from call tracking and telephony systems; they contain information about the call.

  • If the inquiry is not a technical duplicate, a comment is added to the deal stating that this is a repeat inquiry, and other data from the inquiry is added.

  • If the inquiry is a technical duplicate and the call was answered successfully, the call information is added to the deal (call recording, duration, etc.)

  • If the deal is closed (status in the “Completed” or “Canceled” group) and time X has passed since the last modification, a new deal is created. If time X has not passed yet, the deal is updated.

  • If there is no deal, a new deal is created.

  • If “create a task in the CRM” is specified in the integration settings, and the inquiry is not a pre-call webhook, or a technical duplicate, or it is a technical duplicate but the call did not take place, a “Contact the client” task is created.

Flowchart