Loading...
Page tree
Skip to end of metadata
Go to start of metadata

Description

Webhook is a mechanism that tracks your incoming calls by sending the notifications with parameters of calls to the third-party apps.

With the help of the Webhook, you can send the information about incoming calls.

Work principle of webhook notifications

Information about the incoming call may be sent to the third-party system during the call and after the call. 

(информация) Information is sent to Webhook regardless of proxy lead. There are no restrictions on information sending. 

Webhook in the moment of call

During the time when Roistat dials the number, POST-request is automatically sent to the destination address. 

Data about the call is sent in the body of POST-request as JSON-object:

 Click here to expand
{
  "id": "313", // unique call number
  "caller": "12125096995", // subscriber's number
  "callee": "12125097518", // dialed number
  "visit_id": "123456", // visit number
  "marker": "fb_new", // visit source
  "order_id": 123456789, // ID of the deal in CRM
  "date": "2019-02-19 00:00:00", // date of the call
  "google_client_id": "111111111.1111111111", // client ID in Google Analytics
  "custom_fields": [], // custom fields of the deal
  "landing_page": "test.com/new", // landing page
  "domain": "test.com",
  "city": "New York", // city
  "country": "USA", // country
  "ip": "161.185.160.93", // IP-address
  "first_visit": "1001", // first visit
  "referrer": "fb.com", // referrer webpage
  "utm_source": null,
  "utm_medium": null,
  "utm_campaign": null,
  "utm_term": null,
  "utm_content": null,
  "roistat_param_1": null,
  "roistat_param_2": null,
  "roistat_param_3": null,
  "roistat_param_4": null,
  "roistat_param_5": null,
  "source_level_1": "fb",
  "source_level_2": "new"
}

Webhook after call

After the end of the incoming call, Webhook automatically sends the POST-request to the destination address. 

Data about the call is sent in the body of POST-request as JSON-object:

 Click here to expand
{
  "id": "313", // unique call number
  "caller": "12125096995", // subscriber's number
  "callee": "12125097518", // dialed number
  "visit_id": "123456", // visit number
  "marker": "fb_new", // visit source
  "order_id": 123456789, // ID of the deal in CRM
  "date": "2019-02-19 00:00:00", // date of the call
  "google_client_id": "111111111.1111111111", // client ID in Google Analytics
  "custom_fields": [], // custom fields of the deal
  "landing_page": "test.com/new", // landing page
  "domain": "johnson94.myjuno.com",
  "city": "New York", // city
  "country": "USA", // country
  "ip": "161.185.160.93", // IP-address
  "first_visit": "1001", // первый визит
  "referrer": "fb.com", // referrer webpage
  "utm_source": null,
  "utm_medium": null,
  "utm_campaign": null,
  "utm_term": null,
  "utm_content": null,
  "roistat_param_1": null,
  "roistat_param_2": null,
  "roistat_param_3": null,
  "roistat_param_4": null,
  "roistat_param_5": null,
  "source_level_1": "fb",
  "source_level_2": "new",
  "status": "ANSWER", // status of the call
  "file_id": null,
  "duration": 20, // call duration
  "link": "" // record of the call
}

Field "status" may contain one of the following values: 

  • ANSWER – the call was accepted and processed by the manager;

  • BUSY – there was incoming call, but the line was busy;

  • NOANSWER – there was incoming call, but the manager did not answer it during the waiting of reply;

  • CANCEL – there was incoming call, but it was ended before the manager answered;

  • CONGESTION – the call was failed due to technical issues;

  • CHANUNAVAIL – the dialed number was unavailable;

  • DONTCALL – the incoming call was canceled;

  • TORTURE – the incoming call was redirected to the voice mail.

Example of a handler that supplements the log:

<?php
$data = json_decode(trim(file_get_contents('php://input')), true);
file_put_contents('webhook-log.html', serialize($data) . '<br />', FILE_APPEND); // In $data will be array "key" => value with information about the letter described above

Warning! The information is sent in JSON-format, so

$id = $_POST['id']; // Incorrect

Webhook setup

Two steps of the Webhook setup:

Step 1. Identification of the third-party app URL.

Copy the URL of the third-party app that must receive notifications from Roistat.


Step 2. Webhook setup in Roistat.

To configure the Webhook, you need to specify the URL that must receive notifications from Roistat. 

To do it, go to Step 5 «Configure the integration» in call tracking settings and specify the copied URL in «Webhook in the moment of call» and/or in «Webhook after call»:

The configuration will be saved after you click the Activate scenario button.

The URL address will be displayed in the same text field. 

Notifications can be sent only to one destination address.


You need to verify the correctness of the specified address if does not receive the notifications about incoming calls.


To change the URL, just specify another URL in the text field and save it by clicking the Activate scenario button.

To switch off the Webhook, delete the URL address from the text field and click the Activate scenario button.



  • No labels