Quick Reference for AI Agents & Developers
- Requires: CometChat SDK and UI Kit both configured
- Implementation: Handle notification tap in
AppDelegateorSceneDelegate - Parse payload: Extract sender UID or group GUID from notification payload
- Launch: Present
CometChatMessagesview controller with user/group - Related: Receive Message · Push Notifications · UI Kit

Step 1. Process push notification payload and grab User or Group object
To present a chat window, firstly you will need a User or a Group object. You can grab this from the push notification payload itself of incoming message notification. You need to call CometChat.processMessage() method to process push notification payload.
- Swift
Sample Payload - User Message Push Notification
Sample Payload - User Message Push Notification
userInfo Dictionary Structure (User Message):
message Dictionary:
sender Dictionary:
aps Dictionary:
alert Dictionary:
Sample Payload - Group Message Push Notification
Sample Payload - Group Message Push Notification
userInfo Dictionary Structure (Group Message):
message Dictionary:
sender Dictionary:
receiver Dictionary (Group):
aps Dictionary:
alert Dictionary:
Sample Payload - CometChat.processMessage() Output
Sample Payload - CometChat.processMessage() Output
Method Signature:
Return Tuple Structure:
TextMessage Object Properties (when type is “text”):
sender User Object:
receiver Object (User or Group):When receiverType is
.user:When receiverType is
.group:MessageCategory Enum Values:
ReceiverType Enum Values:
Step 2. Launch Chat Window
You can launch the chat window from your base view controller after you tap on the Message Notification. This method uses NotificationCenter to trigger and present a chat window.- In this method you need to fire notification after you receive the
UserorGroupObject. - In Notification’s user info you can pass
UserorGroupObject to that desired notification.
Trigger notification from App Delegate
- Swift
Sample Payload - NotificationCenter POST (User Message)
Sample Payload - NotificationCenter POST (User Message)
NotificationCenter.default.post() Method Parameters:
userInfo Dictionary Structure:
User Object Properties:
UserStatus Enum Values:
Notification Dispatch Flow:
Sample Payload - NotificationCenter POST (Group Message)
Sample Payload - NotificationCenter POST (Group Message)
NotificationCenter.default.post() Method Parameters:
userInfo Dictionary Structure:
Group Object Properties:
GroupType Enum Values:
MemberScope Enum Values:
Notification Dispatch Flow:
- On the other hand, you need to observe for the above notification in your base view controller.
Observe notification in Base View Controller
- Swift
Add selector method & Launch Chat Window
- Swift
Sample Payload - didReceivedMessageFromGroup Notification
Sample Payload - didReceivedMessageFromGroup Notification
NSNotification Object Structure:
userInfo Dictionary:
Group Object Properties:
CometChatMessageList Configuration:
set(conversationWith:type:) Parameters:
Selector Method Flow:
Sample Payload - didReceivedMessageFromUser Notification
Sample Payload - didReceivedMessageFromUser Notification
NSNotification Object Structure:
userInfo Dictionary:
User Object Properties:
CometChatMessageList Configuration:
set(conversationWith:type:) Parameters:
Selector Method Flow: