React / Next.js / Vue / Angular

Connect ChatLira to your website

Components for React, Next.js, Vue 3 and Angular use your existing ChatLira widget. No additional backend or secret key is required.

Download Web SDK v0.2.0 ↓Local package · @upchat/web · v0.2.0

Any website

Create a widget in your dashboard, add your allowed domain and publish the settings. In the setup wizard, choose website installation, copy the code to the pages you need and run the installation check.

Start free ↗

WordPress

Download the ChatLira plugin ZIP, then install and activate it in WordPress. Choose WordPress in the ChatLira setup wizard and copy the public widget settings into the plugin. Add your allowed domain, publish the settings and check the installation.

Download the WordPress plugin ↓

1. Install the package

Download the archive into your application root and run the command below. This is a locally distributed archive, not a release published to the npm registry.

npm install ./upchat-web-0.2.0.tgz

2. Check your site settings

In the dashboard, choose Sites and widgets → Installation. Use the script URL, API URL and public key for that widget. Add the exact page origin to allowed domains and publish: protocol, domain and port must match. For example, https://shop.example.com and http://localhost:5173 are different origins.

Replace YOUR_WIDGET_SITE_KEY with your widget key in the examples. Script and API URLs refer to this ChatLira installation; use the corresponding addresses for another deployment.

Use HTTPS for the website, script and API in production. The public siteKey can be passed to the component; never put administrative or service tokens in website code.

React · App.tsx

Add UpchatWidget once to your root App alongside the existing application content. Keep your pages and avoid creating a separate instance on every route.

import { UpchatWidget } from '@upchat/web/react';

export default function App() {
  return (
    <UpchatWidget
        scriptUrl={"https://widget.chatlira.com/upchat.js"}
        apiUrl={"https://api.chatlira.com"}
        siteKey={"YOUR_WIDGET_SITE_KEY"}
        locale={"en"}
      />
  );
}

Next.js · app/layout.tsx

Import the component from @upchat/web/next directly into the server app/layout.tsx. The package already sets the use client boundary, so the entire layout can remain a Server Component. Pass only serializable values, such as the strings shown. Preserve your layout’s existing html, body and children.

import type { ReactNode } from 'react';
import { UpchatWidget } from '@upchat/web/next';

export default function RootLayout({ children }: { children: ReactNode }) {
  return (
    <html lang={"en"}>
      <body>
        {children}
        <UpchatWidget
          scriptUrl={"https://widget.chatlira.com/upchat.js"}
          apiUrl={"https://api.chatlira.com"}
          siteKey={"YOUR_WIDGET_SITE_KEY"}
          locale={"en"}
        />
      </body>
    </html>
  );
}

Vue 3 · App.vue

Import the component in script setup and place it beside your application in the root template. Pass configuration through script-url, api-url and site-key, preserving the rest of your app.

<script setup lang="ts">
import { UpchatWidget } from '@upchat/web/vue';

const widget = {
  scriptUrl: "https://widget.chatlira.com/upchat.js",
  apiUrl: "https://api.chatlira.com",
  siteKey: "YOUR_WIDGET_SITE_KEY",
  locale: "en",
};
</script>

<template>
  <UpchatWidget
    :script-url="widget.scriptUrl"
    :api-url="widget.apiUrl"
    :site-key="widget.siteKey"
    :locale="widget.locale"
  />
</template>

Angular · app.component.ts

In Angular 22, import UpchatWidgetComponent from @upchat/web/angular and add it to your standalone component’s imports. Place upchat-widget once beside your existing AppComponent content. URLs and the key are passed as string properties, without secrets in the template.

import { Component } from '@angular/core';
import { UpchatWidgetComponent } from '@upchat/web/angular';

@Component({
  selector: 'app-root',
  standalone: true,
  imports: [UpchatWidgetComponent],
  template: `
    <upchat-widget
      [scriptUrl]="scriptUrl"
      [apiUrl]="apiUrl"
      [siteKey]="siteKey"
      locale="en"
    />
  `,
})
export class AppComponent {
  readonly scriptUrl = "https://widget.chatlira.com/upchat.js";
  readonly apiUrl = "https://api.chatlira.com";
  readonly siteKey = "YOUR_WIDGET_SITE_KEY";
}

Check the integration

Remove previous script tags and manual Upchat.mount calls for this widget to avoid duplicate instances. Open an allowed site, send a message and reply from the operator dashboard. Navigate between pages and confirm that one widget remains.

locale passes a language preference to the existing widget, including its channel panel; greeting text comes from the dashboard. Optional defaultOpen set to true opens the chat on first mount. Appearance and features load from the selected widget settings.

← All ChatLira features