Chat360 Flutter SDK 🚀

A Flutter package that embeds the Chat360 web client in a WebView and exposes a concise, Flutter-friendly API to present the chatbot UI and exchange events with the web client.


Key features ✅

  • Configurable parameters for customization (bot ID, app ID, debug mode, etc.).
  • Supports sending metadata to enhance chatbot functionality.
  • Back button navigation support with custom callback handlers
  • Lightweight and easy to use.

Compatibility 📱

  • Flutter 3.25+ (Dart 3+)

Installation

During development you can depend on the local package using a path dependency:

dependencies:
  chat360_flutter_sdk: <latest-version>

Or use a Git dependency for integration testing:

dependencies:
  chat360_flutter_sdk:
    git:
      url: https://github.com/your-org/chat360-flutter-sdk.git
      ref: main

Usage examples ✨

Configure the SDK

final config = Chat360Config(
  botId: 'YOUR_BOT_ID',
  appId: 'YOUR_APP_ID', // Optional
  isDebug: true,  // Optional
  useNewUI: false, // Optional
  baseUrl: 'https://app.chat360.io',  // Optional
  meta: {'user_id': '123'},  // Optional
);

Chat360Bot.shared.setConfig(config);

Present a full-screen chat (push screen)

await Chat360Bot.shared.startChatbot(
  context,
  title: 'Support',
  onBackClick: () => print('Back pressed'),
);

Embed a view inline

// somewhere in your layout
Chat360BotView(botConfig: Chat360Bot.shared.config!);

Sending events to the bot (Dart → JS)

await Chat360Bot.shared.sendEventToBot({'action': 'open_faq'});

Handling events from the bot (JS → Dart)

Chat360Bot.shared.handleWindowEvents = (body) async {
  // body is Map<String,String>
  // Return metadata map to send back to the web client (optional)
  return {'handled': 'true'};
};

Providing location when requested

Chat360Bot.shared.onLocationNeeded = (callbackId) async {
  // return {'latitude': '12.3', 'longitude': '45.6'} or null
  return {'latitude': '37.4', 'longitude': '-122.1'};
};

Note: the example app shows a sample location provider returning a fixed location — replace it with real location access in production.


Example app

The repository includes an /example app that demonstrates:

  • Setting configuration (botId, appId, baseUrl)
  • Starting the chat screen (Chat360Bot.shared.startChatbot)
  • Sending events and providing a demo location provider

Run the example with flutter run in the example/ folder.


Contributing

Contributions and issues are welcome. Please open issues or pull requests against the repository.