1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2024-12-16 11:38:11 +02:00
OpenIntegrations/docs/en/md/Bitrix24/Leads-managment/Create-lead.md
2024-08-23 08:56:30 +03:00

2.1 KiB

sidebar_position
1

Create lead

Creates a new lead by fields structure (see GetLeadStructure)

Function CreateLead(Val URL, Val FieldsStructure, Val Token = "") Export

Parameter CLI option Type 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 :::

    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/1o2...";

    Result = OPI_Bitrix24.CreateLead(URL, FieldsStructure);

    FieldsStructure.Insert("NAME"      , "Ivan");
    FieldsStructure.Insert("LAST_NAME" , "Ivanov");

    URL   = "b24-ar17wx.bitrix24.by";
    Token = "ec4dc366006e9f06006b12e400000001000...";

    Result = OPI_Bitrix24.CreateLead(URL, FieldsStructure, Token);
    
  oint bitrix24 CreateLead --url "b24-ar17wx.bitrix24.by" --fields %fields% --token "ec4dc366006e9f06006b12e400000001000..."