Messages
Send a message to a channel (channelId in body)
POST
/
api
/
v1
/
messages
Send a message to a channel (channelId in body)
curl --request POST \
--url http://localhost:3001/api/v1/messages \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"channelId": "<string>",
"text": "<string>",
"metadata": {},
"webhookUrl": "<string>",
"attachmentIds": [
"<string>"
],
"textAttachments": [
{
"content": "<string>",
"filename": "content.md",
"mimeType": "text/markdown"
}
],
"iterationOf": "<string>"
}
'import requests
url = "http://localhost:3001/api/v1/messages"
payload = {
"channelId": "<string>",
"text": "<string>",
"metadata": {},
"webhookUrl": "<string>",
"attachmentIds": ["<string>"],
"textAttachments": [
{
"content": "<string>",
"filename": "content.md",
"mimeType": "text/markdown"
}
],
"iterationOf": "<string>"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
channelId: '<string>',
text: '<string>',
metadata: {},
webhookUrl: '<string>',
attachmentIds: ['<string>'],
textAttachments: [{content: '<string>', filename: 'content.md', mimeType: 'text/markdown'}],
iterationOf: '<string>'
})
};
fetch('http://localhost:3001/api/v1/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_PORT => "3001",
CURLOPT_URL => "http://localhost:3001/api/v1/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>',
'text' => '<string>',
'metadata' => [
],
'webhookUrl' => '<string>',
'attachmentIds' => [
'<string>'
],
'textAttachments' => [
[
'content' => '<string>',
'filename' => 'content.md',
'mimeType' => 'text/markdown'
]
],
'iterationOf' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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 := "http://localhost:3001/api/v1/messages"
payload := strings.NewReader("{\n \"channelId\": \"<string>\",\n \"text\": \"<string>\",\n \"metadata\": {},\n \"webhookUrl\": \"<string>\",\n \"attachmentIds\": [\n \"<string>\"\n ],\n \"textAttachments\": [\n {\n \"content\": \"<string>\",\n \"filename\": \"content.md\",\n \"mimeType\": \"text/markdown\"\n }\n ],\n \"iterationOf\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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("http://localhost:3001/api/v1/messages")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"channelId\": \"<string>\",\n \"text\": \"<string>\",\n \"metadata\": {},\n \"webhookUrl\": \"<string>\",\n \"attachmentIds\": [\n \"<string>\"\n ],\n \"textAttachments\": [\n {\n \"content\": \"<string>\",\n \"filename\": \"content.md\",\n \"mimeType\": \"text/markdown\"\n }\n ],\n \"iterationOf\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3001/api/v1/messages")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"channelId\": \"<string>\",\n \"text\": \"<string>\",\n \"metadata\": {},\n \"webhookUrl\": \"<string>\",\n \"attachmentIds\": [\n \"<string>\"\n ],\n \"textAttachments\": [\n {\n \"content\": \"<string>\",\n \"filename\": \"content.md\",\n \"mimeType\": \"text/markdown\"\n }\n ],\n \"iterationOf\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "clxyz111",
"channelId": "clxyz456",
"senderType": "agent",
"senderId": "clxyz456",
"createdAt": "2025-01-01T00:00:00.000Z",
"attachments": [
{
"id": "clxyz789",
"messageId": "clxyz123",
"pluginType": "file",
"filename": "report.pdf",
"mimeType": "application/pdf",
"size": 1024,
"storageKey": "uploads/clxyz123/report.pdf",
"createdAt": "2025-01-01T00:00:00.000Z"
}
],
"text": "Hello from agent",
"status": "info",
"review": {
"type": "approval",
"status": "pending"
},
"metadata": {
"source": "automation"
}
}{
"statusCode": 400,
"message": "Validation failed",
"errors": [
{
"code": "invalid_type",
"message": "Expected string, received number",
"path": [
"email"
]
}
]
}{
"statusCode": 400,
"message": "Validation failed",
"errors": [
{
"code": "invalid_type",
"message": "Expected string, received number",
"path": [
"email"
]
}
]
}Authorizations
Placet API key (hp_...)
Body
application/json
Response
Message created
Example:
"clxyz111"
Example:
"clxyz456"
Available options:
agent, user Example:
"agent"
Example:
"clxyz456"
Example:
"2025-01-01T00:00:00.000Z"
Show child attributes
Show child attributes
Example:
"Hello from agent"
Available options:
info, success, warning, error Example:
"info"
Review object (null if no review)
Example:
{ "type": "approval", "status": "pending" }
Arbitrary metadata
Example:
{ "source": "automation" }
⌘I
Send a message to a channel (channelId in body)
curl --request POST \
--url http://localhost:3001/api/v1/messages \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"channelId": "<string>",
"text": "<string>",
"metadata": {},
"webhookUrl": "<string>",
"attachmentIds": [
"<string>"
],
"textAttachments": [
{
"content": "<string>",
"filename": "content.md",
"mimeType": "text/markdown"
}
],
"iterationOf": "<string>"
}
'import requests
url = "http://localhost:3001/api/v1/messages"
payload = {
"channelId": "<string>",
"text": "<string>",
"metadata": {},
"webhookUrl": "<string>",
"attachmentIds": ["<string>"],
"textAttachments": [
{
"content": "<string>",
"filename": "content.md",
"mimeType": "text/markdown"
}
],
"iterationOf": "<string>"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
channelId: '<string>',
text: '<string>',
metadata: {},
webhookUrl: '<string>',
attachmentIds: ['<string>'],
textAttachments: [{content: '<string>', filename: 'content.md', mimeType: 'text/markdown'}],
iterationOf: '<string>'
})
};
fetch('http://localhost:3001/api/v1/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_PORT => "3001",
CURLOPT_URL => "http://localhost:3001/api/v1/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>',
'text' => '<string>',
'metadata' => [
],
'webhookUrl' => '<string>',
'attachmentIds' => [
'<string>'
],
'textAttachments' => [
[
'content' => '<string>',
'filename' => 'content.md',
'mimeType' => 'text/markdown'
]
],
'iterationOf' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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 := "http://localhost:3001/api/v1/messages"
payload := strings.NewReader("{\n \"channelId\": \"<string>\",\n \"text\": \"<string>\",\n \"metadata\": {},\n \"webhookUrl\": \"<string>\",\n \"attachmentIds\": [\n \"<string>\"\n ],\n \"textAttachments\": [\n {\n \"content\": \"<string>\",\n \"filename\": \"content.md\",\n \"mimeType\": \"text/markdown\"\n }\n ],\n \"iterationOf\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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("http://localhost:3001/api/v1/messages")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"channelId\": \"<string>\",\n \"text\": \"<string>\",\n \"metadata\": {},\n \"webhookUrl\": \"<string>\",\n \"attachmentIds\": [\n \"<string>\"\n ],\n \"textAttachments\": [\n {\n \"content\": \"<string>\",\n \"filename\": \"content.md\",\n \"mimeType\": \"text/markdown\"\n }\n ],\n \"iterationOf\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3001/api/v1/messages")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"channelId\": \"<string>\",\n \"text\": \"<string>\",\n \"metadata\": {},\n \"webhookUrl\": \"<string>\",\n \"attachmentIds\": [\n \"<string>\"\n ],\n \"textAttachments\": [\n {\n \"content\": \"<string>\",\n \"filename\": \"content.md\",\n \"mimeType\": \"text/markdown\"\n }\n ],\n \"iterationOf\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "clxyz111",
"channelId": "clxyz456",
"senderType": "agent",
"senderId": "clxyz456",
"createdAt": "2025-01-01T00:00:00.000Z",
"attachments": [
{
"id": "clxyz789",
"messageId": "clxyz123",
"pluginType": "file",
"filename": "report.pdf",
"mimeType": "application/pdf",
"size": 1024,
"storageKey": "uploads/clxyz123/report.pdf",
"createdAt": "2025-01-01T00:00:00.000Z"
}
],
"text": "Hello from agent",
"status": "info",
"review": {
"type": "approval",
"status": "pending"
},
"metadata": {
"source": "automation"
}
}{
"statusCode": 400,
"message": "Validation failed",
"errors": [
{
"code": "invalid_type",
"message": "Expected string, received number",
"path": [
"email"
]
}
]
}{
"statusCode": 400,
"message": "Validation failed",
"errors": [
{
"code": "invalid_type",
"message": "Expected string, received number",
"path": [
"email"
]
}
]
}