crisp_chat_sdk 0.0.6 copy "crisp_chat_sdk: ^0.0.6" to clipboard
crisp_chat_sdk: ^0.0.6 copied to clipboard

Native Crisp chat sdk of android and ios sdk in flutter, android sdk version is im.crisp:crisp-sdk:1.0.11 and ios sdk version is Crisp 1.1.0

crisp_chat_sdk #

Impelemented native Crisp chat sdk on android and ios

Preview #

Screen Shot 2022-02-07 at 6 26 09 PM

https://user-images.githubusercontent.com/32927238/152813181-80642f1a-35c0-428e-bfb9-dd2060cc7b16.mp4

Android implementation:

1-Add: implementation 'androidx.multidex:multidex:2.0.1' to dependencies build.gradle like below:

dependencies {
    …
    implementation 'androidx.multidex:multidex:2.0.1'
}

2-Enable multiDexEnabled true in build.gradle like this:

defaultConfig {
    …
    multiDexEnabled true
}

3-Set min sdk on 19 in build.gradle like below:

defaultConfig {
    …
    multiDexEnabled true

	minSdkVersion 19
}

IOS implementation:

1-Run below commands in terminal in root of project:

cd ios
pod install
Property Description
configure configure the Website ID(Go to your Crisp Dashboard, and copy your Website ID:) ** this method must be called and call before other methods
setTokenID Assigns the next session with a tokenID
resetChatSession Reset the session
setUserAvatar Sets the user avatar
setUserCompany Sets the user company
setUserEmail Sets the user email (note: if email is invalid, this method will return false and the value will not be set)
setUserNickname Sets the user name
setUserPhone Sets the user phone (note: if phone is invalid, this method will return false and the value will not be set)
setSessionBool Sets a session data bool
setSessionInt Sets a session data int
setSessionString Sets a session data string
setSessionSegment Sets a session segment
openChat Open chat view (this method open chat page)

Usage #

import 'package:flutter/material.dart';
import 'dart:async';

import 'package:crisp_chat_sdk/crisp_chat_sdk.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: ElevatedButton(
            onPressed: () {
              initPlatformState();
            },
            child: const Text('Open crisp chat'),
          ),
        ),
      ),
    );
  }

  Future<void> initPlatformState() async {
    final sdk = CrispChatSdk();
    await sdk.configure(websiteId: "Your WebsiteId");
    await sdk.setUserEmail(email: "mohammad.mohammady.73@gmail.com");
    await sdk.setSessionString(key: "f1KEY", value: "f1value");
    await sdk.setSessionString(key: "f2KEY", value: "f2value");
    await CrispChatSdk().openChat();
  }
}

11
likes
140
pub points
79%
popularity

Publisher

unverified uploader

Native Crisp chat sdk of android and ios sdk in flutter, android sdk version is im.crisp:crisp-sdk:1.0.11 and ios sdk version is Crisp 1.1.0

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on crisp_chat_sdk