JavaScript

Installation

First, you need to create a div to render imbee chat and set its id with DIV_ID:

<div id="DIV_ID"></div>

Then, import imbee.js:

<script async src="https://s3-eu-west-1.amazonaws.com/static.imbee.es/chat/imbee.js"></script>

and configure these options:

  • divId - id of the div which you want to render the chat

  • myCss - optional custom css file's path (see my css)

  • init - function which is called after everything is ready

window.imbeeOptions = {
    divId: 'DIV_ID',
    myCss: 'myStyles.css',
    init: init
};

function init(IMbee) {
    ...
}

Basic setup

Use this function to show the imbee app:

and this to hide:

This is the basic setup you need to start the chat:

  • placeholderText - (optional) is the input message placeholder

More options

You can add more options to the options (parameter of IMbee.getApp)

To define a view for a custom message, you can add CSS style in my css:

To define a custom menu view:

To define a custom send view:

To set an action when the user clicks a button:

To add a message received listener:

and a message updated listener:

To add a connection changed listener:

Send message

To send a simple text message

To send an invisible message with postback

To send a custom message

Last updated