Skip to content

Sending Information About the Call Using Webhook

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.

How Webhook Notifications Work

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:

{
  "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 web page
  "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:

{
  "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 web page
  "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
}

The status field may contain one of the following values:

  • ACTIVE – the call is in progress;
  • 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 call described above

Please note:

The information is sent in JSON-format, so

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

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 the Integrations step in call tracking script settings and insert the copied URL in Webhook at the time of the call and/or Webhook after call fields:

1.png

The configuration will be saved after you click the Save button.

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

Please note:

  • 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, save the settings, and enable the script.

To switch off the Webhook, delete the URL address from the text field, save the settings, and enable the script.