Contents
API Commands
close
Closes the Send Message UI.
Example
oMyPlugin.command('SendMessage.close').done(function(e){
// SendMessage closed successfully
}).fail(function(e){
// SendMessage failed to close
});
Resolutions
| Status | When | Returns |
|---|---|---|
| resolved | When Send Message is successfully closed | n/a |
| rejected | When Send Message is already closed | 'already closed' |
configure
Modify configuration options for Send Message.
Example
oMyPlugin.command('SendMessage.configure', {
formValidation: true,
SendMessageButton:{
enabled: false,
openDelay: 1000,
template: '<span>Done</span>',
effect: 'fade',
effectDuration: 1000
}
}).done(function(e){
// WebChat configured successfully
}).fail(function(e){
// WebChat wasn't configured properly
});
Options
| Option | Type | Description |
|---|---|---|
| formValidation | boolean | Enable/disable browser form validations. |
| SendMessageButton.enabled | boolean | Enable/disable Send Message button on screen. |
| SendMessageButton.template | string | Custom HTML string template for Send Message button. |
| SendMessageButton.effect | string | Type of animation effect when revealing Send Message button ('slide' or 'fade'). |
| SendMessageButton.openDelay | number | Number of milliseconds before displaying send message button on screen. |
| SendMessageButton.effectDuration | number | Length of animation effect in milliseconds. |
Resolutions
| Status | When | Returns |
|---|---|---|
| resolved | When configuration options are provided and set | n/a |
| rejected | When no configuration options are provided | 'Invalid configuration' |
minimize
Minimize or Unminimize Send Message UI.
Example
oMyPlugin.command('SendMessage.minimize').done(function(e){
// SendMessage minimized successfully
}).fail(function(e){
// SendMessage ignores command
});
Resolutions
| Status | When | Returns |
|---|---|---|
| resolved | Always | n/a |
| rejected | Never | n/a |
showSendMessageButton
Makes the standalone Send Message button visible on the screen using either the default template and CSS or customer-defined ones.
Example
oMyPlugin.command('SendMessage.showSendMessageButton', {
openDelay: 1000,
duration: 1500
}).done(function(e){
// SendMessage shows send message button successfully
}).fail(function(e){
// SendMessage button is already visisible, side bar is active and overrides the send message button, or chat button is disabled in configuration
});
Options
| Option | Type | Description |
|---|---|---|
| openDelay | number | Duration in milliseconds to delay showing the send message buton on the page |
| duration | number | Duration in milliseconds for the show and hide animation. |
Resolutions
| Status | When | Returns |
|---|---|---|
| resolved | When the Send Message button is enabled in the configuration, is currently not visible, and the SideBar plugin is not initialized | n/a |
| rejected | When the Send Message button is not enabled in the configuration, or it's already visible, or the SideBar plugin is initialized | 'Send Message button is already visible. Ignoring command.' |
| rejected | When the sidebar plugin is active the standalone send Message button will be disabled automatically | 'SideBar is active and overrides the default Send Message button' |
hideSendMessageButton
Hides the standalone Send Message button.
Example
oMyPlugin.command('SendMessage.hideSendMessageButton', {
duration: 1000
}).done(function(e){
// SendMessage shows send message button successfully
}).fail(function(e){
// SendMessage button is already visisible, side bar is active and overrides the send message button, or chat button is disabled in configuration
});
Options
| Option | Type | Description |
|---|---|---|
| duration | number | Duration in milliseconds for the show and hide animation |
Resolutions
| Status | When | Returns |
|---|---|---|
| resolved | When the send message button is currently visible | n/a |
| rejected | When the send message button is already hidden | 'Send Message button is already hidden. Ignoring command.' |
readFormData
Reads all the form values from the specified input fields
Example
oMyPlugin.command('SendMessage.readFormData', {
formInputs: ['cx_sendmessage_form_email','cx_sendmessage_form_firstname','cx_sendmessage_form_lastname','cx_sendmessage_form_subject','cx_sendmessage_form_messagebody']
}).done(function(e){
// SendMessage read form successfully
}).fail(function(e){
// SendMessage failed to read form
});
Options
| Option | Type | Description |
|---|---|---|
| formInputs | array | id's of input elements |
Resolutions
| Status | When | Returns |
|---|---|---|
| resolved | When Send Message form is read successfully | n/a |
| rejected | When Send Message form is not valid | 'Form not valid' |
submitForm
The user entered form data and attached files are submitted
Example
oMyPlugin.command('SendMessage.submitForm', {
firstName: 'John',
lastName: 'Smith',
email: 'John@mail.com',
subject: 'Customer Satisfaction',
text: 'I am 100% satified with your customer service!'
}).done(function(e){
// SendMessage submitted form successfully
}).fail(function(e){
// SendMessage failed to submit form
});
Options
| Option | Type | Description |
|---|---|---|
| firstName | string | value for the First Name entry field |
| lastName | string | value for the Last Name entry field |
| string | value for the Email entry field | |
| subject | string | value for the Subject entry field |
| text | string | value for the email body text content entry field |
Resolutions
| Status | When | Returns |
|---|---|---|
| resolved | When Send Message form is submitted successfully | n/a |
| rejected | When form data entry fields are missing | 'No form data found' |
open
opens the send message widget UI.
Example
oMyPlugin.command('SendMessage.open', {
text: 'To whom it may concern.....',
form: {
autoSubmit: false,
firstname: 'John',
lastname: 'Smith',
email: 'John@mail.com',
subject: 'Customer Satisfaction'
}
}).done(function(e){
// SendMessage opens successfully
}).fail(function(e){
// SendMessage isn't open or no active chat session
});
Options
| Option | Type | Description |
|---|---|---|
| form | object | Object containing form data to prefill in the send message form and optionally auto-submit the form. |
| form.autoSubmit | boolean | Automatically submit the form and send an email with prefilled content. |
| form.validation | boolean | Enables/Disables validating the form data while submitting. By default, its enabled. |
| form.firstname | string | Value for the first name entry field. |
| form.lastname | string | Value for the last name entry field. |
| form.email | string | Value for the email entry field. |
| form.subject | string | Value for the subject entry field. |
| text | string | value for the email body text content entry field |
Resolutions
| Status | When | Returns |
|---|---|---|
| resolved | When Send Message is successfully opened | n/a |
| rejected | When Send Message is already open | 'Already opened' |
Comments or questions about this documentation? Contact us for support!
