Concierge On-Click Functions

Concierge provides a `capacityConcierge` object under the global `window` object with the following properties.

##### `capacityConcierge.open()`

The `open` method expands the Concierge interface to the default view of the Concierge instance

// Example HTML

<a href=“javascript:void(0)” onclick=“window.capacityConcierge.open()“>Open</a>


##### `capacityConcierge.close()`

The `close` method closes the Concierge interface to its minimized state

// Example HTML

<a href=“javascript:void(0)” onclick=“window.capacityConcierge.close()“>Close</a>


##### `capacityConcierge.hide_callbutton()`

The `hide_callbutton` method hides the callbutton on the lower right corner of the Concierge interface

// Example HTML

<a href=“javascript:void(0)” onclick=“window.capacityConcierge.hide_callbutton()“>Hide Callbutton</a>


##### `capacityConcierge.show_callbutton()`

The `show_callbutton` method shows the callbutton on the lower right corner of the Concierge interface

// Example HTML

<a href=“javascript:void(0)” onclick=“window.capacityConcierge.show_callbutton()“>Show Callbutton</a>


##### `capacityConcierge.load(inquiry: String, isAutocompleteEnabled: Boolean[ = false])`

The `load` method loads the `inquiry` string into the input field of the Concierge interface. Pass an optional boolean for `isAutocompleteEnabled` to search for autocomplete options after the `inquiry` string loaded into the input field

// Example HTML

<a href=“javascript:void(0)” onclick=“window.capacityConcierge.load(‘Hello’)“>Load</a>

<a href=“javascript:void(0)” onclick=“window.capacityConcierge.load(‘Hello’, true)“>Load</a>


##### `capacityConcierge.submit()`

The `submit` method submits the inquiry in the input field of the Concierge interface

// Example HTML

<a href=“javascript:void(0)” onclick=“window.capacityConcierge.submit()“>Submit</a>


##### `capacityConcierge.ask(inquiry: String)`

The `ask` method submits the `inquiry` string to send an inquiry in the Concierge interface

// Example HTML

<a href=“javascript:void(0)” onclick=“window.capacityConcierge.ask(‘Hello’)“>Ask</a>


##### `capacityConcierge.clear()`

The `clear` method removes the inquiry in the input field of the Concierge interface

// Example HTML

<a href=“javascript:void(0)” onclick=“window.capacityConcierge.clear()“>Clear</a>


##### `capacityConcierge.bind_event_hooks(event_hook_object: { general_event?: function, message_event?: function, livechat_event?: function})`

The `bind_event_hooks` method binds event hooks to which the Concierge interface emits events.

Events:

  General Events:

    GENERAL:VIEW:NORMAL // For when the Concierge interface is displayed in its normal size window

    GENERAL:VIEW:MAXIMIZE // For when the Concierge interface is displayed in its maximized size window

    GENERAL:VIEW:MINIMIZE // For when the Concierge interface is displayed in its minimized size window

    GENERAL:USER_ACTION:CLICK_LINK // For when the use clicks a link from the Concierge response

  Message Events:

    MESSAGE:SEND:INQUIRY // For when the user submits an inquiry to the Concierge interface

    MESSAGE:RECEIVE:RESPONSE // For when the Concierge interface displays a response to the user

    MESSAGE:RECEIVE:CONVERSATION_START // For when the Concierge interface starts a conversation

    MESSAGE:RECEIVE:CONVERSATION_FINISH // For when the Concierge interface finishes a conversation

  Livechat Events:

    LIVECHAT:STATE:START // For when a live chat starts in the Concierge interface

    LIVECHAT:STATE:END // For when a live chat ends in the Concierge interface

```

// Example JavaScript

window.capacityConcierge.bind_event_hooks({

  general_event: t => console.log(`General Event: type: "${t.event}"`),

  message_event: t => console.log(`Message Event: type: "${t.event}" value: "${t.value}"${t.state ? ' state: ' + JSON.stringify(t.state) : ''}`),

  livechat_event: t => console.log(`Livechat Event: type: "${t.event}"`)

})


##### `capacityConcierge.is_open`

The `is_open` boolean property indicates whether the Concierge interface is expanded from its minimized state

// Example JavaScript

if (window.capacityConcierge?.is_open) {

  window.capacityConcierge.load(‘Hello’) // Do something...

}


##### `capacityConcierge.has_message`

The `has_message` boolean property indicates whether the input field of the Concierge interface is filled

// Example JavaScript

if (window.capacityConcierge?.has_message) {

  window.capacityConcierge.submit() // Do something...

}



Was this article helpful?