Install
Pull @landbot/core from npm and create a Core instance from a bot config URL.
Install the package
npm install @landbot/core
The package is published as @landbot/core — works in modern bundlers (Vite, webpack, esbuild) and node-compatible runtimes that support ES modules.
Create an instance
LandbotCore is instantiated from a bot config — the same JSON object the Widgets SDK consumes from a configUrl. Fetch it from the bot's index URL, then hand the parsed JSON to the constructor.
Tip The quickest way to find your bot's config URL is its Share → Embed snippet in the dashboard — it's the
configUrlvalue (ending in/index.json). See the Help Center's Share & embed section.
import LandbotCore from '@landbot/core';
fetch('https://chats.landbot.io/u/H-441480-B0Q96FP58V53BJ2J/index.json')
.then((res) => res.json())
.then((config) => {
const core = new LandbotCore(config);
});
Replace the URL with your bot's config URL — it's the same configUrl you'd pass to a widget constructor, with index.html swapped for index.json so you get the parsed config instead of the rendered widget page.
From this point, core is the handle for sending messages, subscribing to events, and configuring pipelines. See API for what's available on the instance.
Use directly from a CDN
For prototypes, standalone demos, or static HTML pages where you don't want a build step, load @landbot/core as an ES module from a CDN.
<script type="module">
import { Core } from "https://cdn.jsdelivr.net/npm/@landbot/core/+esm";
const config = await fetch(
"https://chats.landbot.io/u/H-441480-B0Q96FP58V53BJ2J/index.json",
).then((r) => r.json());
const core = new Core(config);
// …subscribe, init, sendMessage as usual
</script>
Warning
Coreis a named export, not a default export. Useimport { Core } from "…"(curly braces). The CJS-styleimport LandbotCore from "…"you'd write in a bundler doesn't survive the trip through browser-native ESM:
import Core from "https://esm.sh/@landbot/core"→SyntaxError: ... does not provide an export named 'default'.import Core from "https://cdn.jsdelivr.net/npm/@landbot/core/+esm"→ loads, then throwsTypeError: Core is not a constructorbecause the default export isnull.
import { Core } from "https://cdn.jsdelivr.net/npm/@landbot/core/+esm"is the form that works.
Picking a CDN
Both jsDelivr (+esm) and unpkg (?module) build ESM bundles. We use jsDelivr in the cinematic, departures, and composer demos.