Bitrix24: Blogs
  • How To: Lead creation from external services

    Ann Slyshkina 26 April 2013
    Suppose you have a form on a site that visitors can fill out. Using the REST API of Bitrix24, you can use the data received in this form to create a lead in the CRM.
    fbf4ccb2ffe224d57b1ab0a21376c7ae.gif
    The REST API can be used to only to import leads in the CRM. Soon, the API will be capable of importing other CRM entities (contacts, companies and deals).

    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:
    1. Call this page with a GET or POST method
    2. Pass at least 3 required parameters: login and password of the user who is the creator of the lead, and the title of the lead.
    The script will return a JSON-object with the parameters code and error_message.

    Table 1: Response codes and descriptions
    CodeDescription
    400Parameters missing or parameters invalid
    403Authorization or access error
    201Lead added
    Table 2: Parameters
    ParameterTypeDescription
    LOGIN* StringLogin
    PASSWORD* StringPassword
    TITLE*StringTitle
    COMPANY_TITLE StringCompany Name
    NAMEStringFirst Name
    LAST_NAME StringLast Name
    SECOND_NAMEStringSecond Name
    POSTStringPosition
    ADDRESSStringAddress
    COMMENTSStringComment
    SOURCE_DESCRIPTIONStringSource Description
    STATUS_DESCRIPTIONStringStatus Description
    OPPORTUNITY DoubleOpportunity
    CURRENCY_IDStringCurrency
    PRODUCT_IDStringProduct
    SOURCE_IDStringSource
    STATUS_IDStringLead Status
    ASSIGNED_BY_IDIntResponsible
    PHONE_WORKStringWork Phone
    PHONE_MOBILEStringMobile
    PHONE_FAXStringFax
    PHONE_HOMEStringHome Phone
    PHONE_PAGERStringPager
    PHONE_OTHERStringOther Phone
    WEB_WORKStringCorporate Site
    WEB_HOMEStringPersonal Site
    WEB_FACEBOOKStringFacebook Page
    WEB_LIVEJOURNALStringLiveJournal Page
    WEB_TWITTERStringTwitter Account
    WEB_OTHER StringOther Site
    EMAIL_WORKStringWork E-mail
    EMAIL_HOMEStringPersonal E-mail
    EMAIL_OTHERStringOther E-mail
    IM_SKYPEStringSkype
    IM_ICQStringICQ
    IM_MSNStringMSN/Live!
    IM_JABBERStringJabber
    IM_OTHERStringOther Messenger
    * - required parameter

    The STATUS_ID , SOURCE_ID , CURRENCY_ID, and PRODUCT_ID parameters are selected from a corresponding directory of the CRM.

    Below are tables with value sets of these parameters after installation of the module.
    Important: values can be changed by the intranet administrator or deleted.

    Table 3: STATUS_ID – Lead Statuses
    ValueDescription
    NEWUnassigned
    ASSIGNEDResponsible Assigned
    DETAILSWaiting for Details
    CANNOT_CONTACTCannot Contact
    IN_PROCESSIn Progress
    ON_HOLDOn Hold
    RESTOREDRestored
    CONVERTEDConverted
    JUNKJunk Lead
    Table 4: SOURCE_ID – Sources
    ValueDescription
    SELFPersonal Contact
    PARTNERExisting Client
    CALLCall
    WEBWebsite
    EMAILE-Mail
    CONFERENCEConference
    TRADE_SHOWShow/Exhibition
    EMPLOYEEEmployee
    COMPANYCampaign
    HRHR Department
    MAILE-Mail Message
    OTHEROther
    Table 5: CURRENCY_ID – Currencies
    Value Description
    USD US Dollar
    EUR Euro
    Table 6: PRODUCT_ID – Products
    Value Description
    PRODUCT_1 Bitrix Site Manager
    PRODUCT_2 Bitrix Intranet
    OTHER Other
    Aside from the main fields, a lead may have additional custom fields created by the intranet administrator. They can also be passed to the page.

    I’m including a file that contains an example script that can be used on your site to create forms and transfer data to the CRM.
    Before using this file, you will need to open it and enter your Bitrix24 domain and an account of a user with the right to add a lead.

    ! We recommend using a separate user with access only to add leads and without access to anything else.
1,000,000+
organizations
are already using Bitrix24