Add Lily to your website or app
One line for the chat button, and full API clients when you want to build more.
Overview
One line puts a chat button on every screen. Press it and the full chat opens in a web view, and everything (replies, photos, voice notes, products and orders) is handled by Lily itself. Your app never sends or receives messages, and the look is set in your Lily panel.
How it works
- Your app or siteOne line adds a button on every screen
- Web viewThe button opens Lily's own chat page
- Lily panelReplies, team inbox, colour and title
Only a public key
You use your public site key (lily_...), shown under Sites & Embed. It is safe inside pages and published apps.
Look set in the panel
Colour, title, side of the screen and button label are read from your panel each time the chat opens. Change them once and every site and app follows, with no new release.
Replies handled by the chat
The web view is the real chat, so team replies, AI answers, photos, voice notes, product cards and orders just work. The SDK does not send messages itself.
Keys and setup
| Key | Looks like | Where it can be used |
|---|---|---|
| Public site key | lily_... | Web pages and published apps. This is all the chat button needs. |
| Secret API key | lily_sk_... | Your own server only. Never put it in a web page or a downloadable app. |
In the examples, replace lily_YOUR_SITE_KEY with your site key and https://YOUR_LILY_ADDRESS with the address of your Lily. Use https on live sites. Voice recording needs https.
The packages are not on public registries yet. Install them from the SDK files we send with your Lily account.
Quick start
Add one line and your website or app gets a small chat button on every screen. Choose your platform.
<!-- Script tag: nothing else to set, the look comes from your portal -->
<script src="https://YOUR_LILY_ADDRESS/sdk/lily-launcher.js"
data-site-key="lily_YOUR_SITE_KEY"></script>
// Or from code
import { LilyAssistant } from 'lily-assistant-sdk';
LilyAssistant.init('lily_YOUR_SITE_KEY', { baseUrl: 'https://YOUR_LILY_ADDRESS' });import { LilyAssistantButton } from 'lily-assistant-react';
export default function App() {
return (
<>
<YourApp />
<LilyAssistantButton siteKey="lily_YOUR_SITE_KEY" baseUrl="https://YOUR_LILY_ADDRESS" />
</>
);
}# Django, Flask, FastAPI, Jinja: print the script tag in your page template
from lily_assistant import script_tag
tag = script_tag("lily_YOUR_SITE_KEY", "https://YOUR_LILY_ADDRESS")
# Jinja: {{ tag|safe }} Django: {{ tag|safe }} (before </body>)
# Optional overrides: color="#6d4aff", position="left", title="Help", label="Chat"import 'package:lily_assistant_flutter/lily_assistant_flutter.dart';
MaterialApp(
builder: (context, child) => LilyAssistant(
siteKey: 'lily_YOUR_SITE_KEY',
baseUrl: 'https://YOUR_LILY_ADDRESS',
child: child!,
),
home: const MyHome(),
);<!-- .NET MAUI: last child of the page's root Grid -->
<ContentPage xmlns:lily="clr-namespace:Lily.Assistant.Maui;assembly=Lily.Assistant.Maui">
<Grid>
<!-- your page -->
<lily:LilyAssistantView SiteKey="lily_YOUR_SITE_KEY" BaseUrl="https://YOUR_LILY_ADDRESS" />
</Grid>
</ContentPage>import { LilyAssistant } from 'lily-assistant-react-native';
export default function Root() {
return (
<LilyAssistant siteKey="lily_YOUR_SITE_KEY" baseUrl="https://YOUR_LILY_ADDRESS">
<App />
</LilyAssistant>
);
}// Android: add the lily-assistant module, then in your Application class
class MyApp : Application() {
override fun onCreate() {
super.onCreate()
LilyAssistant.start(this, "lily_YOUR_SITE_KEY", "https://YOUR_LILY_ADDRESS")
}
}// iOS: add the LilyAssistant Swift package, then
import SwiftUI
import LilyAssistant
@main
struct MyApp: App {
init() { LilyAssistant.start(siteKey: "lily_YOUR_SITE_KEY", baseUrl: "https://YOUR_LILY_ADDRESS") }
var body: some Scene { WindowGroup { ContentView() } }
}@* ASP.NET Razor / Blazor server: before </body> *@
@using Lily.Assistant
@Html.Raw(LilyAssistantHtml.ScriptTag("lily_YOUR_SITE_KEY", "https://YOUR_LILY_ADDRESS"))The look is set in your Lily panel, not in code. Colour, title, side of the screen, button label and “hide on mobile” are read from your site's appearance settings each time the chat opens. Anything you pass in code overrides the panel.
That is all you need. Extras, only if you want your own button (such as a Help menu item): LilyAssistant.open(), close(), toggle() (LilyAssistant.Open() in .NET), and hide() on web, iOS and Android.
Options
| Option | Default | Meaning |
|---|---|---|
color, position, title, label | From the panel | Override the look in code (data-color and so on on the script tag) |
offset | 20 | Distance from the screen edge in pixels |
openOnLoad | false | Start open (data-open="1") |
data-base-url | Script address | Where Lily runs, on the script tag |
container | The page | Element that holds the button (web) |
onOpen, onClose, onReady | None | Callbacks (web) |
- Escape on the web and the Android back button close the chat.
- On a phone-sized web screen the chat fills the whole screen.
- The chat loads only when it is opened for the first time.
- No button is shown if Lily cannot be reached or the key is unknown.
Install packages
Most websites only need the script tag. Install a package when you work in code.
npm install ./sdk/jsnpm install ./sdk/js ./sdk/reactpip install ./sdk/pythondependencies:
lily_assistant:
path: ../lily/sdk/flutterdotnet add reference ../lily/sdk/dotnet/src/Lily.Assistant.csproj
Web
Tested in a real browser
Works with plain HTML and any website builder that accepts a script. Paste this before the closing body tag.
<script src="https://YOUR_LILY_ADDRESS/sdk/lily-launcher.js"
data-site-key="lily_YOUR_SITE_KEY"></script>From JavaScript or TypeScript (browsers, Node 18 or newer, Deno, Bun and React Native, with types included and no dependencies):
npm install ./sdk/jsimport { LilyAssistant } from 'lily-assistant-sdk';
LilyAssistant.init('lily_YOUR_SITE_KEY', { baseUrl: 'https://YOUR_LILY_ADDRESS' });launchLily() or new LilyLauncher() give you the object with a ready promise.
React
Builds and type checks
React 18 or newer. Render the button once near the top of your app. It is safe with server rendering, for example in Next.js.
npm install ./sdk/js ./sdk/reactimport { LilyAssistantButton } from 'lily-assistant-react';
<LilyAssistantButton siteKey="lily_YOUR_SITE_KEY" baseUrl="https://YOUR_LILY_ADDRESS" />Drop-in chat box
Unstyled, so style it with the lily-chat, lily-msg and lily-products class names.
import { LilyChatBox } from 'lily-assistant-react';
<LilyChatBox siteKey="lily_YOUR_SITE_KEY" baseUrl="https://YOUR_LILY_ADDRESS" title="Chat with us" />Read the site settings
const { config, loading, error } = useLilyConfig('lily_YOUR_SITE_KEY', { baseUrl: 'https://YOUR_LILY_ADDRESS' });
// config.status === 'online' | 'offline'
iOS (Swift)
4 unit tests, run in the iPhone simulator
iOS 15 or newer. In Xcode choose File, Add Package Dependencies, Add Local, then the sdk/ios folder.
// iOS: add the LilyAssistant Swift package, then
import SwiftUI
import LilyAssistant
@main
struct MyApp: App {
init() { LilyAssistant.start(siteKey: "lily_YOUR_SITE_KEY", baseUrl: "https://YOUR_LILY_ADDRESS") }
var body: some Scene { WindowGroup { ContentView() } }
}- UIKit apps call the same line in
application(_:didFinishLaunchingWithOptions:). - For voice notes add
NSMicrophoneUsageDescriptionto Info.plist. - Use https in production. Plain http needs an App Transport Security exception.
- Optional:
LilyAssistant.open(),close()andhide().
Android (Kotlin)
3 unit tests, run on an Android emulator
Minimum SDK 23. Copy the lily-assistant module into your project, or include it by path.
include(":lily-assistant")// Android: add the lily-assistant module, then in your Application class
class MyApp : Application() {
override fun onCreate() {
super.onCreate()
LilyAssistant.start(this, "lily_YOUR_SITE_KEY", "https://YOUR_LILY_ADDRESS")
}
}- The library adds the internet and record-audio permissions and the chat screen.
- Photo upload uses the system file picker. The microphone permission is asked when someone records a voice note.
- Use https in production. Only local test servers need
usesCleartextTraffic. - Optional:
LilyAssistant.open()andhide().
To build the sample app (Gradle 8.14, JDK 17, Android SDK 35):
cd sdk/android && gradle :sample:assembleDebug
Flutter
7 widget tests, clean analyzer
One widget puts the button on every screen. It is built on webview_flutter.
dependencies:
lily_assistant_flutter:
path: ../lily/sdk/flutter_uiimport 'package:lily_assistant_flutter/lily_assistant_flutter.dart';
MaterialApp(
builder: (context, child) => LilyAssistant(
siteKey: 'lily_YOUR_SITE_KEY',
baseUrl: 'https://YOUR_LILY_ADDRESS',
child: child!,
),
home: const MyHome(),
);- Options:
color(overrides the panel),bottomandside. - Optional:
LilyAssistant.open(),close(),toggle()andisOpen. - The Android back button closes the chat first. Android needs nothing else.
- On iOS add
NSMicrophoneUsageDescriptiontoios/Runner/Info.plistfor voice notes.
For your own chat screen, the pure Dart client (lily_assistant) needs only package:http and works on mobile, web, desktop and servers.
React Native
Preview
npm install ./sdk/js ./sdk/react-native react-native-webviewimport { LilyAssistant } from 'lily-assistant-react-native';
export default function Root() {
return (
<LilyAssistant siteKey="lily_YOUR_SITE_KEY" baseUrl="https://YOUR_LILY_ADDRESS">
<App />
</LilyAssistant>
);
}- Needs only the public site key. The Android back button closes the chat first.
- For voice notes add the microphone permission (
RECORD_AUDIOon Android,NSMicrophoneUsageDescriptionon iOS).
Python
Tested
Python 3.8 or newer, standard library only. For pages rendered by Django, Flask, FastAPI or Jinja.
pip install ./sdk/python# Django, Flask, FastAPI, Jinja: print the script tag in your page template
from lily_assistant import script_tag
tag = script_tag("lily_YOUR_SITE_KEY", "https://YOUR_LILY_ADDRESS")
# Jinja: {{ tag|safe }} Django: {{ tag|safe }} (before </body>)
# Optional overrides: color="#6d4aff", position="left", title="Help", label="Chat"Optional overrides: color, position, title, label and open_on_load.
.NET, MAUI and ASP.NET
Preview
.NET 6 and 8, with no dependencies: ASP.NET, MAUI, WPF, WinForms, Blazor and console apps.
dotnet add reference ../lily/sdk/dotnet/src/Lily.Assistant.csprojMAUI
<!-- .NET MAUI: last child of the page's root Grid -->
<ContentPage xmlns:lily="clr-namespace:Lily.Assistant.Maui;assembly=Lily.Assistant.Maui">
<Grid>
<!-- your page -->
<lily:LilyAssistantView SiteKey="lily_YOUR_SITE_KEY" BaseUrl="https://YOUR_LILY_ADDRESS" />
</Grid>
</ContentPage>Optional: LilyAssistant.Open(), Close(), Toggle(), IsOpen and Accent.
ASP.NET and Blazor
@* ASP.NET Razor / Blazor server: before </body> *@
@using Lily.Assistant
@Html.Raw(LilyAssistantHtml.ScriptTag("lily_YOUR_SITE_KEY", "https://YOUR_LILY_ADDRESS"))The .NET SDK was written without a .NET toolchain. Run dotnet test in sdk/dotnet/tests before relying on it.
Send a first message
You probably do not need this part. The chat button already handles replies, photos, voice notes and orders. Use the API clients only to build your own chat screen, or to read chats and reply from your own backend.
import { LilyChat } from 'lily-assistant-sdk';
const chat = new LilyChat('lily_YOUR_SITE_KEY', { baseUrl: 'https://YOUR_LILY_ADDRESS' });
const r = await chat.send('Do you deliver on weekends?');
console.log(r.reply ?? 'A team member will answer soon.');import { LilyChatBox } from 'lily-assistant-react';
export const Help = () => (
<LilyChatBox siteKey="lily_YOUR_SITE_KEY" baseUrl="https://YOUR_LILY_ADDRESS" title="Chat with us" />
);from lily_assistant import LilyChat
chat = LilyChat("lily_YOUR_SITE_KEY", base_url="https://YOUR_LILY_ADDRESS")
r = chat.send("Do you deliver on weekends?")
print(r.get("reply") or "A team member will answer soon.")import 'package:lily_assistant/lily_assistant.dart';
final chat = LilyChat('lily_YOUR_SITE_KEY', baseUrl: 'https://YOUR_LILY_ADDRESS');
final r = await chat.send('Do you deliver on weekends?');
print(r['reply'] ?? 'A team member will answer soon.');using Lily.Assistant;
var chat = new LilyChat("lily_YOUR_SITE_KEY", "https://YOUR_LILY_ADDRESS");
var r = await chat.SendAsync("Do you deliver on weekends?");
Console.WriteLine(r.Reply ?? "A team member will answer soon.");Visitor chat client
Build your own chat screen with the public site key. The visitor and conversation are kept so the same customer continues the same chat. The JavaScript SDK remembers them in localStorage (pass storage: null to keep nothing). Elsewhere, save visitorId and conversationId and pass them back in.
const r = await chat.send('Hi', { name: 'Alex', email: 'alex@example.com' });
r.products?.forEach((p) => console.log(p.name, p.priceCents / 100, p.currency));
const { messages } = await chat.history(); // includes team replies
await chat.rate(1, 'Very helpful'); // thumbs up
const photo = await chat.upload(fileBlob, { name: 'photo.jpg' });
await chat.send('Do you have something like this?', { attachmentId: photo.id });
await chat.confirmOrder({ code: 'LA-AB12CD', name: 'Alex',
phone: '+15550100000', email: 'alex@example.com' });import { useState } from 'react';
import { useLilyChat } from 'lily-assistant-react';
export function Chat() {
const { messages, send, sending, error, handler, products } =
useLilyChat('lily_YOUR_SITE_KEY', { baseUrl: 'https://YOUR_LILY_ADDRESS' });
const [text, setText] = useState('');
return (
<div>
{handler && <p>You are chatting with {handler.name}</p>}
{messages.map((m) => <p key={m.id}>{m.text}</p>)}
{error && <p role="alert">{error}</p>}
<form onSubmit={(e) => { e.preventDefault(); void send(text); setText(''); }}>
<input value={text} onChange={(e) => setText(e.target.value)} />
<button disabled={sending}>Send</button>
</form>
</div>
);
}
// Also returned: rate(), refresh(), reset(), visitorId, chat (for upload/confirmOrder)
// Options: poll (default 4000 ms, false to turn off)r = chat.send("Hi", name="Alex", email="alex@example.com")
print(chat.history()["messages"]) # includes team replies
chat.rate(1, "Very helpful")
up = chat.upload(open("photo.jpg", "rb").read(), name="photo.jpg")
chat.send("Do you have something like this?", attachment_id=up["id"])
# Save these to continue the same chat later
saved = (chat.visitor_id, chat.conversation_id)final r = await chat.send('Hi', name: 'Alex', email: 'alex@example.com');
final history = await chat.history();
await chat.rate(1, comment: 'Very helpful');
// Save these (for example with shared_preferences) and pass them back in
// after the app restarts to continue the same chat.
final saved = (chat.visitorId, chat.conversationId);var r = await chat.SendAsync("Hi", new SendOptions { Name = "Alex", Email = "alex@example.com" });
var history = await chat.HistoryAsync(); // includes team replies
await chat.RateAsync(1, "Very helpful");
var up = await chat.UploadAsync(File.ReadAllBytes("photo.jpg"), "photo.jpg");
await chat.SendAsync("Do you have something like this?", new SendOptions { AttachmentId = up.Id });
// Pass chat.VisitorId and chat.ConversationId to the constructor to continue laterWhen queued is true there is no AI reply: a team member will answer. Poll history, or use the conversation state helpers, to receive it.
Server client
Read conversations from every channel and answer them. Sending needs a write key. A read key can only read.
import { Lily } from 'lily-assistant-sdk';
const lily = new Lily(process.env.LILY_API_KEY!, { baseUrl: 'https://YOUR_LILY_ADDRESS' });
await lily.me(); // { scope, sites }
const chats = await lily.conversations({ status: 'open', limit: 20 });
const msgs = await lily.messages(chats[0].id);
await lily.sendMessage(chats[0].id, 'Your order has shipped.'); // write key
await lily.products();
await lily.orders('pending');// Next.js route handler: runs on the server only
import { Lily } from 'lily-assistant-react';
const lily = new Lily(process.env.LILY_API_KEY!, { baseUrl: process.env.LILY_URL! });
export async function GET() {
return Response.json(await lily.conversations({ status: 'open' }));
}from lily_assistant import Lily
lily = Lily("lily_sk_...", base_url="https://YOUR_LILY_ADDRESS")
print(lily.me())
for chat in lily.conversations(status="open", limit=20):
print(chat["channel"], chat["customerName"], chat["lastMessage"])
lily.send_message(chat["id"], "Your order has shipped.") # write key
lily.messages(chat["id"]); lily.products(); lily.orders("pending")final lily = Lily('lily_sk_...', baseUrl: 'https://YOUR_LILY_ADDRESS');
final chats = await lily.conversations(status: 'open');
await lily.sendMessage(chats.first['id'] as String, 'Your order has shipped.');var lily = new LilyClient(Environment.GetEnvironmentVariable("LILY_API_KEY")!, "https://YOUR_LILY_ADDRESS");
var chats = await lily.ConversationsAsync(status: "open", limit: 20);
await lily.SendMessageAsync(chats[0].Id, "Your order has shipped."); // write key
var products = await lily.ProductsAsync();
var orders = await lily.OrdersAsync("pending");REST endpoints
Send the key as Authorization: Bearer lily_sk_... to /public/v1/.
| Request | Returns or does | Key |
|---|---|---|
GET /me | The key's access and your sites | read |
GET /conversations | Chats from all channels. Filters: siteId, status, limit | read |
GET /conversations/{id}/messages | Messages of one chat. Filter: after | read |
POST /conversations/{id}/messages | Replies on the customer's channel | write |
GET /products | Your product catalog | read |
GET /orders | Orders | read |
Conversation state
A ready-made container for a whole chat. Your message appears at once, the answer follows, team replies are picked up by polling, and a failed send is rolled back with the error in state.
import { LilyChat, ChatStore } from 'lily-assistant-sdk';
const store = new ChatStore(new LilyChat(siteKey, { baseUrl }));
store.subscribe(() => render(store.getState()));
await store.load();
store.startPolling(); // picks up team replies
await store.send('Hello'); // shows at once, then the answer// useLilyChat is the state container for React.
// It loads earlier messages, sends with an instant message,
// polls for team replies and cleans up on unmount.
const { messages, sending, error, handler, products, send, rate } =
useLilyChat('lily_YOUR_SITE_KEY', { baseUrl, poll: 4000 });# Python has no UI state container: call history() on your own timer
# to pick up team replies.
import time
while True:
for m in chat.history()["messages"]:
handle(m)
time.sleep(4)final controller = LilyChatController(LilyChat(siteKey, baseUrl: baseUrl));
await controller.load();
controller.startPolling(); // picks up team replies
// dispose: await controller.dispose();
StreamBuilder<ChatState>(
stream: controller.stream,
initialData: controller.state,
builder: (context, snap) => Text('${snap.data!.messages.length} messages'),
);
await controller.send('Hello');using var controller = new LilyChatController(chat);
controller.Changed += state => Render(state);
await controller.LoadAsync();
controller.StartPolling(); // picks up team replies
await controller.SendAsync("Hello"); // shows at once, then the answer| State field | Meaning |
|---|---|
messages | All messages, including your team's replies |
sending | A send is in progress |
error | Last error text, cleared on the next success |
handler | The team member answering now, if any |
products | Product cards from the latest answer |
order | An order waiting for the visitor to confirm |
Errors
Every problem is one error type with the HTTP status. Status 0 means Lily could not be reached or the request timed out.
import { LilyError } from 'lily-assistant-sdk';
try { await lily.me(); } catch (e) {
if (e instanceof LilyError && e.isUnauthorized) console.log('Check your API key');
else if (e instanceof LilyError && e.isNetworkError) console.log('Lily is unreachable');
}import { LilyError } from 'lily-assistant-react';
// The hook puts the message in `error`. For direct calls:
try { await chat.send(text); } catch (e) {
if (e instanceof LilyError && e.isRateLimited) console.log('Slow down');
}from lily_assistant import LilyError
try:
lily.me()
except LilyError as e:
if e.is_unauthorized: print("Check your API key")
elif e.is_network_error: print("Lily is unreachable")
else: print(e.status, e.message)try { await lily.me(); } on LilyError catch (e) {
if (e.isUnauthorized) { /* check the key */ }
else if (e.isNetworkError) { /* unreachable */ }
}try { await lily.MeAsync(); }
catch (LilyException e) when (e.IsUnauthorized) { /* check the key */ }
catch (LilyException e) when (e.IsNetworkError) { /* unreachable */ }| Helper | When |
|---|---|
isUnauthorized | 401: wrong or deleted key |
isForbidden | 403: a read key tried to write, or the key lacks access |
isNotFound | 404: unknown conversation or item |
isRateLimited | 429: too many requests, retry later |
isNetworkError | Status 0: unreachable or timed out |
Method reference
Names are shown in JavaScript style. Python uses snake_case, .NET uses PascalCase with an Async suffix, and Dart matches JavaScript.
Visitor chat client
| Method | Purpose |
|---|---|
config() | Site settings and whether the team is online |
send(text, options) | Sends a message. Options: name, email, phone, attachment. Returns the reply, queued, products and order |
history() | All messages so far, including team replies |
rate(value, comment) | Thumbs up (1) or down (-1) with an optional comment |
upload(file, name) | Uploads a photo or voice note; attach its id to the next message |
confirmOrder(details) | Confirms an order the visitor agreed to: code, name, phone (optional), email |
Server client
| Method | Purpose | Key |
|---|---|---|
me() | Key scope and the sites it can access | read |
conversations({status, limit}) | Lists chats from all channels | read |
messages(id) | Messages of one conversation | read |
sendMessage(id, text) | Replies on the customer's own channel | write |
products() | Your product catalog | read |
orders(status) | Orders, optionally filtered by status | read |
Client options
| Option | Default | Meaning |
|---|---|---|
baseUrl | Required | Where Lily runs |
timeout | 30 seconds | Request timeout |
| HTTP client | Built in | Your own fetch, http.Client or HttpClient for proxies and tests |
Security
Keys stay on the server
Secret keys are stored hashed, shown once and limited to 10 for each account. Delete a leaked key and it stops working at once.
Separate accounts
A key only sees its own account's data. No call can reach another account.
Customers never see the AI
The API does not expose which AI model is used. Orders are placed only after the visitor confirms.
Rate limits
Visitor traffic follows the website chat limits. Server keys allow 120 requests a minute for each key and 60 sends a minute for each account.
- Use only the public site key in websites and apps.
- Keep secret keys in server settings, never in code you publish.
- Limit the chat to your own websites under Sites & Embed, Security.
- Tell visitors about chat and visitor tracking in your privacy policy.
Platform status
| Package | Platforms | Verification |
|---|---|---|
lily-assistant-sdk | Web, Node 18+, Deno, Bun, React Native. Types included | 15 end-to-end tests |
lily-assistant-react | React 18+: hooks and a drop-in chat box | 5 end-to-end tests |
lily-assistant | Python 3.8+, no dependencies | 8 end-to-end tests |
lily_assistant | Flutter and Dart on mobile, web, desktop and server | 9 tests, analyzer clean |
lily_assistant_flutter | Flutter chat button | 7 widget tests |
LilyAssistant | iOS Swift package | Run in iPhone simulator |
lily-assistant (Android) | Android Kotlin module | Run on emulator |
lily-assistant-react-native | React Native | Preview |
Lily.Assistant | .NET 6 and 8: ASP.NET, MAUI, WPF, Blazor, console | Preview |
Testing
The test suites run the real SDK code against a real Lily server, with no mocks. A throw-away account with the AI off is created and removed afterwards, so it costs nothing.
cd sdk
./run-tests.sh # Lily must be running (set SDK_BASE to its address)FAQ
Can I use the server client in a mobile app?
No. A secret key inside an app can be taken out by anyone. Call your own backend from the app, and let the backend use the server client.
How does a customer continue the same chat later?
Save visitorId and conversationId and pass them back when you create the client. The JavaScript SDK does this for you.
How do I receive team replies?
Use the state helper with polling (React hook, ChatStore, LilyChatController), or call history() on your own timer.
Can I reply to Facebook, Instagram, WhatsApp and Telegram chats?
Yes. sendMessage delivers on the customer's own channel. Connect the channels first under Social in your panel. WhatsApp, Facebook and Instagram allow replies within 24 hours of the customer's last message.
What if Lily is unreachable?
The call fails with a LilyError whose status is 0 (isNetworkError). Show a retry option. The state helpers roll back the unsent message.
Need help with your integration?
Tell us your platform and what you want to build.
