You can set up integration with a landing page that is hosted by a third-party service. To do this, you need to create a script handler, which will collect orders from the landing page. The script will send requests to the system via the API to add orders in the project.
API (Application Programming Interface) is a description of the ways in which one computer program can interact with another program. In other words, as a part of our service, this is a method or tool which allows you to configure the integration (connection) between our system and other services.
To send orders to a project, you can use any API, both advanced and for webmasters.
Advantages:
- API for webmasters is available at all basic tariffs (except Cold Sales);
- this method is suitable for webmasters to connect their own landing pages to your project.
Disadvantages:
- When working with several webmasters, you need to revise the site and a more complex version of the script to assign orders to webmasters;
- Replacing the API key in the webmasters' personal account is inconvenient, it is problematic to connect new webmasters to this landing page.
To connect, you need to follow these steps:
In personal settings, allow yourself, as a webmaster, to import orders via API.
* At your hosting end, you have to make some settings: to create a script that will send requests to CRM to add an order. Then set up the order form on the website to transfer requests for this script.
Unfortunately, it is impossible to prepare a universal script that you could download and put on your hosting (for this you can use not API, but embedding the code of the form generated in the project on the site). But we made an example of the script for a very simple form on the landing page.
Here is an example of a script for transferring orders with a name and phone number of a customer and products that the customer has ordered:
<!--?php $project = "Name of the project"; $webmasterID = "webmaster’s id in the project"; $apiKey = "API-key for webmaster"; function sendOrder($orderData, $project, $apiKey, $webID) { $ch = curl_init(); curl_setopt_array($ch, [ CURLOPT_URL =--> "http://{$project}.leadvertex.ru/api/webmaster/addOrder.html?webmasterID={$webID}&token={$apiKey}", CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_HTTPHEADER => [ 'Content-Type' => 'application/x-www-form-urlencoded' ], CURLOPT_POSTFIELDS => http_build_query($orderData) ]); $response = curl_exec($ch); curl_close($ch); return $response; } $productList = [ 0 => [ 'goodID' => 15, 'quantity' => 1, 'price' => 500 ] ]; $orderData = [ 'fio' => $_POST['name'], 'phone' => $_POST['phone'], 'goods' => $productList, ]; sendOrder($orderData, $project, $apiKey, $webmasterID);
Wherein, in the "index" file in the landing page code, for the "action" parameter of the form, you need to input the name of the script that you uploaded to the directory.
Advantages:
- Simple connection;
- Ability to easily connect a new webmaster;
- Many parameters for transferring data to the project;
- It is not difficult to adapt the setting for different projects.
Disadvantages:
- The Advanced API is not available on all tariffs.(Available on CRM+ and CRM PRO)
To connect, you need to follow these steps:
* Here is a simple example script for sending orders via API for administrators (advanced)
<?php $project = "Name of the project"; $project = "Name of the project"; $apiKey = "API key for the project"; function sendOrder($orderData, $project, $apiKey) { $ch = curl_init(); curl_setopt_array($ch, [ CURLOPT_URL => "http://{$project}.leadvertex.ru/api/admin/addOrder.html?token={$apiKey}", CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_HTTPHEADER => [ 'Content-Type' => 'application/x-www-form-urlencoded' ], CURLOPT_POSTFIELDS => http_build_query($orderData) ]); $response = curl_exec($ch); curl_close($ch); return $response; } $productList = [ 0 => [ 'goodID' => 15, 'quantity' => 1, 'price' => 500 ] ]; $orderData = [ 'fio' => $_POST['name'], 'phone' => $_POST['phone'], 'goods' => $productList, ]; sendOrder($orderData, $project, $apiKey);
You can set up the integration on your own, or you can send a request to a tech support ticket for our specialist to set up an integration.