create a message
curl --request POST \
--url https://apix.us.amity.co/api/v3/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"channelId": "<string>",
"messageId": "<string>",
"type": "text",
"data": {
"text": "<string>"
},
"fileId": "<string>",
"parentId": "<string>",
"metadata": {},
"tags": [
"<string>"
],
"mentionees": [
{
"userIds": [
"<string>"
]
}
]
}
'import requests
url = "https://apix.us.amity.co/api/v3/messages"
payload = {
"channelId": "<string>",
"messageId": "<string>",
"type": "text",
"data": { "text": "<string>" },
"fileId": "<string>",
"parentId": "<string>",
"metadata": {},
"tags": ["<string>"],
"mentionees": [{ "userIds": ["<string>"] }]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
channelId: '<string>',
messageId: '<string>',
type: 'text',
data: {text: '<string>'},
fileId: '<string>',
parentId: '<string>',
metadata: {},
tags: ['<string>'],
mentionees: [{userIds: ['<string>']}]
})
};
fetch('https://apix.us.amity.co/api/v3/messages', 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/v3/messages",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'channelId' => '<string>',
'messageId' => '<string>',
'type' => 'text',
'data' => [
'text' => '<string>'
],
'fileId' => '<string>',
'parentId' => '<string>',
'metadata' => [
],
'tags' => [
'<string>'
],
'mentionees' => [
[
'userIds' => [
'<string>'
]
]
]
]),
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/v3/messages"
payload := strings.NewReader("{\n \"channelId\": \"<string>\",\n \"messageId\": \"<string>\",\n \"type\": \"text\",\n \"data\": {\n \"text\": \"<string>\"\n },\n \"fileId\": \"<string>\",\n \"parentId\": \"<string>\",\n \"metadata\": {},\n \"tags\": [\n \"<string>\"\n ],\n \"mentionees\": [\n {\n \"userIds\": [\n \"<string>\"\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", 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.post("https://apix.us.amity.co/api/v3/messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"channelId\": \"<string>\",\n \"messageId\": \"<string>\",\n \"type\": \"text\",\n \"data\": {\n \"text\": \"<string>\"\n },\n \"fileId\": \"<string>\",\n \"parentId\": \"<string>\",\n \"metadata\": {},\n \"tags\": [\n \"<string>\"\n ],\n \"mentionees\": [\n {\n \"userIds\": [\n \"<string>\"\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apix.us.amity.co/api/v3/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"channelId\": \"<string>\",\n \"messageId\": \"<string>\",\n \"type\": \"text\",\n \"data\": {\n \"text\": \"<string>\"\n },\n \"fileId\": \"<string>\",\n \"parentId\": \"<string>\",\n \"metadata\": {},\n \"tags\": [\n \"<string>\"\n ],\n \"mentionees\": [\n {\n \"userIds\": [\n \"<string>\"\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"messages": [
{
"_id": "<string>",
"path": "<string>",
"messageId": "<string>",
"channelId": "<string>",
"userId": "<string>",
"data": {},
"channelSegment": 123,
"parentId": "<string>",
"fileId": "<string>",
"tags": [
"<string>"
],
"metadata": {},
"flagCount": 123,
"hashFlag": {
"bits": 123,
"hashes": 123,
"hash": [
"<string>"
]
},
"childrenNumber": 123,
"reactionsCount": 123,
"reactions": {},
"myReactions": [
"<string>"
],
"latestReaction": {
"referenceId": "<string>",
"referenceType": "<string>",
"reactionName": "<string>",
"userId": "<string>",
"userDisplayName": "<string>",
"reactionId": "<string>",
"eventName": "<string>",
"createdAt": "2023-11-07T05:31:56Z"
},
"isDeleted": true,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"editedAt": "2023-11-07T05:31:56Z",
"mentionees": [
{
"userIds": [
"<string>"
],
"userPublicIds": [
"<string>"
],
"userInternalIds": [
"<string>"
]
}
]
}
],
"users": [
{
"userId": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"_id": "<string>",
"path": "<string>",
"userInternalId": "<string>",
"userPublicId": "<string>",
"roles": [
"<string>"
],
"permissions": [],
"displayName": "<string>",
"profileHandle": "<string>",
"description": "<string>",
"avatarFileId": "<string>",
"avatarCustomUrl": "<string>",
"flagCount": 123,
"hashFlag": {
"bits": 123,
"hashes": 123,
"hash": [
"<string>"
]
},
"metadata": {},
"isGlobalBan": true,
"isBrand": true,
"isDeleted": true
}
],
"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
}
}
}
]
}Message
create a message
POST
/
api
/
v3
/
messages
create a message
curl --request POST \
--url https://apix.us.amity.co/api/v3/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"channelId": "<string>",
"messageId": "<string>",
"type": "text",
"data": {
"text": "<string>"
},
"fileId": "<string>",
"parentId": "<string>",
"metadata": {},
"tags": [
"<string>"
],
"mentionees": [
{
"userIds": [
"<string>"
]
}
]
}
'import requests
url = "https://apix.us.amity.co/api/v3/messages"
payload = {
"channelId": "<string>",
"messageId": "<string>",
"type": "text",
"data": { "text": "<string>" },
"fileId": "<string>",
"parentId": "<string>",
"metadata": {},
"tags": ["<string>"],
"mentionees": [{ "userIds": ["<string>"] }]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
channelId: '<string>',
messageId: '<string>',
type: 'text',
data: {text: '<string>'},
fileId: '<string>',
parentId: '<string>',
metadata: {},
tags: ['<string>'],
mentionees: [{userIds: ['<string>']}]
})
};
fetch('https://apix.us.amity.co/api/v3/messages', 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/v3/messages",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'channelId' => '<string>',
'messageId' => '<string>',
'type' => 'text',
'data' => [
'text' => '<string>'
],
'fileId' => '<string>',
'parentId' => '<string>',
'metadata' => [
],
'tags' => [
'<string>'
],
'mentionees' => [
[
'userIds' => [
'<string>'
]
]
]
]),
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/v3/messages"
payload := strings.NewReader("{\n \"channelId\": \"<string>\",\n \"messageId\": \"<string>\",\n \"type\": \"text\",\n \"data\": {\n \"text\": \"<string>\"\n },\n \"fileId\": \"<string>\",\n \"parentId\": \"<string>\",\n \"metadata\": {},\n \"tags\": [\n \"<string>\"\n ],\n \"mentionees\": [\n {\n \"userIds\": [\n \"<string>\"\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", 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.post("https://apix.us.amity.co/api/v3/messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"channelId\": \"<string>\",\n \"messageId\": \"<string>\",\n \"type\": \"text\",\n \"data\": {\n \"text\": \"<string>\"\n },\n \"fileId\": \"<string>\",\n \"parentId\": \"<string>\",\n \"metadata\": {},\n \"tags\": [\n \"<string>\"\n ],\n \"mentionees\": [\n {\n \"userIds\": [\n \"<string>\"\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apix.us.amity.co/api/v3/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"channelId\": \"<string>\",\n \"messageId\": \"<string>\",\n \"type\": \"text\",\n \"data\": {\n \"text\": \"<string>\"\n },\n \"fileId\": \"<string>\",\n \"parentId\": \"<string>\",\n \"metadata\": {},\n \"tags\": [\n \"<string>\"\n ],\n \"mentionees\": [\n {\n \"userIds\": [\n \"<string>\"\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"messages": [
{
"_id": "<string>",
"path": "<string>",
"messageId": "<string>",
"channelId": "<string>",
"userId": "<string>",
"data": {},
"channelSegment": 123,
"parentId": "<string>",
"fileId": "<string>",
"tags": [
"<string>"
],
"metadata": {},
"flagCount": 123,
"hashFlag": {
"bits": 123,
"hashes": 123,
"hash": [
"<string>"
]
},
"childrenNumber": 123,
"reactionsCount": 123,
"reactions": {},
"myReactions": [
"<string>"
],
"latestReaction": {
"referenceId": "<string>",
"referenceType": "<string>",
"reactionName": "<string>",
"userId": "<string>",
"userDisplayName": "<string>",
"reactionId": "<string>",
"eventName": "<string>",
"createdAt": "2023-11-07T05:31:56Z"
},
"isDeleted": true,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"editedAt": "2023-11-07T05:31:56Z",
"mentionees": [
{
"userIds": [
"<string>"
],
"userPublicIds": [
"<string>"
],
"userInternalIds": [
"<string>"
]
}
]
}
],
"users": [
{
"userId": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"_id": "<string>",
"path": "<string>",
"userInternalId": "<string>",
"userPublicId": "<string>",
"roles": [
"<string>"
],
"permissions": [],
"displayName": "<string>",
"profileHandle": "<string>",
"description": "<string>",
"avatarFileId": "<string>",
"avatarCustomUrl": "<string>",
"flagCount": 123,
"hashFlag": {
"bits": 123,
"hashes": 123,
"hash": [
"<string>"
]
},
"metadata": {},
"isGlobalBan": true,
"isBrand": true,
"isDeleted": true
}
],
"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
}
}
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Information of message to be created
Maximum string length:
150Maximum string length:
150Available options:
text, image, file, custom, video, audio, imagemap Show child attributes
Show child attributes
Maximum string length:
50Maximum string length:
150Maximum array length:
10Maximum string length:
30The object of the mentions type and user who get a notification for the message.
Maximum array length:
2Show child attributes
Show child attributes
⌘I