Skip to content
Asterlio

Overview

Embed the Asterlio CRM chat widget on any website using a single script tag.

Control it with window.postMessage and the global window.ASTERLIO_API.

Quick Start

Add the script

Paste this before the closing </body>:

index.html
<script>
  var ASTERLIO_API = ASTERLIO_API || {}, ASTERLIO_LoadStart = new Date();
  (function(){
    var s1=document.createElement('script'),s0=document.getElementsByTagName('script')[0];
    s1.async=true;
    s1.src='https://DOMAIN/api/asterlio-widget-loader/YOUR_CLIENT_ID';
    s1.charset='UTF-8';
    s1.setAttribute('crossorigin','*');
    s0.parentNode.insertBefore(s1,s0);
  })();
</script>

Optional: Manual init

You can also initialize manually after the script loads:

JavaScript
// after the script loads
window.ASTERLIO_API?.init('YOUR_CLIENT_ID')

What you can do

  • Show and hide the widget, and move it to any corner
  • Open, close, expand and minimise the chat
  • Open the chat with a message or files waiting in the composer
  • Read the first-chat questions and identify the visitor, silently or by prefilling
  • Read, clear and restore the visitor's session
  • Know what is possible right now (for example, whether a message can be sent)
  • Listen for events: view changes, messages sent and received, conversation started or closed, session changes, unread counts and errors

See Window API, Events and Sessions & Visitors.

Requirements

  • Replace YOUR_CLIENT_ID and DOMAIN in the snippet
  • Allow the widget origin (https://DOMAIN) in your CSP if applicable

Was this page helpful?