API methods

All API methods can be invoked on window.amioWebchat.

close()

window.amioWebchat.close() - closes the chat.

init()

window.amioWebchat.init({ /* params */}) - Initializes the chat.

Following customization options can be added to the configuration object of the init() function:

  • channelId - string, required, the Channel ID of your Amio Chat channel
  • logoUrl - string, URL of your company logo or other picture to be used as an avatar
  • theme - string, color theme
  • startOpened - boolean, if set to true, the chat will be already opened when the page is loaded
  • lang - string, selects language. Currently supported languages are en (English, default) and cs (Czech)
  • showVoice - boolean, if set to true, voice-to-text input method will be enabled and displayed as the primary means of input. NOTE: The voice-to-text feature is not enabled for all accounts. Contact our sales representative if you'd like to enable this feature.
  • zIndex - number or string, sets the z-index value for Web Chat's wrapper div. Default value is 100.
  • storageType - string, allows to choose if session data will be stored in localStorage or sessionStorage. Allowed values are: local (use localStorage, default), session (use sessionStorage).
  • hideLauncher - string, this parameter changes how the Launcher (the button in bottom right that is shown when the Web Chat is closed and is used to open/close the Web Chat) is displayed. Supported values are:
    • never - default, Launcher is always displayed
    • chatOpen - Launcher will be hidden when Web Chat window is open. This makes the Web Chat window slightly taller which might allow for better use of the screen space.
    • always - Launcher will never be displayed. We recommend to use this option only if you want to implement an alternative way to open/close the Web Chat.
  • hideCloseButton - boolean, if set to true, the Close button in the header of the Web Chat window will be hidden.
  • hideHeader - boolean, if set to true, the Web Chat window will be displayed without the header.
  • forceFullScreen - boolean, if set to true, the Web Chat's wrapper div and the Web Chat window will always occupy the whole screen (like it does on mobile device screen sizes)
  • disablePopUpMessages - boolean, if set to true, the latest message will not display as a pop-up if the Web Chat window is closed (only the red badge indicating the number of unread messages will be shown).
  • wideButton boolean, if set to true, the Launcher will be wide (displays chat icon with a title)
  • wideButtonWrapperWidth string, adjustment for the launcher wrapper to fit a Launcher with a long title. Default value is 270px.

open()

window.amioWebchat.open() - opens the chat.

triggerEvent(eventId)

window.amioWebchat.triggerEvent(eventId) - triggers a custom event with event ID eventId.

onCallbackButtonPressed(callbackFunction)

window.amioWebchat.onCallbackButtonPressed(callbackFunction) - registers a function which will be called whenever a Callback button is pressed. The function should accept one parameter - payload of the pressed Callback button.