Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/chyiiiiiiiiiiii/flutter_zendesk_messaging

Zendesk-Messaging for Flutter developer
https://github.com/chyiiiiiiiiiiii/flutter_zendesk_messaging

android chat customer-service dart flutter ios messaging zendesk

Last synced: 1 day ago
JSON representation

Zendesk-Messaging for Flutter developer

Awesome Lists containing this project

README

        

# Zendesk Messaging

> [!NOTE]
> Very welcome every developer to contribute to this package of Zendesk. Now I have no much time to maintain regularly🥸

Pub

![](Messaging.png)

**Messaging** is a "user-based" chat

**Live Chat** is a "session-based" chat

- **Better UI (Native)**
- **Chat history**
- **Answer Bot**

-------------------

## Setup
### 1. Enable agent work-space
![](screenshot/screenshot_1.png)
### 2. Enable Messaging
![](screenshot/screenshot_2.png)
###
![](screenshot/screenshot_3.png)
### 3. Add channel and get key
![](screenshot/screenshot_4.png)
###
![](screenshot/screenshot_5.png)

## How to use?
### Initialize
``` dart
final String androidChannelKey = '';
final String iosChannelKey = '';

@override
void initState() {
super.initState();
ZendeskMessaging.initialize(
androidChannelKey: androidChannelKey,
iosChannelKey: iosChannelKey,
);
}
```
> just use initialize() one time

### Invalidate (optional)
``` dart
@override
void dispose() {
ZendeskMessaging.invalidate();
super.dispose();
}
/// Invalidates the current instance of ZendeskMessaging.
```
After calling this method you will have to call ZendeskMessaging.initialize again if you would like to use ZendeskMessaging.

This can be useful if you need to initiate a chat with another set of `androidChannelKey` and `iosChannelKey`

### Show
```dart
ZendeskMessaging.show();
```
> You can use in onTap()

### Authenticate (optional)

The SDK needs to be initialized before using authentication methods !

```dart
final ZendeskLoginResponse result = await ZendeskMessaging.loginUser(jwt: "YOUR_JWT");
await ZendeskMessaging.logoutUser();
```
### Check authentication state (optional)

This method can be used to check wheter the user is alreday logged in!

```dart
await ZendeskMessaging.loginUser(jwt: "YOUR_JWT");
final bool isLoggedIn = await ZendeskMessaging.isLoggedIn();
// After the user is logged in [isLoggedIn] is true
await ZendeskMessaging.logoutUser();
final bool userStillLoggedIn = await ZendeskMessaging.isLoggedIn();
// After you call the logout method [ZendeskMessaging.isLoggedIn()] will return [false]

```
### Retrieve the unread message count (optional)

There's must be a logged user to allow the recovery of the unread message count!

```dart
// Retrieve the unread message count
final int count = await ZendeskMessaging.getUnreadMessageCount()();

// if there's no user logged in, the message count will always be zero.
```
### Set tags to a support ticket (optional)

Allows custom conversation tags to be set, adding contextual data about the conversation.

```dart
// Add tags to a conversation
await ZendeskMessaging.setConversationTags(['tag1', 'tag2', 'tag3']);

// Note: Conversation tags are not immediately associated with a conversation when this method is called.
// It will only be applied to a conversation when end users either start a new conversation or send a new message in an existing conversation.
```
### Clear conversation tags (optional)

Allows custom conversation tags to be set, adding contextual data about the conversation.

```dart
// Allows you to clear conversation tags from native SDK storage when the client side context changes.
// This removes all stored conversation tags from the natice SDK storage.
await ZendeskMessaging.clearConversationTags();

// Note: This method does not affect conversation tags already applied to the conversation.
```

## Known shortcomings
- **Attachment file**:`Currently does not support.` The official said it will be launched in the future.

- **Chat room closed**:An agent can not reply to a customer at any time.
if the customer is not active in the foreground, the room will be closed automatically. It is inconvenient to track chat history.

- **Android Permission**:
if you meet the problem like below:
```
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processXXXDebugMainManifest'.
> Manifest merger failed : Attribute uses-permission#android.permission.WRITE_EXTERNAL_STORAGE@maxSdkVersion value=(28) from [:camera_android_camerax] AndroidManifest.xml:14:9-35
is also present at [zendesk.messaging:messaging-android:2.26.0] AndroidManifest.xml:29:9-35 value=(22).
Suggestion: add 'tools:replace="android:maxSdkVersion"' to element at AndroidManifest.xml to override.
```
Please add following code in `AndroidManifest.xml`
```xml

```

## Future Function

- Push Notifications

## Link
- [Zendesk messaging Help](https://support.zendesk.com/hc/en-us/sections/360011686513-Zendesk-messaging)
- [Agent Workspace for messaging](https://support.zendesk.com/hc/en-us/articles/360055902354-Agent-Workspace-for-messaging)
- [Working with messaging in your Android and iOS SDKs](https://support.zendesk.com/hc/en-us/articles/1260801714930-Working-with-messaging-in-your-Android-and-iOS-SDKs)

## Contribute
- You can star and share with other developers if you feel good and learn something from this repository.
- If you have some ideas, please discuss them with us or commit PR.