configuration
object
Returns a Promise that resolves with bot name
hookURL
string (optional, defaultthis.configuration.hookURL
)apiKey
string (optional, defaultthis.configuration.apiKey
)
Returns Promise<(Response | never)>
- Initialises the widget
- Resolves promise on connection success with botName and history
- Rejects promise if it fails
Returns Promise<object> where object = {botName: string, history: Array[{content: string, made_by: string}]}
Set callback for incoming messages
callback
function callback for incoming messages
Sends a message if connected, else queues it
message
string
- To get the bot to say the intro message (if exists) without having the user to send a message first
- Must be called after init
- Closes socket connection for good
- Clears callback references
- Ends session
- Clears all data & cookie
Sets callback for connection change
callback
function (isConnected: bool)
- Adds a property to the payload object
- If the property already exists, its value will be overwritten
key
stringvalue
any
Removes a property from the payload object
key
string
Turn conversation logging on or off
value
boolean true|false
Check if conversation logging is on or off
Returns boolean
Returns a promise that resolves if and when user_id_cookie is available
- Adds a property to the metadata object in payload
- If the property already exists, its value will be overwritten
key
stringvalue
any