AI Integration Quick Reference
AI Integration Quick Reference
CometChatNotifications, NotificationPreferences, MutedConversation, PushPlatformsCometChatNotifications class provides methods to manage push notification preferences, register/unregister push tokens, mute/unmute conversations, and manage timezone settings.
Register Push Token
Register a push notification token with CometChat for the current user. The token type depends on your platform and push provider.| Parameter | Type | Description |
|---|---|---|
pushPlatforms | PushPlatforms | The push platform to register for (required) |
fcmToken | String? | FCM token (required for FCM_FLUTTER_ANDROID and FCM_FLUTTER_IOS) |
deviceToken | String? | APNs device token (required for APNS_FLUTTER_DEVICE) |
voipToken | String? | APNs VoIP token (required for APNS_FLUTTER_VOIP) |
providerId | String? | Optional provider ID |
onSuccess | Function(String)? | Called with success response |
onError | Function(CometChatException)? | Called on error |
PushPlatforms Enum
| Value | Description |
|---|---|
FCM_FLUTTER_ANDROID | Firebase Cloud Messaging on Android |
FCM_FLUTTER_IOS | Firebase Cloud Messaging on iOS |
APNS_FLUTTER_DEVICE | Apple Push Notification service (device) |
APNS_FLUTTER_VOIP | Apple Push Notification service (VoIP) |
Unregister Push Token
Remove the push notification token for the current user.Notification Preferences
Fetch Preferences
Retrieve the current notification preferences for the logged-in user.Update Preferences
Update notification preferences for the logged-in user.Reset Preferences
Reset notification preferences to their default values.Mute & Unmute Conversations
Get Muted Conversations
Retrieve all conversations muted by the logged-in user.Mute Conversations
Mute one or more conversations.Unmute Conversations
Unmute one or more conversations.Timezone
Update Timezone
Update the timezone preference for the logged-in user. This affects DND schedule evaluation.Get Timezone
Retrieve the current timezone preference.Models Reference
NotificationPreferences
| Property | Type | Description |
|---|---|---|
usePrivacyTemplate | bool? | Whether to use privacy templates for notifications |
oneOnOnePreferences | OneOnOnePreferences? | Preferences for 1:1 conversations |
groupPreferences | GroupPreferences? | Preferences for group conversations |
mutePreferences | MutePreferences? | Do Not Disturb and schedule settings |
OneOnOnePreferences
| Property | Type | Description |
|---|---|---|
messages | MessagesOptions? | Notification preference for messages |
replies | RepliesOptions? | Notification preference for replies |
reactions | ReactionsOptions? | Notification preference for reactions |
GroupPreferences
| Property | Type | Description |
|---|---|---|
messages | MessagesOptions? | Notification preference for group messages |
replies | RepliesOptions? | Notification preference for group replies |
reactions | ReactionsOptions? | Notification preference for group reactions |
memberJoined | MemberActionsOptions? | Notify when a member joins |
memberLeft | MemberActionsOptions? | Notify when a member leaves |
memberAdded | MemberActionsOptions? | Notify when a member is added |
memberKicked | MemberActionsOptions? | Notify when a member is kicked |
memberBanned | MemberActionsOptions? | Notify when a member is banned |
memberUnbanned | MemberActionsOptions? | Notify when a member is unbanned |
memberScopeChanged | MemberActionsOptions? | Notify when a member’s scope changes |
MutePreferences
| Property | Type | Description |
|---|---|---|
dnd | DNDOptions? | Do Not Disturb mode |
schedule | Map<DayOfWeek, DaySchedule>? | Per-day mute schedule |
DaySchedule
| Property | Type | Description |
|---|---|---|
from | int? | Start hour (0–23) |
to | int? | End hour (0–23) |
dnd | bool? | Whether DND is active for this day |
MutedConversation
| Property | Type | Description |
|---|---|---|
id | String? | UID (for 1:1) or GUID (for group) |
type | MutedConversationType? | Conversation type |
until | num? | Unix timestamp when mute expires (null = indefinite) |
UnmutedConversation
| Property | Type | Description |
|---|---|---|
id | String? | UID (for 1:1) or GUID (for group) |
type | MutedConversationType? | Conversation type |
Enums Reference
MessagesOptions
| Value | Int | Description |
|---|---|---|
DONT_SUBSCRIBE | 1 | Don’t receive message notifications |
SUBSCRIBE_TO_ALL | 2 | Receive notifications for all messages |
SUBSCRIBE_TO_MENTIONS | 3 | Only receive notifications for messages that mention you |
RepliesOptions
| Value | Int | Description |
|---|---|---|
DONT_SUBSCRIBE | 1 | Don’t receive reply notifications |
SUBSCRIBE_TO_ALL | 2 | Receive notifications for all replies |
SUBSCRIBE_TO_MENTIONS | 3 | Only receive notifications for replies that mention you |
ReactionsOptions
| Value | Int | Description |
|---|---|---|
DONT_SUBSCRIBE | 1 | Don’t receive reaction notifications |
SUBSCRIBE_TO_REACTIONS_ON_OWN_MESSAGES | 2 | Receive notifications for reactions on your messages |
SUBSCRIBE_TO_REACTIONS_ON_ALL_MESSAGES | 3 | Receive notifications for reactions on all messages |
MemberActionsOptions
| Value | Int | Description |
|---|---|---|
DONT_SUBSCRIBE | 1 | Don’t receive member action notifications |
SUBSCRIBE | 2 | Receive member action notifications |
DNDOptions
| Value | Int | Description |
|---|---|---|
DISABLED | 1 | Do Not Disturb is disabled |
ENABLED | 2 | Do Not Disturb is enabled |
MutedConversationType
| Value | String | Description |
|---|---|---|
ONE_ON_ONE | "oneOnOne" | 1:1 conversation |
GROUP | "group" | Group conversation |
DayOfWeek
| Value | String |
|---|---|
MONDAY | "monday" |
TUESDAY | "tuesday" |
WEDNESDAY | "wednesday" |
THURSDAY | "thursday" |
FRIDAY | "friday" |
SATURDAY | "saturday" |
SUNDAY | "sunday" |
Next Steps
Setup SDK
Installation and initialization guide
Connection Status
Monitor SDK connection state changes
Best Practices
Recommended patterns and practices
Error Codes
Complete SDK error code reference