figochat library

FigoChat SDK: chat with a Figo AI assistant, with voice messages and file uploads.

FigoChat.initialize(
  apiKey: 'YOUR_API_KEY',
  assistantId: 'YOUR_ASSISTANT_ID',
  fullName: 'Ada Lovelace',
  emailAddress: 'ada@example.com',
  mobilePhone: '+2348012345678',
  primaryColor: '#F97316',
);

FigoChat.open(context);            // full-screen chat
// or embed: const FigoChatView()

Classes

FigoAttachment
An attachment on a chat message.
FigoChat
Entry point of the SDK. Call initialize once (for example after the user signs in), then show the chat with open or embed a FigoChatView.
FigoChatClient
Thin client over the Figo AI public REST APIs:
FigoChatConfig
Settings passed to FigoChat.initialize.
FigoChatMessage
FigoChatReply
FigoChatView
The FigoChat chat screen: message list, text input, voice notes and file attachments. Call FigoChat.initialize(...) before showing it.
FigoCrypto
AES-256-GCM encrypt/decrypt util. Every instance makes its own random 256-bit key, held only in memory, and every encrypt call uses a fresh random 12-byte IV. Output is <iv base64>:<ciphertext+tag base64>.
FigoRealtimeConfig
Public realtime settings from GET /api/v1/realtime/config.
FigoUploadFile
A file to upload: its name (with extension) and contents.

Enums

FigoErrorContext
What the user was doing when the error happened; picks the fallback wording.
FigoMessageRole
FigoMessageStatus

Constants

defaultBaseUrl → const String

Functions

friendlyMessage(Object error, [FigoErrorContext context = FigoErrorContext.chat]) → String
Turns an SDK error into a message that is safe to show to the app's users. Setup problems the user can't fix (invalid or expired API key, no credits, plan limit) all read as "chat isn't available"; the technical message stays on the error, which onError receives for logging.
htmlToText(String html) → String
Live agent replies are published in the web widget's HTML form (<b>Name</b> says:<br/>text, HTML-encoded). Turns that into the SDK's text form: <b> becomes **bold**, <br> a line break, other tags are dropped and entities are decoded.

Exceptions / Errors

FigoChatException
Error thrown by every SDK call. code is the API response code or the HTTP status.