zendesk_flutter_plus

A Flutter plugin that bridges the Zendesk Messaging SDK and the Classic Zendesk Support SDK v2 to Flutter apps via MethodChannel.

Since the Zendesk SDKs only support native Android (Kotlin/Java) and iOS (Swift/Objective-C), this plugin provides a clean Flutter API for both modern messaging and classic ticket-based support.

Features

Messaging SDK (new)

  • ✅ Initialize with channel key
  • ✅ Show the native Zendesk messaging UI
  • ✅ JWT authentication (login / logout)
  • ✅ Event streaming (unread count, auth failures, connection status, etc.)
  • ✅ Push notification token registration
  • ✅ Conversation tags & custom fields

Classic Support SDK v2

  • ✅ Initialize with subdomain URL, app ID, and client ID
  • ✅ JWT identity & anonymous identity management
  • ✅ List, get, and create support tickets
  • ✅ List and add ticket comments
  • ✅ Upload and delete file attachments

Getting Started

Prerequisites

  • Flutter ≥ 3.3.0
  • Android: minSdkVersion 21
  • iOS: minimum deployment target 16.0
  • A Zendesk Support or Suite plan

Installation

Add to your pubspec.yaml:

dependencies:
  zendesk_flutter_plus: ^0.1.0

Android Setup

Add the Zendesk Maven repositories to your android/build.gradle (or settings.gradle.kts):

repositories {
    // Messaging SDK
    maven { url "https://zendesk.jfrog.io/artifactory/repo" }
    // Classic Support SDK v2
    maven { url "https://zendesk.jfrog.io/zendesk/repo" }
}

iOS Setup

The Zendesk SDK dependency is declared in the plugin's podspec. Just run:

cd ios && pod install

Add the following keys to your Info.plist for camera, microphone, and photo library access:

<key>NSCameraUsageDescription</key>
<string>Used to capture images for support conversations</string>
<key>NSMicrophoneUsageDescription</key>
<string>Used to capture video for support conversations</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Used to share images in support conversations</string>

Usage

Messaging SDK

Initialize

import 'package:zendesk_flutter_plus/zendesk_flutter_plus.dart';

final zendesk = ZendeskFlutterPlugin();

await zendesk.initialize(channelKey: 'your_channel_key');

Show Messaging UI

await zendesk.show();

Authentication

// Login with JWT (generated by your backend)
final user = await zendesk.loginUser(jwt: 'your_jwt_token');
print('Logged in as: ${user?.id}');

// Logout
await zendesk.logoutUser();

Listen to Events

zendesk.onEvent.listen((event) {
  switch (event.type) {
    case ZendeskEventType.unreadMessageCountChanged:
      final count = event.data['unreadCount'] as int;
      print('Unread messages: $count');
    case ZendeskEventType.authenticationFailed:
      print('Auth failed: ${event.data['error']}');
    default:
      print('Event: ${event.type}');
  }
});

Push Notifications

await zendesk.updatePushNotificationToken('your_fcm_or_apns_token');

Conversation Metadata

await zendesk.setConversationTags(['vip', 'priority']);
await zendesk.setConversationFields({'field_id': 'value'});

// Clear
await zendesk.clearConversationTags();
await zendesk.clearConversationFields();

Classic Support SDK v2

Initialize

await zendesk.initializeClassic(
  subdomainUrl: 'https://yoursite.zendesk.com',
  appId: 'your_app_id',
  clientId: 'mobile_sdk_client_xxx',
);

Set Identity

// JWT identity (for authenticated users)
await zendesk.setClassicIdentity(jwt: 'zendesk_jwt');

// Anonymous identity (for guest access)
await zendesk.setClassicAnonymousIdentity(
  name: 'Guest User',   // optional
  email: 'guest@example.com', // optional
);

Tickets

// List tickets
final tickets = await zendesk.getTickets();

// Get a single ticket
final ticket = await zendesk.getTicket(ticketId: '12345');

// Create a ticket
final newTicket = await zendesk.createTicket(
  subject: 'App crash on login',
  description: 'The app crashes when I try to log in with Google SSO.',
  tags: ['bug', 'login'],
);

Comments

// Get comments for a ticket
final comments = await zendesk.getTicketComments(requestId: '12345');

// Add a comment
await zendesk.addTicketComment(
  requestId: '12345',
  comment: 'Any update on this issue?',
);

Attachments

// Upload a file attachment
final token = await zendesk.uploadAttachment(
  filePath: '/path/to/screenshot.png',
  mimeType: 'image/png',
);

// Delete an attachment
await zendesk.deleteAttachment(token: token!);

API Reference

Messaging SDK

Method Description
initialize(channelKey:) Initialize the Messaging SDK
show() Open the messaging UI
loginUser(jwt:) Authenticate with JWT
logoutUser() Log out current user
getUnreadMessageCount() Get unread message count
setConversationTags(tags) Set conversation tags
clearConversationTags() Clear conversation tags
setConversationFields(fields) Set conversation fields
clearConversationFields() Clear conversation fields
updatePushNotificationToken(token) Register push token
isInitialized Check if SDK is initialized
onEvent Stream of Zendesk events

Classic Support SDK v2

Method Description
initializeClassic(subdomainUrl:, appId:, clientId:) Initialize Classic SDK
setClassicIdentity(jwt:) Set JWT identity
setClassicAnonymousIdentity(name:, email:) Set anonymous identity
getTickets() List all support tickets
getTicket(ticketId:) Get a single ticket
createTicket(subject:, description:, tags:) Create a ticket
getTicketComments(requestId:) List ticket comments
addTicketComment(requestId:, comment:, attachments:) Add a comment
uploadAttachment(filePath:, mimeType:) Upload a file
deleteAttachment(token:) Delete an uploaded file

Event Types

Event Description
unreadMessageCountChanged Unread count changed
authenticationFailed Authentication error
connectionStatusChanged Connection status changed
sendMessageFailed Message send failed
conversationStarted Conversation started
conversationOpened Conversation opened
messagingOpened Messaging UI opened
messagingClosed Messaging UI closed

Example App

The example app demonstrates both SDK integrations with a clean UI. Configure your Zendesk credentials in the Settings page, then test each feature interactively.

cd example
flutter run

License

See LICENSE for details.

Libraries

zendesk_flutter_plus
A Flutter plugin for integrating the Zendesk Messaging SDK and the Classic Zendesk Support SDK v2.
zendesk_flutter_plus_method_channel
zendesk_flutter_plus_platform_interface