curl --request PUT \
--url https://{appid}.api-{region}.cometchat.io/v3/moderation/messages/{id} \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"data": {
"text": "This message has been updated."
}
}
'{
"data": {
"id": "1",
"conversationId": "cometchat-uid-1_user_cometchat-uid-2",
"sender": "cometchat-uid-2",
"receiverType": "user",
"receiver": "cometchat-uid-1",
"category": "message",
"type": "text",
"data": {
"text": "heyaya, I'm updated",
"entities": {
"receiver": {
"entity": {
"avatar": "https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-1.webp",
"createdAt": 1751644824,
"lastActiveAt": 1751644824,
"name": "Andrew Joseph",
"role": "default",
"status": "offline",
"uid": "cometchat-uid-1"
},
"entityType": "user"
},
"sender": {
"entity": {
"avatar": "https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-2.webp",
"conversationId": "cometchat-uid-1_user_cometchat-uid-2",
"createdAt": 1751644824,
"lastActiveAt": 1751644824,
"name": "George Alan",
"role": "default",
"status": "offline",
"uid": "cometchat-uid-2"
},
"entityType": "user"
}
},
"moderation": {
"status": "approved"
}
},
"sentAt": 1750335220,
"editedAt": 1751645607,
"editedBy": "cometchat-uid-1",
"updatedAt": 1751644906
}
}This endpoint is responsible for editing the message, The moderation status is recalculated based on the app’s configured rules for the edited message.
curl --request PUT \
--url https://{appid}.api-{region}.cometchat.io/v3/moderation/messages/{id} \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"data": {
"text": "This message has been updated."
}
}
'{
"data": {
"id": "1",
"conversationId": "cometchat-uid-1_user_cometchat-uid-2",
"sender": "cometchat-uid-2",
"receiverType": "user",
"receiver": "cometchat-uid-1",
"category": "message",
"type": "text",
"data": {
"text": "heyaya, I'm updated",
"entities": {
"receiver": {
"entity": {
"avatar": "https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-1.webp",
"createdAt": 1751644824,
"lastActiveAt": 1751644824,
"name": "Andrew Joseph",
"role": "default",
"status": "offline",
"uid": "cometchat-uid-1"
},
"entityType": "user"
},
"sender": {
"entity": {
"avatar": "https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-2.webp",
"conversationId": "cometchat-uid-1_user_cometchat-uid-2",
"createdAt": 1751644824,
"lastActiveAt": 1751644824,
"name": "George Alan",
"role": "default",
"status": "offline",
"uid": "cometchat-uid-2"
},
"entityType": "user"
}
},
"moderation": {
"status": "approved"
}
},
"sentAt": 1750335220,
"editedAt": 1751645607,
"editedBy": "cometchat-uid-1",
"updatedAt": 1751644906
}
}API Key with fullAccess scope(i.e. Rest API Key from the Dashboard).
Id of the message whose details are to be fetched.
Can contain any additional properties except for the key properties.
Show child attributes
The meaning of the data.text property depends on the values of category and type:
category is 'message' and type is 'text', it represents the text content of the message.category is 'message' and type is not 'text', it represents the caption associated with the attachment.when category==”custom”, this property can have any JSON object.
For the messages with image, video, audio or file type (i.e. category=="message" && type !="text"), the property contains an array of attachment objects.
Show child attributes
Contains the URL of the attachment. The developer has to make sure that the URL is accessible while calling the API. The API will be downloading the attachment from its current location and upload it to CometChat’s attachment storage.
Name of the attachment.
Mime Type of attachment.
The extension of the attachment.
The size of the attachment(in bytes).
Update Message(s)
The response is of type object.
Was this page helpful?