How to Integrate the Guided Conversations SDK with Flutter Apps
To install the plugin in your project, run either of the below mentioned commands:
- flutter pub add zoho_gc_sdk
(or)
add the following in pubspec.yaml
dependencies:
zoho_gc_sdk: ^1.0.0
Android
The ASAP SDK's dependencies are available at maven.zohodl.com. To include them in your Android project, you must add the relevant Maven URLs to your project's build.gradle file.
To perform this, open the Android folder of your Flutter project in Android Studio and add the following Maven repository to the project-level build.gradle file.
iOS
There is no need to import iOS-specific dependencies separately into the project since the iOS SDK dependencies are automatically added to Flutter projects through the native part of the Flutter plugin.
How to show the Guided Conversations SDK on Flutter apps?
The following three keys are essential to initialize the SDK in your app:
- Organization ID (Org ID)
- BotId
- Domain
- import 'package:zoho_gc_sdk/zoho_gc_sdk.dart' show ZohoGCSDK;
ZohoGCSDK.show(orgId, botId, domain)
What are session variables?
These variables are dynamically retrieved during the bot conversations. These variables are org-specific and accessible across GC flows.
You can perform these actions with the session variable as mentioned:
Set Session Variable
- import 'package:zoho_gc_sdk/zoho_gc_sdk.dart' show ZohoGCSDK;
List<Map<String, String>> sessionVariable = [{"name": "YOUR VARIABLE NAME", "value" : "YOUR VARIABLE VALUE"}, {"name": "YOUR VARIABLE NAME", "value": "YOUR VARIABLE VALUE" }];
ZohoGCSDK.setSessionVariable(botId,sessionVariable);
Update Session Variable
- import 'package:zoho_gc_sdk/zoho_gc_sdk.dart' show ZohoGCSDK;
List<Map<String, String>> sessionVariable = [{"name": "YOUR VARIABLE NAME", "value" : "YOUR VARIABLE VALUE"}, {"name": "YOUR VARIABLE NAME", "value": "YOUR VARIABLE VALUE" }]; ZohoGCSDK.updateSessionVariable(orgId,botId,domain,sessionVariable);