The usage of webhook will solve the task of receiving the data about the leads from:
The received data can be sent to your own CRM.
During the different events, the data is sent as GET-parameters to the addresses specified in the Deals handler address field and Address to receive additional information on the deal field in the integration settings. You can use this option while configuring your own CRM.
Event | Description |
---|---|
Lead from the Lead hunter | The data will be sent if the Send to CRM option is activated in the Lead hunter. |
Call from the Calltracking | The data will be sent during the phone call via Calltracking.
|
Lead from CRM | The data will be sent if you configured the integration with CRM. |
Parameters of the request
Parameter | Example | Description |
---|---|---|
id | 90 | The ID of the lead |
visit | 12852 | Visit number with the source of the lead |
title | Incoming call from 11230001122 | For the call from Calltracking For the lead from Lead Hunter For the lead from CRM |
text | Data of the form: 11230001122 | Additional information about the deal that is usually sent as a comment to the deal. For calltracking, the information about the dialed number is also sent in this field. |
name | Robert | This parameter is used for the Name field in the Lead hunter. |
phone | +11230001122 | The dialed number or the Phone field in the Lead hunter. |
email@mail.com | This parameter is used for the email address field in the CRM form | |
data | — | This parameter is used for Lead Hunter Additional fields and the values of additional fields are also transmitted to the data parameter. |
created_date | 2015-06-28 09:12:54 | Date and time of receiving the lead by Roistat (UTC+0) |
token | 6512bd43d9caa6e02c990b0a82652dca | The token is generated from login and password that are specified in the integration settings in the following format: md5('username' + 'password') |
action | lead | Event type |
Example of a request:
http://{webhook_url}/?user=&token={id_token}&action=lead&visit=9&id=6&title={title}&text={text}&name={name}&phone={phone}&email={email}&data={"page":"http:\/\/site.com\/"}&created_date={yyyy-mm-dd+hh%3Amin%3Asec} |
Notification | Description |
---|---|
Duplicated lead | Information about the call from the client that already has a deal in CRM |
Conversation history from CRM | The full history of conversation between the client and manager |
Parameters of the request
Parameter | Example | Description |
---|---|---|
leadId | 155 | Lead ID |
title | Duplicated lead | Title of the lead |
text | Duplicated lead from {Client name} {Email address} {Phone number} with a {Message in the lead} | Notification message |
action | message | Event type |
user | demouser | User name (specified in the integration settings) |
token | 6512bd43d9caa6e02c990b0a82652dca | The token is generated from login and password that are specified in the integration settings in the following format: md5('username' + 'password') |
1) Open the Roistat API: own CRM integration settings and specify the webpage addresses (webhook) in the Deals handler address field and Address to receive additional information on the deal field. For example, we will use the http://site.com/webhook.php address for both types of events.
2) On the http://site.com/webhook.php address, place the script that will receive the GET-parameters and operate with them.
Roistat should receive the following response:
{ "status" : "ok", "order_id" : "deal_ID_" } |
If Roistat does not receive this response, the data will be sent repeatedly once per several minutes until Roistat receives it.
The example of lead for receiving the information about the lead from the Lead hunter:
<?php if (array_key_exists('id', $_GET)) { $leadId = $_GET['id']; // Lead ID, for example "123" $leadTitle = $_GET['title']; // Title of the lead, for example: "Caught lead: 11231234567" $leadText = $_GET['text']; // The containment of the Lead hunter form, for example: "11231234567" $roistatVisit = $_GET['visit']; // Visit number, the value of the roistat_visit cookie, for example: "1234" $data = json_decode($_GET['data'], true); // data - is a JSON parameter, that contains page key and its value - Landing page $page = $data['page']; // Landing page of the lead, for example: "http://site.com" // The information about the deal is sent CRM // Roistat resumes the ok response and the ID of a deal if everything is OK. If this response won't be transmitted, the information about the lead will be sent to this page once per several minutes: exit(json_encode(array("status" => "ok", "order_id" => $orderId))); } |