curl --request POST \
--url https://{appid}.api-{region}.cometchat.io/v3/messages/{id}/thread \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--header 'onBehalfOf: <onbehalfof>' \
--data '{
"receiver": "<string>",
"receiverType": "user",
"category": "message",
"type": "text",
"data": {
"text": "Hi Tom!",
"metadata": {
"key1": "value1",
"key2": "value2"
}
},
"multipleReceivers": {
"uids": [
"uid1",
"uid2"
],
"guids": [
"guid1"
]
},
"tags": [
"tag1"
]
}'
{
"data": {
"id": "2",
"conversationId": "superhero3_user_superhero5",
"sender": "superhero3",
"receiverType": "user",
"receiver": "superhero5",
"category": "message",
"type": "text",
"data": {
"text": "test hello",
"metadata": {
"key1": "val1"
},
"entities": {
"sender": {
"entity": {
"uid": "superhero3",
"name": "Spiderman",
"avatar": "https://data-us.cometchat.io/assets/images/avatars/spiderman.png",
"status": "offline",
"role": "default",
"createdAt": 1638361550
},
"entityType": "user"
},
"receiver": {
"entity": {
"uid": "superhero5",
"name": "Cyclops",
"avatar": "https://data-us.cometchat.io/assets/images/avatars/cyclops.png",
"status": "offline",
"role": "default",
"createdAt": 1638361550,
"conversationId": "superhero3_user_superhero5"
},
"entityType": "user"
}
}
},
"sentAt": 1638423490,
"updatedAt": 1638423490,
"parentId": "1"
}
}
Sends Threaded Message on behalf of a user.
curl --request POST \
--url https://{appid}.api-{region}.cometchat.io/v3/messages/{id}/thread \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--header 'onBehalfOf: <onbehalfof>' \
--data '{
"receiver": "<string>",
"receiverType": "user",
"category": "message",
"type": "text",
"data": {
"text": "Hi Tom!",
"metadata": {
"key1": "value1",
"key2": "value2"
}
},
"multipleReceivers": {
"uids": [
"uid1",
"uid2"
],
"guids": [
"guid1"
]
},
"tags": [
"tag1"
]
}'
{
"data": {
"id": "2",
"conversationId": "superhero3_user_superhero5",
"sender": "superhero3",
"receiverType": "user",
"receiver": "superhero5",
"category": "message",
"type": "text",
"data": {
"text": "test hello",
"metadata": {
"key1": "val1"
},
"entities": {
"sender": {
"entity": {
"uid": "superhero3",
"name": "Spiderman",
"avatar": "https://data-us.cometchat.io/assets/images/avatars/spiderman.png",
"status": "offline",
"role": "default",
"createdAt": 1638361550
},
"entityType": "user"
},
"receiver": {
"entity": {
"uid": "superhero5",
"name": "Cyclops",
"avatar": "https://data-us.cometchat.io/assets/images/avatars/cyclops.png",
"status": "offline",
"role": "default",
"createdAt": 1638361550,
"conversationId": "superhero3_user_superhero5"
},
"entityType": "user"
}
}
},
"sentAt": 1638423490,
"updatedAt": 1638423490,
"parentId": "1"
}
}
API Key with fullAccess scope(i.e. Rest API Key from the Dashboard).
UID of the user on whose behalf the action is performed.
Id of the message for which thread message to be sent
Create Message
The response is of type object
.
Was this page helpful?