Javascript Chat Widget SDK

In order to integrate the Shipped AI Chat Widget into your website, please follow these instructions:

  1. Add the JS SDK right before the closing </head> tag
<script defer src=""></script>


Staging JS SDK

For staging environment, use

  1. Add a new <script></script> and instantiate the JS SDK:
window.addEventListener('shipped:chat-script-loaded', () => {
  const shippedChatWidget = new ShippedChatWidget.ChatWidget({
    iframeSrc: '',
    jwt: async callback => {
      const jwt = await getJwtFromServer()

Through iframeSrc you will specify the source URL of the iframe that loads the chat window.

You can authenticate the current user by creating getJwtFromServer() function which should return a promise that resolves with the JWT token.

  1. authenticate('JWT_TOKEN')

As an alternative to providing JWT token upon initializing ChatWidget instance, you can authenticate the current user through the authenticate() function, like this:

  1. To open or close the chat window programmatically use the following methods:
  1. Similarly, to hide or show the chat button, use:
  1. To logout the current user, use:
  1. To destroy the chat widget instance: