Application from website
ViewController
For a consultant to work, you need to register a ViewController with the name consultant
.
Important: ViewController is registered once for all the online consultant forms
CreateWidget
To create a chat widget, you need to call the method CallGear.UI.createWidget()
with the following parameters:
widgetName
= 'consultant_offline_message'
Example
CallGear.UI.registerViewController('consultant', function (settings, tpls) {
...
var consultantOfflineMessage = CallGear.UI.createWidget('consultant_offline_message', {
settings: settings,
template: tpls['consultant_offline_message'],
...
});
...
consultantOfflineMessage.render();
});
Methods
sendRequest(data)
The method allows you to send requests with the specified fields.
The data
object may contain the following features:
name
- visitor name.email
- visitor e-mail.phone
- visitor phone number.message
- application text.group_id
- ID of an employees group to which this application should be distributed. The field must be filled in if the option "Distribution of applications by employee groups" is activated in the application settings.
Events
sendofflinerequest
The event occurs after application is sent. It allows you to find out if the sending was successful.
sendofflinerequest event features: object containing the following fields:
- success -
true
, if a call was requested,false
, if an error accured. - info - an object containing text fields
title
andmessage
to display the message to a website visitor.