freshdesk_flutter_sdk 1.2.0
freshdesk_flutter_sdk: ^1.2.0 copied to clipboard
Official Freshdesk Flutter SDK — in-app customer support, live chat, and knowledge base for Android and iOS, wrapping the native Freshdesk SDKs.
Freshdesk Flutter SDK #
"Modern ticketing software that your sales and customer engagement teams will love." Flutter plugin wrapping the native Freshdesk iOS and Android SDKs — customer support, live chat, and knowledge base for your Flutter app.
Features #
- Support home and live chat
- Knowledge base / FAQ
- Open a specific topic
- Unread message count (one-shot and real-time via a stream)
- User and ticket properties
- JWT user authentication
- User event tracking
- Content configuration / localisation
- Custom link handling
- Push notifications (configured natively in the host app)
Requirements #
- Flutter
>=3.44.0(Dart>=3.0.0 <4.0.0) - iOS
15.0+(the native Freshdesk iOS SDK is vendored as an XCFramework; works with both Swift Package Manager and CocoaPods) - Android
minSdkVersion 26+,compileSdkVersion 36 - The native Android dependency (
com.freshworks.sdk:freshdesk) is resolved automatically from Maven Central
Installation #
Add the dependency to your app's pubspec.yaml:
dependencies:
freshdesk_flutter_sdk: ^1.0.1
Then fetch packages:
flutter pub get
The plugin uses Flutter autolinking — no manual linking is required.
Android. Ensure mavenCentral() is in your repositories and
minSdkVersion is 26+. The native dependency is included automatically:
allprojects {
repositories {
google()
mavenCentral()
}
}
iOS. Set the deployment target to 15.0+ in your Xcode project and, if you
use CocoaPods, in your Podfile:
platform :ios, '15.0'
Flutter selects Swift Package Manager (default on Flutter 3.44+) or CocoaPods automatically when you build.
Credentials #
Get your credentials from the Freshdesk portal: Admin Settings → Mobile Chat
SDK → your SDK (token, host, sdkId). For JWT-enforced SDKs you also need
a per-user jwt.
Initialization #
Initialize once, as early as possible in your app lifecycle. All other methods require initialization first.
import 'package:freshdesk_flutter_sdk/freshdesk_flutter_sdk.dart';
await FreshdeskSdk.initialize(
const FreshdeskSdkConfig(
token: '<YOUR_TOKEN>',
host: '<YOUR_HOST>',
sdkId: '<YOUR_SDK_ID>',
locale: 'en', // optional, default 'en' (applied at init only)
jwt: null, // required only for JWT-enforced SDKs
debugMode: false, // optional, Android only
),
);
Push notifications are optional. In-app support works without push wiring — configure push separately when you need tray notifications.
Core usage #
// Support home
await FreshdeskSdk.openSupport();
// Knowledge base / FAQ
await FreshdeskSdk.openKnowledgeBase();
// A specific topic (at least one of topicId / topicName is required)
await FreshdeskSdk.openTopic(topicName: 'Orders', topicId: '12345');
// Dismiss any open Freshdesk view
await FreshdeskSdk.dismissFreshdeskViews();
// One-shot unread value
final count = await FreshdeskSdk.getUnreadCount();
// Real-time updates (unread count + JWT user-state changes)
final sub = FreshdeskSdk.events.listen((event) {
if (event is UnreadCountChangedEvent) {
print('Unread count: ${event.count}');
}
});
// Clean up when done
await sub.cancel();
User and ticket properties #
For non-JWT-enforced SDKs, set user properties after initialization. Properties must be whitelisted under the linked widget's Contact/Ticket fields.
await FreshdeskSdk.setUserProperties({
'firstName': 'Jane',
'lastName': 'Doe',
'email': 'jane@example.com',
});
await FreshdeskSdk.setTicketProperties({'source': 'help_center'});
// Read current user
final user = await FreshdeskSdk.getUser();
For JWT-enforced SDKs, user properties are updated through the JWT payload.
JWT authentication #
// Authenticate the current user and apply properties carried in the token.
await FreshdeskSdk.authenticateAndUpdate('<SIGNED_JWT>');
// Call before authenticating a different user (e.g. on logout).
await FreshdeskSdk.resetUser();
Documentation #
- Installation
- Initialization
- API reference
- Troubleshooting
Supported on Android and iOS only.
Native dependencies #
| Platform | Version | Source |
|---|---|---|
| Android | 2.2.3 | Maven Central com.freshworks.sdk:freshdesk |
| iOS | 1.3.1 | FreshdeskSDK.xcframework via ./scripts/fetch_freshdesk_ios_sdk.sh |
Run python3 scripts/sdk_release.py status from the repo root for current pins.
AI Integration Kit #
This package ships a reusable skill, at
ai-integration-kit/, that teaches AI coding agents
(Cursor, Claude, GitHub Copilot, Codex CLI, Kiro, etc.) how to integrate,
debug, and answer questions about this SDK in your app.
You don't need to open ai-integration-kit/README.md
first — copy the kit into your app, then just prompt your AI tool. Find the
package on disk with flutter pub deps (path/git dependencies resolve
directly; hosted dependencies land under
~/.pub-cache/hosted/pub.flutter-io.cn/freshdesk_flutter_sdk-<version>/), then:
cp -R <path-to-freshdesk_flutter_sdk-package>/ai-integration-kit/. /path/to/your-app/
Then prompt your AI tool: "Follow the Freshdesk Flutter SDK integration
skill." It will ask for your host/locale, wire up initialization, support
entry points, JWT or user properties, and push — or just answer integration
questions directly. Full docs live in ai-integration-kit/README.md once
it's copied into your app.
End of process: generated freshdesk_config_local.dart #
When the integration skill finishes wiring the SDK into a host app, it writes a
gitignored lib/config/freshdesk_config_local.dart. The agent pre-fills every
value it can with a sensible default and leaves only the portal-specific secrets
as placeholders for you to complete:
// Gitignored. Do not commit. Fill token, host, and sdkId from your portal.
import 'package:freshdesk_flutter_sdk/freshdesk_flutter_sdk.dart';
const FreshdeskSdkConfig freshdeskConfigLocal = FreshdeskSdkConfig(
token: 'YOUR_TOKEN', // ← required, from Admin → Mobile Chat SDK
host: 'YOUR_HOST', // ← required, e.g. acme.freshdesk.com (see below)
sdkId: 'YOUR_SDK_ID', // ← required, from Admin → Mobile Chat SDK
locale: 'en', // default 'en'
jwt: null, // default null; set only for JWT-enforced SDKs
debugMode: false, // default false; set true while integrating
);
Defaults applied automatically: locale: 'en', jwt: null, debugMode: false.
Only token, host, and sdkId need your portal values.
Host accepts both formats (with or without https://) #
host may be supplied with or without a scheme. The SDK normalizes it before
handing it to the native layer, so all of these are valid:
| You provide | Sent to native SDK |
|---|---|
acme.freshdesk.com |
https://acme.freshdesk.com |
https://acme.freshdesk.com |
https://acme.freshdesk.com (unchanged) |
http://localhost:3000 |
http://localhost:3000 (unchanged) |
When no http:// or https:// scheme is present, https:// is prepended
automatically (see FreshdeskSdkConfig.normalizeHost). Surrounding whitespace
is trimmed. You never have to guess which form the portal gave you.
Support #
- Email: support@freshdesk.com
- Documentation: support.freshdesk.com
License #
Freshdesk SDK License Agreement (proprietary, non-commercial) — see LICENSE.