Create lead
Creates a new lead by fields structure (see GetLeadStructure)
Function CreateLead(Val URL, Val FieldsStructure, Val Token = "") Export
Parameter | CLI option | Type | Required | Description |
---|---|---|---|---|
URL | --url | String | ✔ | URL of webhook or a Bitrix24 domain, when token used |
FieldsStructure | --fields | Structure of KeyAndValue | ✔ | Lead fields structure (see GetLeadStructure) |
Token | --token | String | ✖ | Access token, when app auth method used |
Returns: Map Of KeyAndValue - serialized JSON of answer from Bitrix24 API
tip
Method at API documentation: crm.lead.add
1C:Enterprise/OneScript code example
EmailsArray = New Array;
EmailsArray.Add(New Structure("VALUE,VALUE_TYPE", "yo@example.com", "HOME"));
EmailsArray.Add(New Structure("VALUE,VALUE_TYPE", "hi@example.com", "WORK"));
PhonesArray = New Array;
PhonesArray.Add(New Structure("VALUE,VALUE_TYPE", "88005553535", "WORK"));
FieldsStructure = New Structure;
FieldsStructure.Insert("ADDRESS" , "Pushkin st., b. 10");
FieldsStructure.Insert("ADDRESS_COUNTRY", "Russia");
FieldsStructure.Insert("EMAIL" , EmailsArray);
FieldsStructure.Insert("NAME" , "John");
FieldsStructure.Insert("LAST_NAME" , "Doe");
FieldsStructure.Insert("PHONE" , PhonesArray);
FieldsStructure.Insert("TITLE" , "MegaClient");
URL = "https://b24-ar17wx.bitrix24.by/rest/1/yg2...";
Result = OPI_Bitrix24.CreateLead(URL, FieldsStructure);
FieldsStructure.Insert("NAME" , "Ivan");
FieldsStructure.Insert("LAST_NAME" , "Ivanov");
URL = "b24-ar17wx.bitrix24.by";
Token = "2f4e4067006e9f06006b12e400000001000...";
Result = OPI_Bitrix24.CreateLead(URL, FieldsStructure, Token);
- Bash
- CMD/Bat
# JSON data can also be passed as a path to a .json file
oint bitrix24 CreateLead \
--url "b24-ar17wx.bitrix24.by" \
--fields "{'ADDRESS':'Pushkin st., b. 10','ADDRESS_COUNTRY':'Russia','EMAIL':[{'VALUE':'yo@example.com','VALUE_TYPE':'HOME'},{'VALUE':'hi@example.com','VALUE_TYPE':'WORK'}],'NAME':'Ivan','LAST_NAME':'Ivanov','PHONE':[{'VALUE':'88005553535','VALUE_TYPE':'WORK'}],'TITLE':'MegaClient'}" \
--token "***"
:: JSON data can also be passed as a path to a .json file
oint bitrix24 CreateLead ^
--url "b24-ar17wx.bitrix24.by" ^
--fields "{'ADDRESS':'Pushkin st., b. 10','ADDRESS_COUNTRY':'Russia','EMAIL':[{'VALUE':'yo@example.com','VALUE_TYPE':'HOME'},{'VALUE':'hi@example.com','VALUE_TYPE':'WORK'}],'NAME':'Ivan','LAST_NAME':'Ivanov','PHONE':[{'VALUE':'88005553535','VALUE_TYPE':'WORK'}],'TITLE':'MegaClient'}" ^
--token "***"
Result
{
"result": 394,
"time": {
"start": 1728454941.45396,
"finish": 1728454942.16614,
"duration": 0.712172985076904,
"processing": 0.685149908065796,
"date_start": "2024-10-09T09:22:21+03:00",
"date_finish": "2024-10-09T09:22:22+03:00",
"operating_reset_at": 1728455541,
"operating": 0.685086011886597
}
}