Skip to content

API Documentation

Complete reference for all public methods in the FlutterCrispChat class.

Platform support

APIAndroid / iOSWebDesktop
openCrispChatNative SDK UIWeb chatboxWebView or browser
resetCrispChatSessionYesYesWebView only
setSessionString / setSessionInt / setSessionSegmentsYesYesWebView only
pushSessionEventYesYesWebView only
getSessionIdentifierYesYesWebView only
getUnreadMessageCount / markMessagesAsReadYesYes*Yes*
openHelpdeskNative SDK UIWeb chatboxWebView or browser
openHelpdeskArticleNative SDK UIWeb chatboxWebView or browser
openChatboxFromNotificationAndroid (primarily)No-opNo-op
setOnNotificationTappedCallbackAndroidNo-opNo-op
isVideoCallsSupportediOS (opt-in WebRTC)No (upstream)Yes (web widget)

* Prefer a backend proxy for REST credentials on Web. See Supported Platforms.

FlutterCrispChat

All methods are static on the FlutterCrispChat class.

dart
import 'package:crisp_chat/crisp_chat.dart';

openCrispChat

Opens Crisp chat: native UI on Android/iOS, web chatbox on Web, embedded WebView (or browser fallback) on desktop.

dart
static Future<void> openCrispChat({required CrispConfig config})
ParameterTypeRequiredDescription
configCrispConfigYesConfiguration object with website ID, user details, etc.

Throws:

  • ArgumentError if config.user.email is provided but invalid
  • ArgumentError if config.user.company.url is provided but invalid

Behavior: After opening the chat, the method waits 3 seconds and then caches the session identifier internally.


resetCrispChatSession

Resets the current chat session and clears cached data.

dart
static Future<void> resetCrispChatSession()

Call this when your app user logs out to clear their chat history from the device.


setSessionString

Sets a custom string value in the current session.

dart
static void setSessionString({required String key, required String value})
ParameterTypeRequiredDescription
keyStringYesData key (must not be empty)
valueStringYesString value (must not be empty)

Throws: ArgumentError if key or value is empty.


setSessionInt

Sets a custom integer value in the current session.

dart
static void setSessionInt({required String key, required int value})
ParameterTypeRequiredDescription
keyStringYesData key (must not be empty)
valueintYesInteger value

Throws: ArgumentError if key is empty.


getSessionIdentifier

Retrieves the current Crisp session identifier.

dart
static Future<String?> getSessionIdentifier()

Returns: The session ID string, or null if no session exists. Falls back to a cached value if the native SDK returns null.


setSessionSegments

Sets user segments for the current session.

dart
static void setSessionSegments({
  required List<String> segments,
  bool overwrite = false,
})
ParameterTypeRequiredDefaultDescription
segmentsList<String>YesSegment strings
overwriteboolNofalseReplace existing segments if true

pushSessionEvent

Sends a custom event to the Crisp session timeline.

dart
static Future<void> pushSessionEvent({
  required String name,
  SessionEventColor color = SessionEventColor.blue,
})
ParameterTypeRequiredDefaultDescription
nameStringYesEvent name
colorSessionEventColorNoblueEvent color in the dashboard

getUnreadMessageCount

Fetches the unread message count via the Crisp REST API.

dart
static Future<int?> getUnreadMessageCount({
  required String websiteId,
  required String identifier,
  required String key,
})
ParameterTypeRequiredDescription
websiteIdStringYesYour Crisp Website ID
identifierStringYesCrisp REST API Identifier
keyStringYesCrisp REST API Key

Returns: Unread count as int, or null if no session or error.

iOS

On iOS, unread.visitor may not reset after reading chat in the native SDK. Use markMessagesAsRead as a workaround.


markMessagesAsRead

Marks all operator messages as read via the Crisp REST API. Workaround for iOS when the native SDK does not sync read receipts.

dart
static Future<bool?> markMessagesAsRead({
  required String websiteId,
  required String identifier,
  required String key,
})
ParameterTypeRequiredDescription
websiteIdStringYesYour Crisp Website ID
identifierStringYesCrisp REST API Identifier
keyStringYesCrisp REST API Key

Returns: true if accepted (HTTP 202), false on error, null if no session.


openChatboxFromNotification

Opens the Crisp chatbox from a notification intent (Android only).

dart
static Future<bool> openChatboxFromNotification()

Returns: true if the chatbox was opened from a notification, false otherwise. Always returns false on iOS.


setOnNotificationTappedCallback

Sets a callback for when a Crisp notification is tapped while the app is in the background.

dart
static void setOnNotificationTappedCallback(VoidCallback? callback)
ParameterTypeRequiredDescription
callbackVoidCallback?YesCallback function, or null to remove

Note: Requires import 'dart:ui'; for VoidCallback. Only fires on Android.


isVideoCallsSupported

Returns whether the current build supports Crisp video/audio calls.

dart
static Future<bool> isVideoCallsSupported()
PlatformReturns true when
iOSApp was built with video enabled: $CrispChatWebRTC = true (CocoaPods) or CRISP_CHAT_WEBRTC=true (SPM)
AndroidNever (native video not supported yet by Crisp)
Web / desktopWeb chatbox handles calls via browser WebRTC when enabled in your Crisp dashboard

Important: This is a build-time capability check, not a runtime toggle. There is no CrispConfig flag for video. Setup: Enable video calls (iOS only).

Example:

dart
if (await FlutterCrispChat.isVideoCallsSupported()) {
  // iOS WebRTC build, or Web/desktop
}

openHelpdesk

Opens the Crisp Helpdesk/FAQ search screen directly, without first opening live chat. Supported on all platforms.

dart
static Future<void> openHelpdesk({required String websiteId})
ParameterTypeRequiredDescription
websiteIdStringYesYour Crisp website ID

Throws: ArgumentError if websiteId is empty or whitespace-only.

Example:

dart
await FlutterCrispChat.openHelpdesk(websiteId: 'YOUR_WEBSITE_ID');
PlatformBehaviour
Android / iOSNative SDK: calls Crisp.searchHelpdesk() / CrispSDK.searchHelpdesk()
Web$crisp.push(["do", "helpdesk:search"]) via the Crisp Web Chat SDK
DesktopSame $crisp command injected into the embedded WebView

See Helpdesk / FAQ for full details.


openHelpdeskArticle

Opens a specific helpdesk article by locale and slug. Supported on all platforms.

dart
static Future<void> openHelpdeskArticle({
  required String websiteId,
  required String locale,
  required String slug,
  String? title,
  String? category,
})
ParameterTypeRequiredDescription
websiteIdStringYesYour Crisp website ID
localeStringYesArticle language code (e.g. 'en', 'fr')
slugStringYesArticle slug from your Crisp Helpdesk dashboard
titleString?NoOptional display title override
categoryString?NoOptional category name

Throws: ArgumentError if websiteId, locale, or slug is empty.

Example:

dart
await FlutterCrispChat.openHelpdeskArticle(
  websiteId: 'YOUR_WEBSITE_ID',
  locale: 'en',
  slug: 'getting-started',
  title: 'Getting Started',
  category: 'General',
);

The article slug can be found in your Crisp dashboard under Helpdesk → open an article → the URL and article settings contain the slug.

PlatformBehaviour
Android / iOSNative SDK: Crisp.openHelpdeskArticle() / CrispSDK.openHelpdeskArticle()
Web$crisp.push(["do", "helpdesk:article:open", [locale, slug, ...]]) via the Crisp Web Chat SDK
DesktopSame $crisp command injected into the embedded WebView

See Helpdesk / FAQ for full details.


onCrispEvent

A broadcast stream of native Crisp SDK events. Supported on Android and iOS only — never emits on Web/desktop.

dart
static Stream<CrispChatEvent> get onCrispEvent

The native event callback is registered on the first .listen() call and unregistered once the last listener cancels.

Example:

dart
final subscription = FlutterCrispChat.onCrispEvent.listen((event) {
  print('${event.type}: ${event.message?.text}');
});

await subscription.cancel();
PlatformBehaviour
AndroidNative SDK: Crisp.addCallback(EventsCallback) / Crisp.removeCallback()
iOSNative SDK: CrispSDK.addCallback(Callback) / CrispSDK.removeCallback(token:)
Web / DesktopNot supported — the stream never emits

See Chat Events for full details, including the CrispChatEvent/CrispMessage field reference.


CrispConfig

dart
CrispConfig({
  required String websiteID,
  String? tokenId,
  String? sessionSegment,
  User? user,
  bool enableNotifications = true,
})

User

dart
User({
  String? email,
  String? signature,
  String? nickName,
  String? phone,
  String? avatar,
  Company? company,
})

Company

dart
Company({
  String? name,
  String? url,
  String? companyDescription,
  Employment? employment,
  GeoLocation? geoLocation,
})

Employment

dart
Employment({
  String? title,
  String? role,
})

GeoLocation

dart
GeoLocation({
  String? city,
  String? country,
})

SessionEventColor

dart
enum SessionEventColor {
  black, blue, brown, green, grey,
  orange, pink, purple, red, yellow,
}

Next Steps

  • Full Example — Working example app code
  • FAQ — Frequently asked questions