Methods
activateTrigger(trigger)
Activate trigger using url or id.
Example
Activete trigger by url
heres('activateTrigger', {url: 'http....my_url'})
Activate trigger by id
heres('activateTrigger', {id: 3})
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
trigger |
Object |
Properties
|
close()
Close widget.
Example
heres('close')
destroy()
Destroy widget chat bot.
Example
heres('destroy')
hide()
Hide widget.
Example
heres('hide')
hideBubble()
Hide bubble.
Example
heres('hideBubble')
(async) init(argumentsopt)
Initialize the chatbot widget.
Example
await heres('init', arguments)
await heres('init', {userId: 'user-id-1234'})
arguments.integrity = crypto.createHash('sha1').update(arguments.userId + 'secret_string_124', 'binary').digest('hex') // NodeJS example
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
arguments |
Object |
<optional> |
Properties
|
offEvents()
Used to remove all events handlers attached
Example
heres('offEvents')
onClose(eventFn)
Event trigged when chat is closed.
Example
heres('onClose', function () { console.log('...') })
Parameters:
Name | Type | Description |
---|---|---|
eventFn |
function | Function called when the event is trigged |
onEvents(eventsFn)
Attaches one or more event handlers
Example
heres('onEvents', { myEvent: function (data) { console.log('myEvent with data', data)} })
Parameters:
Name | Type | Description |
---|---|---|
eventsFn |
Object | It's a object where key is the event's name and value is a function that will called when event is triggered. |
onOpen(eventFn)
Event trigged when chat is opened.
Example
heres('onOpen', function () { console.log('...') })
Parameters:
Name | Type | Description |
---|---|---|
eventFn |
function | Function called when the event is trigged |
open()
Open widget.
Example
heres('open')
sendMsg(msg)
Send message
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
msg |
String | Object | message can be a string or object with payload and label
Properties
|
show()
Show widget.
Example
heres('show')
showBubble(bubble, seconds)
Show bubble. You can use bubble argument to set bubble.
Example
heres('showBubble')
heres('showBubble', args)
Parameters:
Name | Type | Description | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
bubble |
Object |
Properties
|
||||||||||||||||||
seconds |
Number |