Coder Social home page Coder Social logo

bookmebus / flutter-crisp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lunahq/flutter-crisp

0.0 0.0 0.0 193 KB

Flutter plugin for Crisp Chat

Home Page: https://pub.dev/packages/crisp

License: MIT License

Kotlin 3.16% Swift 3.07% Objective-C 0.28% Dart 67.36% Ruby 26.13%

flutter-crisp's Introduction

Flutter Crisp

pub package License: MIT Twitter: oilunabr

Connect with Crisp Chat, register a user to chat (or not) and render a chat widget.

Tested on Android and iOS.

Required setup

Min SDK version:

minSdkVersion 17

AndroidManifest.xml necessary changes:

    <application
        android:usesCleartextTraffic="true">
        ...
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
        <provider
            android:name="com.pichillilorenzo.flutter_inappwebview.InAppWebViewFileProvider"
            android:authorities="${applicationId}.flutter_inappwebview.fileprovider"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/provider_paths" />
        </provider>
    </application>

For details check the example folder.

How to use

Initialize with:

  CrispMain crispMain;

  @override
  void initState() {
    super.initState();

    crispMain = CrispMain(
      websiteId: 'WEBSITE_ID',
      locale: 'pt-br',
    );

    crispMain.register(
      user: CrispUser(
        email: "[email protected]",
        avatar: 'https://avatars2.githubusercontent.com/u/16270189?s=200&v=4',
        nickname: "João Cardoso",
        phone: "5511987654321",
      ),
    );

    crispMain.setMessage("Hello world");

    crispMain.setSessionData({
      "order_id": "111",
      "app_version": "0.1.1",
    });
  }

Then use with:

  • Optional clear cache.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Your brand'),
        ),
        body: CrispView(
          crispMain: crispMain,
          clearCache: false,
        ),
      ),
    );
  }

Additional parameters

You can set a chat user token via userToken

crispMain.initialize(
  websiteId: 'WEBSITE_ID',
  locale: 'pt-br',
  userToken: '<USERTOKENHERE>',
);

You can set a verification token via verificationCode More details on User Verification

crispMain.register(
  user: CrispUser(
    email: "[email protected]",
    avatar: 'https://avatars2.githubusercontent.com/u/16270189?s=200&v=4',
    nickname: "João Cardoso",
    phone: "5511987654321",
    verificationCode: "<HMAC256CODEHERE>",
  ),
);

You can set user custom data via setSessionData more detail on Set custom data

crispMain.setSessionData({
  "order_id": "111",
  "app_version": "0.1.1",
});

flutter-crisp's People

Contributors

chodex-xyz avatar f2acode avatar hadi-neon avatar leocardoso94 avatar maavimartinez avatar makcanca avatar mrserey avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.