How to Create a Lead from external services in Bitrix24 CRM?

How to Create a Lead from external services in Bitrix24 CRM?

Suppose we have a form on our website that visitors fill out. Using the REST API of Bitrix24 CRM, we can use the data received from this form to create a lead in the CRM.

Creating leads in the CRM from external services can be done using the special-purpose page:

“your_name”.bitrix24.com/crm/configs/import/lead.php

 

For a lead to be added to the CRM you must:

Call this page with a GET or POST method

Example of Php Code :-

<?php

// CRM server connection data

 

define(‘CRM_HOST’, ”your_domain.bitrix24.com’); // your CRM domain name

define(‘CRM_PORT’, ‘443’); // CRM server port

define(‘CRM_PATH’, ‘/crm/configs/import/lead.php’); // CRM server REST service path

// CRM server authorization data

define(‘CRM_LOGIN’, ‘username’);

define(‘CRM_PASSWORD’, ‘password’);

// POST processing

if ($_SERVER[‘REQUEST_METHOD’] == ‘POST’)

{

$leadData = $_POST[‘DATA’];

// get lead data from the form

$postData = array(

‘TITLE’ => $leadData[‘TITLE’],

‘COMPANY_TITLE’ => $leadData[‘COMPANY_TITLE’],

‘NAME’ => $leadData[‘NAME’],

‘LAST_NAME’ => $leadData[‘LAST_NAME’],

‘COMMENTS’ => $leadData[‘COMMENTS’],

‘SOURCE_ID’=>$leadData[‘SOURCE_ID’],

‘CURRENCY_ID’=>$leadData[‘CURRENCY_ID’],

‘STATUS_ID’=>$leadData[‘STATUS_ID’],

‘CURRENCY_ID’=>$leadData[‘CURRENCY_ID’]

);

For any further queries get in touch we would be glad to help you Solve your Query