simx_zendesk_support
A Flutter plugin for integrating Zendesk Support, Chat, and AnswerBot SDKs on both Android and iOS. This plugin simplifies the process of embedding Zendesk's customer support features into your Flutter application.
Features
- Initialize Zendesk SDK: Configure with your Zendesk URL, App ID, and Client ID.
- Start Chat: Launch a live chat session with support agents.
- Start Chat Bot (Answer Bot): Initiate an automated conversation with Answer Bot.
- Show Help Center: Display your Zendesk Help Center articles and categories.
- Send User Information: Pass user details (name, email, phone) to Zendesk for context.
- Show List of Tickets: View a list of the user's support tickets.
Getting Started
Installation
Add simx_zendesk_support to your pubspec.yaml:
dependencies:
simx_zendesk_support: ^0.0.4
Platform Configuration
Android
-
Set the
minSdkVersionto24in yourandroid/app/build.gradle:defaultConfig { minSdkVersion 24 } -
Add the
INTERNETpermission to yourAndroidManifest.xmlif not already present:<uses-permission android:name="android.permission.INTERNET"/>
iOS
-
Ensure your deployment target is set to iOS 13.0 or higher in your
Podfile:platform :ios, '13.0' -
Swift Package Manager Support: This plugin supports Swift Package Manager (SPM) for iOS. If your app is configured to use SPM, Flutter will automatically resolve the dependencies. Ensure you've enabled SPM in your Flutter configuration:
flutter config --enable-swift-package-manager -
Add usage descriptions to your
Info.plistfor camera, photo library, and microphone access (required for attachments and voice messages):<key>NSCameraUsageDescription</key> <string>This app requires access to the camera to attach photos to support tickets.</string> <key>NSPhotoLibraryUsageDescription</key> <string>This app requires access to the photo library to attach photos to support tickets.</string> <key>NSMicrophoneUsageDescription</key> <string>This app requires access to the microphone for voice messages.</string>
Usage
Import the package:
import 'package:simx_zendesk_support/simx_zendesk_support.dart';
Initialize the plugin:
final _zendeskSupport = SimxZendeskSupport();
await _zendeskSupport.initialize(
url: 'https://yoursubdomain.zendesk.com',
appId: 'YOUR_APP_ID',
clientId: 'YOUR_CLIENT_ID',
name: 'User Name',
emailId: 'user@example.com',
userId: 'unique_user_id',
);
Start Chat
_zendeskSupport.startChat(
name: 'User Name',
emailId: 'user@example.com',
phoneNumber: '1234567890',
);
Show Help Center
_zendeskSupport.showHelpCenter(
name: 'User Name',
emailId: 'user@example.com',
userId: 'unique_user_id',
categoryIdList: [], // Optional list of category IDs to filter
);
Push Notifications
To register your push token with Zendesk (FCM for Android, APNs for iOS):
await _zendeskSupport.setPushToken("YOUR_DEVICE_TOKEN");
Custom Theming
You can set a primary theme color for the Zendesk SDK UI:
await _zendeskSupport.setThemeColor(0xFF0000FF); // Blue
Note: On Android, programmatic theming for the Unified SDK is limited. It is recommended to use the styles.xml approach for comprehensive results.
Future Enhancements
xAdd JWT authentication supportAdd more granular error handlingxAdd unit testsxAdd integration tests
JWT Authentication Example
await _zendeskSupport.initialize(
url: 'https://yoursubdomain.zendesk.com',
appId: 'YOUR_APP_ID',
clientId: 'YOUR_CLIENT_ID',
name: 'User Name',
emailId: 'user@example.com',
userId: 'unique_user_id',
jwtToken: 'YOUR_JWT_TOKEN', // Provide JWT token for authenticated identity
);
Support
If you find this plugin helpful and want to support its development, you can buy me a coffee!
Contributing
Contributions are welcome! If you find a bug or want to add a feature, please open an issue or submit a pull request on GitHub.
Troubleshooting
For common issues like Android theme crashes (AppBarLayout) or iOS build errors, please refer to the TROUBLESHOOTING.md guide.
Quick Tip: Android Theme
If your app crashes when opening Zendesk UI, ensure your app theme inherits from Theme.MaterialComponents in styles.xml.
License
This project is licensed under the MIT License - see the LICENSE file for details.
