What should one do if they have a website or landing page, they'd like to use to collect visitor requests or orders to be processed within Bitrix24 CRM?
How to retrieve contacts from a form on the site
2 min
Firstly, one should navigate to the "Other" section and select the basic "Inbound Webhook" template.
An example has been prepared, which can be downloaded and uploaded to the server, similarly to the procedure outlined in the "Local Integrations" lesson.
Upon returning to the Bitrix24 interface, one can observe an incoming webhook has already been prepared for use in creating a contact.
It is important not to overlook adding the CRM scope in the "Assign permissions" block.
Next, we turn our attention to examining the example code. The code contains the previously mentioned SDK, the insertion of inbound webhook code into the settings.php file should not be forgotten.
The primary function of the example lies in the index.php file, which displays the web form and implements the addition of a contact to the CRM.
The web form, displayed in the initial part of the example, contains the minimum three fields necessary for our purpose: first name, last name, and phone number. Additional fields may be added as necessary. Upon submission, the same index.php file is invoked, this time with the standard REQUEST array having been filled via a POST request. All that remains is to extract the relevant data from the array and substitute it into the parameters of the crm.contact.add method, similarly to previous examples in the course.
Finally, to verify the example's functionality, we open the index.php in a browser, fill out the form with test data, and submit it. If the example has worked as intended, a new contact will be visible in the contact section of Bitrix24.