Chatbot With JavaScript SDK: What an SDK Is, What LiveChatBot Gives You Instead, and the Eight Calls You Can Copy Today (Free Copy-Ready Calls)

Chatbot with JavaScript SDK is a search from people who want to control the chat from their own code. Before you hunt for a package to install, it helps to know what an SDK really is and whether you need one. LiveChatBot does not ship a downloadable SDK package. It gives you a JavaScript API on the page instead, and this guide shows exactly what it can do, with eight calls you can copy.

8calls in window.LiveChatBot
0packages to install
1script tag to load the chat
₹0to start, 2 websites

⚡ In short

  • An SDK is a ready-made code package; a JavaScript API is a set of calls that already exist on the page.
  • LiveChatBot has no SDK package. Its chat code adds window.LiveChatBot with open, close, show, hide, setVisitor, sendMessage, pageView and on.
  • React and Vue plugins exist, so framework sites need no hand-made wrapper.
  • Copy the calls below, test on a staging copy, and keep the secrets on the server.
Chatbot with javascript sdk in LiveChatBot: AI Agent knowledge sources and a sample chat answered from them
How it looks in LiveChatBot: AI Agent knowledge sources and a sample chat answered from them.

Plain words

SDK or JavaScript API: what is the difference?

An SDK (software development kit) is a bundle of code you install, often with npm, so you can talk to a service in your own language without writing every request by hand. A JavaScript API is simpler. Once the chat script loads, the browser has an object with functions you can call.

Why vendors offer SDKs

An SDK saves developers time when the service is complicated: login, retries, types, helpers. For a chat widget the job is smaller. You mostly want to open it, hide it, say who the visitor is, or react to an event.

What that means for you

If a vendor says “chatbot with JavaScript SDK”, ask what is in the package. Often it is a thin wrapper around a few calls that LiveChatBot already exposes directly. You lose nothing by calling them yourself, and you avoid one more dependency to update.

What exists

What a chatbot with JavaScript SDK features looks like on LiveChatBot

When the chat code is on the page, you get an object called window.LiveChatBot with these methods.

  • open and close control the chat window.
  • show and hide control the bubble.
  • setVisitor passes a name, email or phone for a logged-in customer.
  • sendMessage sends text as the visitor.
  • pageView reports a page change on single-page apps.
  • on listens for events, such as a new lead.

Calls made before the chat finishes loading wait, then run, so you do not need to poll. For framework sites there are React and Vue plugins, and a WordPress plugin if your site runs WordPress. Our live chat API integration guide covers these recipes in a longer form.

Try it

Eight calls to copy

Switch tabs, copy a line and adjust the selector or text to match your site.

LiveChatBot.open();
LiveChatBot.close();
document.querySelector(‘#help-btn’).addEventListener(‘click’, function () { LiveChatBot.open(); });
LiveChatBot.hide();
LiveChatBot.show();
if (location.pathname.indexOf(‘/checkout’) === 0) { LiveChatBot.hide(); }
LiveChatBot.setVisitor({ name: ‘Asha’, email: ‘asha@example.com’ });
if (window.shopUser) { LiveChatBot.setVisitor({ name: window.shopUser.name, email: window.shopUser.email }); }
LiveChatBot.sendMessage(‘I need help with my order’);
document.querySelector(‘.order-help’).addEventListener(‘click’, function () { LiveChatBot.sendMessage(‘Question about my order’); });
LiveChatBot.pageView();
LiveChatBot.on(‘lead’, function () { if (typeof gtag === ‘function’) { gtag(‘event’, ‘generate_lead’, { method: ‘chat’ }); } });

Using the calls

Where to put the code and how to test it

Paste your calls in a script tag after the LiveChatBot chat code, or in your site’s own JavaScript file if it loads after the chat.

Test on a copy first

A typo in a selector fails quietly. Open the staging page, press your button and watch. Try it on a phone too, because some themes handle taps differently.

Single-page apps

Frameworks change pages without a reload. Call pageView after each route change, or visitor tracking and page-based Flows only see the first page. In React that is an effect on the location; in Vue it belongs in the router’s after-each hook.

Do not send what you should not

Only call setVisitor after a real login. Never pass passwords, card numbers or one-time codes. Mention website chat in your privacy notice.

Settings first

Jobs that need no code at all

Before you write any code, check whether a setting already does the job.

  • Hide the chat on certain pages, devices or countries. The “where it shows” setting handles it. See showing chat on specific pages.
  • Proactive messages. Flows support up to six conditions, such as page, source, country, device and number of visits. Read about chat flows.
  • Chat inside a page. Inline mode places it in your layout.
  • Colour, position and welcome text. These are in the dashboard; see customising your chat widget.

Settings survive redesigns and can be changed by anyone on your team. Use code for the cases settings cannot see, such as your own login state.

Vendor test

How to judge any chatbot with JavaScript SDK claim

Use these questions with any vendor, including us.

  1. What is in the package? Ask for the list of functions, not the marketing line.
  2. Does it add weight to the page? Check the size in your browser’s network tab. A chat tool should not slow your product pages.
  3. What happens before it loads? Good tools queue early calls. Weak ones throw an error.
  4. Which frameworks are supported? Look for named plugins for React, Vue or WordPress, not just “works anywhere”.
  5. How are updates handled? A package you install needs updating. A script loaded from the vendor updates itself.
  6. Can it be turned off? You should be able to hide or remove it quickly if something breaks.

Test the claims on a staging page, on a mid-range phone and a slow connection. If the answers are vague, the SDK is probably a thin wrapper, and calling the vendor’s own API directly is just as good.

Honest limits

What the JavaScript API does not do

Be clear about the edges.

  • There is no downloadable SDK package and no typed client library.
  • The JavaScript API controls the widget in the browser; it does not read your inbox. For conversations and tickets use the REST API or webhooks, which belong on your server. Our chatbot with REST API guide explains when that is worth doing.
  • There is no pre-chat form to add fields to.
  • “Powered by LiveChatBot” stays on every plan, and code cannot remove it.
  • Ask our team for developer documentation rather than expecting a public docs page.

Chat is free for 100 visitors per website each month, so you can build all of this at no cost. See pricing if traffic grows.

Frequently asked questions

Does LiveChatBot have a JavaScript SDK?

Not as a package. It has a JavaScript API, window.LiveChatBot, with open, close, show, hide, setVisitor, sendMessage, pageView and on.

What is a chatbot with JavaScript SDK used for?

Opening the chat from your own buttons, passing logged-in customers, hiding it on some pages and reacting to events such as leads.

Do I need to install anything with npm?

No. Load the chat code on the page and the calls are available. React and Vue plugins exist if you prefer them.

Can the JavaScript API read my conversations?

No. It controls the widget in the visitor’s browser. Use the REST API or ticket webhooks on a server for data.

Is it free to build and test?

Yes. The free plan covers two websites and 100 visitors per website each month, with no per-seat charges.

Keep reading

Related guides

📘

Chatbot With REST API: Five Jobs a REST API Can Do for Your Business, and a Quick Quiz to Decide If You Need It Yet (Free Route Quiz)

Read the guide →

🧭

Chatbot With Email Notifications: Why the Alert Email Never Arrives, the Terms Behind It, and How to Test Delivery (Free Email Jargon Glossary)

Read the guide →

🛠️

Chatbot With Offline Message Capture: Turn After-Hours Visitors Into Tickets You Can Answer in the Morning (Free Setup Checklist)

Read the guide →

Control the chat from your own code

A JavaScript API, REST API, webhooks and Zapier on the free plan. Start free on livechatbot.in.