crisp_sdk 1.1.0 copy "crisp_sdk: ^1.1.0" to clipboard
crisp_sdk: ^1.1.0 copied to clipboard

Crisp SDK for user can use Crisp chat in their flutter app.

Crisp SDK Dart Package #

This package provides a Dart interface for the Crisp chat SDK.

Features #

  • Set user details such as email, nickname, avatar, and phone number.
  • Register a new user to start the chat.
  • Set a message text.
  • Set user segments.
  • Set session data.
  • Get session id.
  • Logout.

Usage #

First, import the package:

import 'package:crisp_sdk/models/user.dart';

Then, create a CrispController

CrispController controller = CrispController(
  websiteId: 'your_website_id',
  locale: 'en',
);
  @override
Widget build(BuildContext context) {
  return CrispView(
    crispController: controller,
    clearCache: true,
    onSessionIdReceived: (sessionId) {
      print('------------- sessionIdCrisp  --------------');
      print(sessionId);
    },
  );
}
}

You can set user details using the register method:

controller.register(
  user: CrispUser(
    email: 'user_email',
    nickname: 'user_nickname',
    avatar: 'user_avatar_url',
    phone: 'user_phone_number',
  ),
);

You can set a message text using the setMessage method:

controller.setMessage('Hello, world!');

You can set user segments using the setSegments method:

controller.setSegments(['segment1', 'segment2']);

You can set session data using the setData method:

controller.setData({'key1': 'value1', 'key2': 'value2'});

You can get session id using the getSessionId method:

controller.getSessionId();

You can logout using the logout method:

controller.logout();

Contributing Contributions are welcome! Please read our contributing guidelines to get started.

License This project is licensed under the terms of the MIT license. See the LICENSE file for details.

2
likes
150
pub points
56%
popularity

Publisher

verified publisheramirjabbari.me

Crisp SDK for user can use Crisp chat in their flutter app.

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

flutter, flutter_inappwebview, url_launcher

More

Packages that depend on crisp_sdk