curl --request GET \
--url https://{appid}.api-{region}.cometchat.io/v3/users/{uid}/conversation \
--header 'apikey: <api-key>' \
--header 'onBehalfOf: <onbehalfof>'
{
"data": [
{
"conversationId": "group_project-group",
"conversationType": "group",
"unreadMessageCount": "0",
"createdAt": 1630071782,
"updatedAt": 1630481413,
"lastMessage": {
"id": "50",
"conversationId": "group_project-group",
"sender": "superhero4",
"receiverType": "group",
"receiver": "project-group",
"category": "action",
"type": "groupMember",
"data": {
"action": "unbanned",
"entities": {
"by": {
"entity": {
"uid": "superhero4",
"name": "Wolverine",
"role": "default",
"avatar": "https://data-us.cometchat.io/assets/images/avatars/wolverine.png",
"status": "offline",
"createdAt": 1629869270
},
"entityType": "user"
},
"on": {
"entity": {
"uid": "superhero3",
"link": "https://data-us.cometchat.io/assets",
"name": "Captain America",
"role": "default",
"avatar": "https://data-us.cometchat.io/assets/images/avatars/captainamerica.png",
"status": "offline",
"createdAt": 1629869270,
"updatedAt": 1629964825,
"conversationId": "superhero3_user_superhero4"
},
"entityType": "user"
},
"for": {
"entity": {
"guid": "project-group",
"icon": "http://placehold.it/120x120&text=image1",
"name": "Project Group1",
"type": "private",
"owner": "superhero4",
"createdAt": 1630071341,
"updatedAt": 1630305525,
"updatedBy": "superhero4",
"description": "project related discussions between members",
"membersCount": 4,
"conversationId": "group_project-group"
},
"entityType": "group"
}
}
},
"sentAt": 1630305562,
"updatedAt": 1630305562
},
"conversationWith": {
"guid": "project-group",
"name": "Project Group1",
"description": "project related discussions between members",
"icon": "http://placehold.it/120x120&text=image1",
"type": "private",
"scope": "participant",
"membersCount": 4,
"joinedAt": 1630071782,
"conversationId": "group_project-group",
"hasJoined": true,
"createdAt": 1630071341,
"owner": "superhero4",
"updatedAt": 1630308875,
"updatedBy": "superhero4"
}
}
]
}
Getting user conversation
curl --request GET \
--url https://{appid}.api-{region}.cometchat.io/v3/users/{uid}/conversation \
--header 'apikey: <api-key>' \
--header 'onBehalfOf: <onbehalfof>'
{
"data": [
{
"conversationId": "group_project-group",
"conversationType": "group",
"unreadMessageCount": "0",
"createdAt": 1630071782,
"updatedAt": 1630481413,
"lastMessage": {
"id": "50",
"conversationId": "group_project-group",
"sender": "superhero4",
"receiverType": "group",
"receiver": "project-group",
"category": "action",
"type": "groupMember",
"data": {
"action": "unbanned",
"entities": {
"by": {
"entity": {
"uid": "superhero4",
"name": "Wolverine",
"role": "default",
"avatar": "https://data-us.cometchat.io/assets/images/avatars/wolverine.png",
"status": "offline",
"createdAt": 1629869270
},
"entityType": "user"
},
"on": {
"entity": {
"uid": "superhero3",
"link": "https://data-us.cometchat.io/assets",
"name": "Captain America",
"role": "default",
"avatar": "https://data-us.cometchat.io/assets/images/avatars/captainamerica.png",
"status": "offline",
"createdAt": 1629869270,
"updatedAt": 1629964825,
"conversationId": "superhero3_user_superhero4"
},
"entityType": "user"
},
"for": {
"entity": {
"guid": "project-group",
"icon": "http://placehold.it/120x120&text=image1",
"name": "Project Group1",
"type": "private",
"owner": "superhero4",
"createdAt": 1630071341,
"updatedAt": 1630305525,
"updatedBy": "superhero4",
"description": "project related discussions between members",
"membersCount": 4,
"conversationId": "group_project-group"
},
"entityType": "group"
}
}
},
"sentAt": 1630305562,
"updatedAt": 1630305562
},
"conversationWith": {
"guid": "project-group",
"name": "Project Group1",
"description": "project related discussions between members",
"icon": "http://placehold.it/120x120&text=image1",
"type": "private",
"scope": "participant",
"membersCount": 4,
"joinedAt": 1630071782,
"conversationId": "group_project-group",
"hasJoined": true,
"createdAt": 1630071341,
"owner": "superhero4",
"updatedAt": 1630308875,
"updatedBy": "superhero4"
}
}
]
}
API Key with fullAccess scope(i.e. Rest API Key from the Dashboard).
UID of the user on whose behalf the action is performed.
UID of the user whose conversation needs to be fetched.
Get user Conversations
The response is of type object
.
Was this page helpful?