Zadarma crm

With an open API interface you can connect Zadarma free CRM to any client connection channel.

One of the simplest and most popular channels is a form on the website. Below you can find an example of a fully functional request form or a feedback and Lead creation form in Teamsale CRM based on this information.

To minimize this example, we are taking a very basic form. We recommend modifying it when using on your website, at least choosing an appropriate style and adding spam control (captcha).

It is an HTML form written without elements or libraries, inserted into your website code. For this form to work you also need to input a script for adding data into Teamsale CRM, it is written in PHP.

Code installation steps for lead creation in CRM from a website form

  1. Check if the free CRM is enabled and active, if not register and enable.
  2. Receive API keys in your personal account.
  3. Using the route https://my.site.com/zcrm_leads create a script for sending information from the form to CRM via API (this is a PHP example). In the fields UserKey and Secret you need to enter your key and password received in step 2.
  4. <?php
    $postData = $_POST;
    if ($postData) {
       if (isset($postData['phones'], $postData['phones'][0], $postData['phones'][0]['phone'])) {
           $postData['phones'][0]['type'] = 'work';
       if (isset($postData['contacts'], $postData['contacts'][0], $postData['contacts'][0]['value'])) {
           $postData['contacts'][0]['type'] = 'email_work';
       $params = ['lead' => $postData];
       $params['lead']['lead_source'] = 'form';
       $leadData = makePostRequest('/v1/zcrm/leads', $params);
       if (isset($leadData['status'], $leadData['data'], $leadData['data']['id'])
           && $leadData['status'] === 'success'
           && (isset($postData['comment']) && !empty($postData['comment']))
       ) {
           //If a client is created, then add a text note to the timeline
           $addFeedMethod = sprintf('/v1/zcrm/customers/%s/feed', $leadData['data']['id']);
           $messageData = ['content' => $postData['comment']];
           makePostRequest($addFeedMethod, $messageData);
    function makePostRequest($method, $params)
       //Change userKey and secret to the ones from your personal account
       $userKey = '';
       $secret = '';
       $apiUrl = 'https://api.zadarma.com';
       $paramsStr = makeParamsStr($params);
       $sign = makeSign($paramsStr, $method, $secret);
       $curl = curl_init();
       curl_setopt($curl, CURLOPT_URL, $apiUrl . $method);
       curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');
       curl_setopt($curl, CURLOPT_POST, true);
       curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10);
       curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
       curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
       curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
       curl_setopt($curl, CURLOPT_POSTFIELDS, $paramsStr);
       curl_setopt($curl, CURLOPT_HTTPHEADER, [
           'Authorization: ' . $userKey . ':' . $sign
       $response = curl_exec($curl);
       $error = curl_error($curl);
       if ($error) {
           return null;
       } else {
           return json_decode($response, true);
    * @param array $params
    * @return string
    function makeParamsStr($params)
       return http_build_query($params, null, '&', PHP_QUERY_RFC1738);
    * @param string $paramsStr
    * @param string $method
    * @param string $secret
    * @return string
    function makeSign($paramsStr, $method, $secret)
       return base64_encode(
               $method . $paramsStr . md5($paramsStr),
  5. Add lead generation form and its transfer to API to your website code: (Hidden fields are required)
  6. <form method="POST" action="/zcrm_leads">
       <label for="name">Name:
       <input type="text" id="name" name="name" value="">
       <label for="comment">Comment:</label><br>
       <input type="text" id="comment" name="comment" value="">
       <label for="phone">Phone:</label><br>
       <input type="text" id="phone" name="phones[0][phone]" value="">
       <label for="phone">Email:</label><br>
       <input type="text" id="email" name="contacts[0][value]" value="">
       <input type="submit" value="Submit">
  7. The form is now created and is fully functional. Since it has no design, it will look something like this:

We recommend using your style and security (for example, free reCAPTCHA). You can also modernize a form or a script to enter other field, or a new section (to contacts or tasks). Learn more about integration capabilities and methods on the Teamsale CRM API page.