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
PropertyDescription
configureconfigure the Website ID(Go to your Crisp Dashboard, and copy your Website ID:) ** this method must be called and call before other methods
setTokenIDAssigns the next session with a tokenID
resetChatSessionReset the session
setUserAvatarSets the user avatar
setUserCompanySets the user company
setUserEmailSets the user email (note: if email is invalid, this method will return false and the value will not be set)
setUserNicknameSets the user name
setUserPhoneSets the user phone (note: if phone is invalid, this method will return false and the value will not be set)
setSessionBoolSets a session data bool
setSessionIntSets a session data int
setSessionStringSets a session data string
setSessionSegmentSets a session segment
openChatOpen 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();
  }
}

Libraries

crisp_chat_sdk
employment
geolocation
user_company