It is now possible to implement the Call Back Widget into your own custom forms. Below you will find an explanation of the JavaScript function you can use for this.
Add this function to the OnClick event for the "Call me" button in your form.
__fs_dncs_instance.requestCallback(
'ADV_ID',
Answering_number_id,
Country_code,
customer_phonenr,
'caller_id',
{
'custom_1xx' : 'xxxxxx',
'custom_1yy' : 'yyyyyy'
},
call_time,
success/error handler(ref, data),
null,
retries
);
Here is a short description of each parameter:
'ADV_ID' - This is the UUID of the Kaisa subaccount
Answering_number_id - This is the ID of the answering number you entered in the Dashboard
Country_code - This is the default country code used
customer_phonenr - This is where you pass in the phone number of the user
'caller_id' - Here you pass in which Caller ID should be used by the CBW. It must be a phone number without spaces. Ex '+4420123456'
custom_* - Here you can pass in the custom info you would like to save regarding the user. These fields will be visible in your CSV reports over calls. Please note, you will need to contact support before using custom fields.
call_time - Here you can pass in null for a direct callback or a UTC Unix Epoch Timestamp in seconds for a scheduled call in the future. If call_time is an integer lower than 10'000'000, it is interpreted as a relative timestamp from now. For example, 600 is interpreted as that the call should be scheduled in 10 minutes from now.
success/error handler(ref, data) - function for handling the response from Kaisa
null - Used with ref - Function for use together with the previous one if needed. If not needed, leave as null
retries - Used to specify the number of times the CBW will attempt to make the call if the first call fails. Default is 2, Options: 0-3.
Here is an example of how the function could be implemented, using a form that asks for the user's phone number, name and email address:
__fs_dncs_instance.requestCallback(
'xxxxxx-xxxx-xxxx-xxxxxx',
1,
44,
phonenr,
'+4420123456789',
{
'custom_111': $name,
'custom_112': $email
},
null,
function(ref, data) {
alert(JSON.stringify(data));
},
null,
1
);
Example responses:
{"status": "ok", "call_uuid": "123e4567-e89b-12d3-a456-426655440000"}
{"status": "fail", "phonenr": "Parameter phonenr is invalid"}
{"status": "fail", "time": "\"time\" must not be in the past"}
Comments
0 comments
Please sign in to leave a comment.