Web Callback Example
This section describes how to implement web callback technology into your website using the Database API.
Web callbacks allow any website visitor to request a callback through your website by entering their phone number and some relevant information in a form. To implement this feature, you need to perform the following steps:
- Create a new project in VCC Live or use an existing one, and make a note of the project ID. Add your required fields below the phone number and name fields, which are automatically created in every new project. Enable the Database API described above.
- You need to create a simple information request form on your own website, which visitors can fill in and send to your server by pressing the Submit button.
- You also need a server-side script, which receives form data and sends the given phone number and other relevant information to VCC Live’s database by calling the Database API
- The given number is stored on your VCC Live project database and an agent can manually (or by using our predictive dialer) dial the number immediately.
Note: To increase form-filling conversion rates, ask for as little information as possible. By doing this you can reduce the time it takes for visitors to complete the form, and thus more visitors will be willing to fill it in.
Warning: You should also bear in mind that many records can be inserted in a short time by harmful spam robots, so ensure that the form is filled by a genuine visitor by using, for example, captcha technology. You should also check the phone number’s prefix to avoid calling expensive private or international numbers.
For more information on Web Callback:
Below is the HTML form for retrieving a telephone number:
Add record
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-tpye" content="text/html; charset=utf-8" />
<title>Teszt form</title>
</head>
<body>
Request call back
<form method="post" action="webcallback.php">
Name: <input type="text" name="fullname" value="" /><br />
Your number*: <input type="text" name="phone" value="" /> (e.g.: +4211234567)<br />
<input type="submit" value="Submit" />
</form>
</body>
</html>
Below is a server-side PHP script, which receives and forwards form data to VCC Live’s Database API. This example code uses RestClient.php, which can be found in the ‘Advanced Example’ section above.
<?php
useVCCAPIv2RestClient;
if (empty($_POST['fullname']) or empty($_POST['phone'])) {
echo 'All fields required';
}
require_once ('../../RestClient.php');
$customer = 'CUSTOMER';
$password = 'PASSWORD';
$apiClient = new RestClient($customer, $password);
$data = array(
'name' = -- > $_POST['fullname'],
'phone1' => $_POST['phone'],
);
$projectId = 3;
$resource = sprintf('/v2/projects/%s/records', $projectId);
$result = $apiClient->post($resource, $data);
echo $result ? 'ok' : 'error';
Comments
Can’t find what you need? Use the comment section below to connect with others, get answers from our experts, or share your ideas with us.
There are no comments yet.