搜尋套件、儲存庫與 APP 分類

套件詳情v1.4.0

flutter_freshchat

一個用於在您的行動應用程式中整合 Freshchat 的 Flutter 插件。

近 30 天下載
73
喜歡數
19
Pub 分數
40

安裝套件

flutter pub add flutter_freshchat

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

一個 Flutter 插件,可實現與客戶訊息平台 Freshchat 的無縫整合。該插件允許開發者在 Flutter 應用中直接嵌入即時聊天功能,促進使用者與支援團隊之間的溝通。該插件支援 Android 和 iOS 平台,在不同裝置上提供一致的體驗。透過 pub.dev 進行最少設定,它透過應用內訊息、自動回覆和對話歷史記錄來提升使用者參與度。該插件的開源性質鼓勵社群貢獻並保持透明度。

適用情境

  • 應用內客戶支援
  • 即時用戶訊息
  • 客戶服務自動化
  • 使用者參與度追蹤
  • 支援工單整合

主要特色

  • 跨平台相容性
  • 透過 pub.dev 實現輕鬆整合
  • 即時聊天介面
  • 對話歷史支援
  • 開源程式碼庫

適合對象

  • 需要即時聊天的行動應用程式
  • 客戶支援系統
  • 使用者互動高的應用
  • 使用 Flutter 的開發者
  • 希望開源解決方案的團隊

使用建議

  • 需要設置 Freshchat 帳戶
  • 僅限 Freshchat 的功能集
  • 可能需要額外的設定以應對高級用例
  • 依賴 Freshchat 後端的穩定性

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

💬 Flutter Freshchat

A Flutter plugin for integrating Freshchat in your mobile app.

Setup

Android

Add this to your AndroidManifest.xml

<provider
    android:name="android.support.v4.content.FileProvider"
    android:authorities="com.example.demoapp.provider"
    android:exported="false"
    android:grantUriPermissions="true">
    <meta-data
        android:name="android.support.FILE_PROVIDER_PATHS"
        android:resource="@xml/freshchat_file_provider_paths" />
</provider>

If you have migrated to AndroidX your might need change the provider attribute android:name to this:

<provider android:name="androidx.core.content.FileProvider">
</provider>

Add this to your Strings.xml located inside android/src/res/values

<string name="freshchat_file_provider_authority">com.example.demoapp.provider</string>

Firebase Cloud Messaging support

  1. Add dependency in <app-name>/android/app/build.gradle
dependencies {
  implementation "com.github.freshdesk:freshchat-android:3.3.0"
}
  1. Create FreshchatMessagingService.java (Java, not Kotlin) class to your app in the same directory as your MainActivity class
package com.example.app;

import com.freshchat.consumer.sdk.Freshchat;
import com.google.firebase.messaging.RemoteMessage;
import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService;

public class FreshchatMessagingService extends FlutterFirebaseMessagingService {

    @Override
    public void onNewToken(String token) {
        super.onNewToken(token);
    }

    @Override
    public void onMessageReceived(final RemoteMessage remoteMessage) {
        super.onMessageReceived(remoteMessage);
        if (Freshchat.isFreshchatNotification(remoteMessage)) {
            Freshchat.handleFcmMessage(this, remoteMessage);
        }
    }
}
  1. In AndroidManifest.xml add
<service android:name=".FreshchatMessagingService">
  <intent-filter>
    <action android:name="com.google.firebase.MESSAGING_EVENT" />
  </intent-filter>
</service>
  1. In your Application class change
FlutterFirebaseMessagingService.setPluginRegistrant(this)

to

FreshchatMessagingService.setPluginRegistrant(this)
IOS
  1. Add this to info.plist

    Starting with iOS 10, Apple requires developers to declare access to privacy-sensitive controls ahead of time.

<key>NSPhotoLibraryUsageDescription</key>
<string>To Enable access to Photo Library</string>
<key>NSCameraUsageDescription</key>
<string>To take Images from Camera</string>
  1. If you encounter non-modular header error during project build
error: include of non-modular header inside framework module 'flutter_freshchat.FlutterFreshchatPlugin'
  • Manually in xcode update the FreshchatSDK.h to be in the flutter_freshchat target and public. FreshchatSDK_fix You may have to do this each time your switch or rebuild the xcode project from flutter.

Usage

To use this plugin, add flutter_freshchat as a dependency in your pubspec.yaml file.

import 'package:flutter_freshchat/flutter_freshchat.dart';

Initialize the Freshchat app with appID, appKey & domain which you could get from here: Where to find App ID and App Key

It has following [FreshchatConfig] properties:

  • domain Each Freshchat cluster falls in to one of this domains:

    • US - https://msdk.freshchat.com (default)
    • AU - https://msdk.au.freshchat.com
    • EU - https://msdk.eu.freshchat.com
    • IN - https://msdk.in.freshchat.com
    • US2 - https://msdk.us2.freshchat.com
  • cameraEnabled property is used to either enable or disable camera within freshchat conversation widget. It default value is set to true.

  • gallerySelectionEnabled property is used to either enable or disable gallery within freshchat conversation widget. It default value is set to true.

  • teamMemberInfoVisible property is used to show team member info within freshchat conversation widget. It default value is set to true.

  • responseExpectationEnabled property is used to show exceptions that occur within freshchat conversation widget. It default value is set to true.

  • showNotificationBanner property is used enabled or disable in-app notification banner. It default value is set to true. (NOTE: IOS only).

  • notificationSoundEnabled property is used enabled or disable in-app notification sound. It default value is set to true. (NOTE: IOS only).

await FlutterFreshchat.init(
  appID: 'YOUR_APP_ID_HERE',
  appKey: 'YOUR_APP_KEY_HERE',
  domain: 'https://msdk.freshchat.com'
  );

Update the user info by setting by creating a FreshchatUser object

FreshchatUser user = FreshchatUser.initial();
user.email = "john@test.com";
user.firstName = "john";
user.lastName = "doe";
user.phoneCountryCode = "+91";
user.phone = "0123456789";

await FlutterFreshchat.updateUserInfo(user: user);

// Custom properties can be set by creating a Map<String, String>
Map<String, String> customProperties = Map<String, String>();
customProperties["loggedIn"] = "true";

await FlutterFreshchat.updateUserInfo(user: user, customProperties: customProperties);

Identify the user user by usin email address or any way you uniquely identify the user. externalID is required and returns a restoreID you can save it and use to restore the chats

await FlutterFreshchat.identifyUser(externalID: 'USER_UNIQUE_ID', restoreID: 'USER_RESTORE_ID');

Show conversation opens a conversation screen and also list all the other conversation if a list obejct is supplied to it. You can also pass a title for the chat screen.

await FlutterFreshchat.showConversations(tags: const [], title: 'CHAT_SCREEN_TITLE');

Send message directly within the app without opening the Freshchat interface. tag is optional.

await FlutterFreshchat.send(message: 'YOUR_MESSAGE_HERE', tag: 'YOUR_TAG_HERE');

ShowFAQs opens a FAQ screen in a grid like format as default you can change the default setting by changing this paramters.
showFaqCategoriesAsGrid = true
showContactUsOnAppBar = true
showContactUsOnFaqScreens = false
showContactUsOnFaqNotHelpful = false

await FlutterFreshchat.showFAQs();

Gets the unseen message count from freshchat you can use this to show a counter.

int count = await FlutterFreshchat.getUnreadMsgCount();

Reset user data at logout or when deemed appropriate based on user action in the app.

await FlutterFreshchat.resetUser();

Example

Find the example wiring in the Flutter_Freshchat example application.

API details

See the flutter_freshchat.dart for more API details

Issues and feedback

Please file issues to send feedback or report a bug. Thank you!

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。