Adding Lead & Contact to amoCRM from Website
This Script automatically creates connected Lead and Contact in amoCRM when sending Data from a standart html-form on your Website. With small adjustments, this Script can be easily adapted to integrate amoCRM with any Website using html-form.
Binding of Contact to the Lead
All Contacts are linking to the relevant Leads.
If Contact with the Email already exists, Leads are linking to the existing Contact. The new Contact isn't creating.
However, there is a small bug in the internal contacts search algorithm of amoCRM. If an email address before or after the at sign @ contains less than 3 characters, then these characters are not considered in the search, and the Lead can be attached to a similar Contact.
Fortunately this bug occurs very rarely.
The file prepare.php: Edit the data of resuting Array in this file so that it coincide with the data sent from the html-form;
The file auth.php: Replace the authorization Data on your amoCRM Data: Username (email), Hash (API key) and Subdomain;
The file fields_info.php: Edit the list of Variables for the custom Fields as you need at the top of the Script;
The file lead_add.php: Edit additional Fields Id as well as Variables that you want to send to this Fields.
At this Repository I created a convenient test function.
You needn't to fill out a form each time and make an order on Service that you are integrating.
Just open thethe root folder ( file test/index.html) after loading the Script on your hosting, and you'll see simple example of html-form. Full fill the form and click "Create Lead & Contact", and you'll see the result.
If you have any questions, write to me in PM.
I'll be glad to help you!