Initialization

To initialize the SDK, all you need to do is set up the chat store and initialize the SDK.

1

Set up the store

This is separate from the initialization so that you can choose how to manage the store, depending on your tools and libraries.

In the following example, store is just a mobx state tree.

import { BotStacksChat } from "@botstacks/chat-sdk";

const store = BotStacksChat.createChatStore();

From here, you can makeInspectable(store) with mobx-devtools-mst if you desire. And go on to make the store observable and create a reactive environment. See MobX docs for more details .

2

Initialize the SDK

main.js
import { BotStacksChat } from "@botstacks/chat-sdk";

BotStacksChat.init(process.env.API_KEY);