Update a message
curl --request PUT \
--url https://apix.us.amity.co/api/v5/messages/{messageId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"data": {
"text": "test"
},
"metadata": {
"refId": "d601c27c0675baa2103ec573"
},
"tags": [
"tag1",
"tag2"
],
"mentionedUsers": [
{
"type": "user",
"userIds": [
"3cac302ab992aa17b215ba21",
"adb34ec2aeedca03a38e1d54"
]
}
]
}
'import requests
url = "https://apix.us.amity.co/api/v5/messages/{messageId}"
payload = {
"data": { "text": "test" },
"metadata": { "refId": "d601c27c0675baa2103ec573" },
"tags": ["tag1", "tag2"],
"mentionedUsers": [
{
"type": "user",
"userIds": ["3cac302ab992aa17b215ba21", "adb34ec2aeedca03a38e1d54"]
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
data: {text: 'test'},
metadata: {refId: 'd601c27c0675baa2103ec573'},
tags: ['tag1', 'tag2'],
mentionedUsers: [
{
type: 'user',
userIds: ['3cac302ab992aa17b215ba21', 'adb34ec2aeedca03a38e1d54']
}
]
})
};
fetch('https://apix.us.amity.co/api/v5/messages/{messageId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://apix.us.amity.co/api/v5/messages/{messageId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
'text' => 'test'
],
'metadata' => [
'refId' => 'd601c27c0675baa2103ec573'
],
'tags' => [
'tag1',
'tag2'
],
'mentionedUsers' => [
[
'type' => 'user',
'userIds' => [
'3cac302ab992aa17b215ba21',
'adb34ec2aeedca03a38e1d54'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://apix.us.amity.co/api/v5/messages/{messageId}"
payload := strings.NewReader("{\n \"data\": {\n \"text\": \"test\"\n },\n \"metadata\": {\n \"refId\": \"d601c27c0675baa2103ec573\"\n },\n \"tags\": [\n \"tag1\",\n \"tag2\"\n ],\n \"mentionedUsers\": [\n {\n \"type\": \"user\",\n \"userIds\": [\n \"3cac302ab992aa17b215ba21\",\n \"adb34ec2aeedca03a38e1d54\"\n ]\n }\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://apix.us.amity.co/api/v5/messages/{messageId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"data\": {\n \"text\": \"test\"\n },\n \"metadata\": {\n \"refId\": \"d601c27c0675baa2103ec573\"\n },\n \"tags\": [\n \"tag1\",\n \"tag2\"\n ],\n \"mentionedUsers\": [\n {\n \"type\": \"user\",\n \"userIds\": [\n \"3cac302ab992aa17b215ba21\",\n \"adb34ec2aeedca03a38e1d54\"\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apix.us.amity.co/api/v5/messages/{messageId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"data\": {\n \"text\": \"test\"\n },\n \"metadata\": {\n \"refId\": \"d601c27c0675baa2103ec573\"\n },\n \"tags\": [\n \"tag1\",\n \"tag2\"\n ],\n \"mentionedUsers\": [\n {\n \"type\": \"user\",\n \"userIds\": [\n \"3cac302ab992aa17b215ba21\",\n \"adb34ec2aeedca03a38e1d54\"\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"messages": [
{
"messageId": "a85dca058f5b585f86a29f14",
"networkId": "9530b11ec8de87db22b06b27",
"channelId": "abc665aed9dbb8d036037eed",
"channelType": "community",
"messageFeedId": "507f191e810c19729de860ea",
"segment": 123,
"dataType": "text",
"data": {
"text": "test"
},
"fileId": "76bfe68974157a114053364d",
"thumbnailFileId": "76bfe68974157a114053364e",
"metadata": {
"refId": "d601c27c0675baa2103ec573"
},
"tags": [
"tag1",
"tag2"
],
"creatorId": "5349b4ddd2781d08c09890f4",
"mentionedUsers": [
{
"type": "user",
"userIds": [
"3cac302ab992aa17b215ba21",
"adb34ec2aeedca03a38e1d54"
]
}
],
"reactions": {
"like": 1,
"love": 2
},
"reactionCount": 123,
"parentId": "abc665afd7dbb8d036037eea",
"path": "12cba9779cc479e1fcefd1de/chat/f00ab16cbd27d4a9525aea6d/32b468ae0b1bd0cc7976719d/0a003482f0ac53a71e7c9239",
"flagCount": 123,
"childCount": 123,
"isDeleted": false,
"editedAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"myReactions": [
"like",
"love"
]
}
],
"messageFeeds": [
{
"messageFeedId": "a85dca058f5b585f86a29f14",
"channelId": "abc665aed9dbb8d036037eeb",
"channelPublicId": "abc665aed9dbb8d036037eeb",
"channelType": "community",
"name": "text",
"creatorId": "8aa313c8dbb00af911b07672",
"path": "12cba9779cc479e1fcefd1de/chat/f00ab16cbd27d4a9525aea6d/32b468ae0b1bd0cc7976719d/0a003482f0ac53a71e7c9239",
"childCount": 123,
"isDeleted": false,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"lastMessageId": "9530b11ec8de87db22b06b21",
"lastMessageTimestamp": "2023-11-07T05:31:56Z",
"editedAt": "2023-11-07T05:31:56Z",
"messagePreviewId": "<string>"
}
],
"files": [
{
"fileId": "<string>",
"fileUrl": "<string>",
"accessType": "public",
"altText": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"attributes": {
"name": "<string>",
"extension": "<string>",
"size": 123,
"mimeType": "<string>",
"metadata": {
"exif": {},
"gps": {},
"height": 123,
"width": 123,
"isFull": true
}
}
}
],
"users": [
{
"userId": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"_id": "<string>",
"path": "<string>",
"roles": [
"<string>"
],
"displayName": "<string>",
"flagCount": 123,
"hashFlag": {
"bits": 123,
"hashes": 123,
"hash": [
"<string>"
]
},
"metadata": {},
"isDeleted": true
}
]
}Message
Update a message
Update a message
PUT
/
api
/
v5
/
messages
/
{messageId}
Update a message
curl --request PUT \
--url https://apix.us.amity.co/api/v5/messages/{messageId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"data": {
"text": "test"
},
"metadata": {
"refId": "d601c27c0675baa2103ec573"
},
"tags": [
"tag1",
"tag2"
],
"mentionedUsers": [
{
"type": "user",
"userIds": [
"3cac302ab992aa17b215ba21",
"adb34ec2aeedca03a38e1d54"
]
}
]
}
'import requests
url = "https://apix.us.amity.co/api/v5/messages/{messageId}"
payload = {
"data": { "text": "test" },
"metadata": { "refId": "d601c27c0675baa2103ec573" },
"tags": ["tag1", "tag2"],
"mentionedUsers": [
{
"type": "user",
"userIds": ["3cac302ab992aa17b215ba21", "adb34ec2aeedca03a38e1d54"]
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
data: {text: 'test'},
metadata: {refId: 'd601c27c0675baa2103ec573'},
tags: ['tag1', 'tag2'],
mentionedUsers: [
{
type: 'user',
userIds: ['3cac302ab992aa17b215ba21', 'adb34ec2aeedca03a38e1d54']
}
]
})
};
fetch('https://apix.us.amity.co/api/v5/messages/{messageId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://apix.us.amity.co/api/v5/messages/{messageId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
'text' => 'test'
],
'metadata' => [
'refId' => 'd601c27c0675baa2103ec573'
],
'tags' => [
'tag1',
'tag2'
],
'mentionedUsers' => [
[
'type' => 'user',
'userIds' => [
'3cac302ab992aa17b215ba21',
'adb34ec2aeedca03a38e1d54'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://apix.us.amity.co/api/v5/messages/{messageId}"
payload := strings.NewReader("{\n \"data\": {\n \"text\": \"test\"\n },\n \"metadata\": {\n \"refId\": \"d601c27c0675baa2103ec573\"\n },\n \"tags\": [\n \"tag1\",\n \"tag2\"\n ],\n \"mentionedUsers\": [\n {\n \"type\": \"user\",\n \"userIds\": [\n \"3cac302ab992aa17b215ba21\",\n \"adb34ec2aeedca03a38e1d54\"\n ]\n }\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://apix.us.amity.co/api/v5/messages/{messageId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"data\": {\n \"text\": \"test\"\n },\n \"metadata\": {\n \"refId\": \"d601c27c0675baa2103ec573\"\n },\n \"tags\": [\n \"tag1\",\n \"tag2\"\n ],\n \"mentionedUsers\": [\n {\n \"type\": \"user\",\n \"userIds\": [\n \"3cac302ab992aa17b215ba21\",\n \"adb34ec2aeedca03a38e1d54\"\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apix.us.amity.co/api/v5/messages/{messageId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"data\": {\n \"text\": \"test\"\n },\n \"metadata\": {\n \"refId\": \"d601c27c0675baa2103ec573\"\n },\n \"tags\": [\n \"tag1\",\n \"tag2\"\n ],\n \"mentionedUsers\": [\n {\n \"type\": \"user\",\n \"userIds\": [\n \"3cac302ab992aa17b215ba21\",\n \"adb34ec2aeedca03a38e1d54\"\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"messages": [
{
"messageId": "a85dca058f5b585f86a29f14",
"networkId": "9530b11ec8de87db22b06b27",
"channelId": "abc665aed9dbb8d036037eed",
"channelType": "community",
"messageFeedId": "507f191e810c19729de860ea",
"segment": 123,
"dataType": "text",
"data": {
"text": "test"
},
"fileId": "76bfe68974157a114053364d",
"thumbnailFileId": "76bfe68974157a114053364e",
"metadata": {
"refId": "d601c27c0675baa2103ec573"
},
"tags": [
"tag1",
"tag2"
],
"creatorId": "5349b4ddd2781d08c09890f4",
"mentionedUsers": [
{
"type": "user",
"userIds": [
"3cac302ab992aa17b215ba21",
"adb34ec2aeedca03a38e1d54"
]
}
],
"reactions": {
"like": 1,
"love": 2
},
"reactionCount": 123,
"parentId": "abc665afd7dbb8d036037eea",
"path": "12cba9779cc479e1fcefd1de/chat/f00ab16cbd27d4a9525aea6d/32b468ae0b1bd0cc7976719d/0a003482f0ac53a71e7c9239",
"flagCount": 123,
"childCount": 123,
"isDeleted": false,
"editedAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"myReactions": [
"like",
"love"
]
}
],
"messageFeeds": [
{
"messageFeedId": "a85dca058f5b585f86a29f14",
"channelId": "abc665aed9dbb8d036037eeb",
"channelPublicId": "abc665aed9dbb8d036037eeb",
"channelType": "community",
"name": "text",
"creatorId": "8aa313c8dbb00af911b07672",
"path": "12cba9779cc479e1fcefd1de/chat/f00ab16cbd27d4a9525aea6d/32b468ae0b1bd0cc7976719d/0a003482f0ac53a71e7c9239",
"childCount": 123,
"isDeleted": false,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"lastMessageId": "9530b11ec8de87db22b06b21",
"lastMessageTimestamp": "2023-11-07T05:31:56Z",
"editedAt": "2023-11-07T05:31:56Z",
"messagePreviewId": "<string>"
}
],
"files": [
{
"fileId": "<string>",
"fileUrl": "<string>",
"accessType": "public",
"altText": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"attributes": {
"name": "<string>",
"extension": "<string>",
"size": 123,
"mimeType": "<string>",
"metadata": {
"exif": {},
"gps": {},
"height": 123,
"width": 123,
"isFull": true
}
}
}
],
"users": [
{
"userId": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"_id": "<string>",
"path": "<string>",
"roles": [
"<string>"
],
"displayName": "<string>",
"flagCount": 123,
"hashFlag": {
"bits": 123,
"hashes": 123,
"hash": [
"<string>"
]
},
"metadata": {},
"isDeleted": true
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
ID of a message A message ID
Maximum string length:
30Example:
"a85dca058f5b585f86a29f14"
Body
application/json
Message object that needs to be updated
A custom object for storing message. The size of this object must be less than 10 kb.
Example:
{ "text": "test" }
A custom object for storing the other data. The size of this object must be less than 20 kb.
Example:
{ "refId": "d601c27c0675baa2103ec573" }
List of tags for searching
Maximum array length:
10Maximum string length:
30Example:
["tag1", "tag2"]
List of mentioned users
Show child attributes
Show child attributes
⌘I