An open API service indexing awesome lists of open source software.

https://github.com/erxes/flutter-erxes-sdk


https://github.com/erxes/flutter-erxes-sdk

Last synced: 14 days ago
JSON representation

Awesome Lists containing this project

README

          

# erxes_flutter_sdk

Flutter plugin for the [Erxes](https://erxes.io) messenger. It wraps the native
Erxes SDKs — `MessengerSDK` (iOS) and `io.github.munkhorgilb:messenger-sdk`
(Android) — behind one idiomatic Dart API built on platform channels.

> **Repository:** `erxes-flutter-sdk` · **Package name:** `erxes_flutter_sdk`
> (pub package names use `snake_case`).

## Platform support

| Feature | iOS | Android |
| --- | :---: | :---: |
| Chat mode (full screen) | ✅ | ✅ |
| Voice messages | ✅ | ✅ |
| `customData` on user | ✅ | ❌ (ignored by native SDK) |

This plugin targets **chat mode** only.

## Install

```yaml
dependencies:
erxes_flutter_sdk:
git:
url: https://github.com/Munkhorgilb/flutter-sdk.git
```

### iOS setup

- Minimum iOS **16.0**, Swift **5.9**.
- The underlying `erxes-ios-sdk` ships to CocoaPods as `ErxesMessengerSDK` 0.30.14
and is pulled in automatically on `pod install` — no extra setup needed. (SPM
host apps are still supported via the bundled `Package.swift`.)
- For voice messages, add to `ios/Runner/Info.plist`:

```xml
NSMicrophoneUsageDescription
Used to record voice messages in support chat.
NSSpeechRecognitionUsageDescription
Used to transcribe voice messages in support chat.
```

### Android setup

- Minimum `minSdk` **24**, Java/Kotlin JVM target **17**.
- The native SDK (`io.github.munkhorgilb:messenger-sdk`) is pulled from Maven
Central automatically.
- Release builds: the plugin ships consumer ProGuard rules that keep Material
icon and Erxes SDK classes used to resolve action icons by name.

## Usage

```dart
import 'package:erxes_flutter_sdk/erxes_flutter_sdk.dart';

// Listen for header / drawer action taps.
final sub = ErxesMessenger.onAction.listen((id) {
if (id == 'close') Navigator.of(context).pop();
});

await ErxesMessenger.configure(
integrationId: 'YOUR_INTEGRATION_ID',
endpoint: 'https://yourcompany.erxes.io', // or serverUrl / subDomain
user: const ErxesUser(name: 'Jane Doe', email: 'user@example.com'),
homeActions: const [
ErxesAction(id: 'close', title: 'Close', iosIcon: 'xmark', androidIcon: 'Close'),
],
);
```

See [`example/`](example/) for a full settings → support → chat flow.

## API

| Method | Description |
| --- | --- |
| `configure({...})` | Configure and (in chat mode) present the messenger. |
| `setUser(ErxesUser)` | Update the current customer identity. |
| `clearUser()` | Clear the current customer identity. |
| `showMessenger()` | Present the chat messenger UI. |
| `hideMessenger()` | Dismiss the messenger (no-op on Android). |
| `onAction` | `Stream` of tapped action ids. |
| `onReady` | `Stream` emitted when the messenger is ready. |

### Models

- `ErxesUser({ email, phone, name, customData })`
- `ErxesAction({ id, title, iosIcon, androidIcon })`

## Troubleshooting

- **iOS build can't find `MessengerSDK`** — run `pod install` from `ios/` (or
`flutter clean` and rebuild) so CocoaPods fetches `ErxesMessengerSDK`.
- **Android action icons missing in release** — confirm minification didn't strip
icon classes; the bundled `consumer-rules.pro` should cover this.