ebchat_core

Pure-Dart client for the ebchat first-party livechat protocol (/livechat/v1) — REST calls, protocol models, and a conversation controller. No Flutter dependency.

Most apps should depend on ebchat (the drop-in Flutter SDK) rather than this package directly — it re-exports everything here. Reach for ebchat_core when you are building your own UI, or driving a conversation from a non-Flutter Dart process.

Usage

final api = LivechatApiClient(baseUrl: Uri.parse('https://ebchat-backend.e-butler.com'));

// `apiKey` is an eb_… token from your ebchat dashboard, scoped to the LIVECHAT
// permission; `partnerId` is the id it was issued under.
final session = await api.createSession(apiKey, partnerId, appSource: 'my_app');
final convo = await api.createOrGetConversation(session.token);

await api.sendMessage(
  session.token,
  convo.conversation.id,
  SendMessageRequest.text('Hello!', clientId: 'tmp-1'),
);

EbchatConversationController wraps that into a live message stream, optimistic echoes, pagination, typing and read receipts. It polls by default; pass a PusherLivechatRealtime (built from the gateway's bootstrap realtime block) to receive messages over a WebSocket instead.

final controller = EbchatConversationController(
  api: api,
  token: session.token,
  conversationId: convo.conversation.id,
  guestId: session.guest.id,
);
await controller.start(seed: convo.messages);
controller.messages.listen(render);
Package Role
ebchat Flutter widgets + the drop-in chat screen

License

MIT — see LICENSE.

Libraries

ebchat_core
Pure-Dart client for the ebchat first-party livechat protocol.