Send Bot Chat Message
curl --request POST \
--url https://api.krea.ai/bots/chats/{chat_id}/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"text": "",
"attachments": [],
"idempotency_key": "<string>"
}
'import requests
url = "https://api.krea.ai/bots/chats/{chat_id}/messages"
payload = {
"text": "",
"attachments": [],
"idempotency_key": "<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({text: '', attachments: [], idempotency_key: '<string>'})
};
fetch('https://api.krea.ai/bots/chats/{chat_id}/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://api.krea.ai/bots/chats/{chat_id}/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([
'text' => '',
'attachments' => [
],
'idempotency_key' => '<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://api.krea.ai/bots/chats/{chat_id}/messages"
payload := strings.NewReader("{\n \"text\": \"\",\n \"attachments\": [],\n \"idempotency_key\": \"<string>\"\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://api.krea.ai/bots/chats/{chat_id}/messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"\",\n \"attachments\": [],\n \"idempotency_key\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.krea.ai/bots/chats/{chat_id}/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 \"text\": \"\",\n \"attachments\": [],\n \"idempotency_key\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"chat_id": "<string>",
"title": "<string>",
"message_id": 0,
"cursor": "<string>",
"bots": [
{
"id": "<string>",
"name": "<string>",
"role": "<string>",
"description": "<string>",
"color": "<string>",
"owner": {
"id": "<string>",
"name": "<string>"
},
"is_owner": true,
"shared": true,
"status": "idle"
}
],
"url": "<string>"
}{
"error": "<string>",
"code": "<string>",
"required_plan": "<string>"
}{
"error": "<string>",
"code": "<string>",
"required_plan": "<string>"
}{
"error": "<string>",
"code": "<string>",
"required_plan": "<string>"
}{
"error": "<string>",
"code": "<string>",
"required_plan": "<string>"
}{
"error": "<string>",
"code": "<string>",
"required_plan": "<string>"
}{
"error": "<string>",
"code": "<string>",
"required_plan": "<string>"
}{
"error": "<string>",
"code": "<string>",
"required_plan": "<string>"
}Bots
Send Bot Chat Message
Post a message into a chat as the caller. The bots it reaches start a turn in the background, billed to the workspace’s compute units like a turn in the app. Returns at once with a cursor to read from.
POST
/
bots
/
chats
/
{chat_id}
/
messages
Send Bot Chat Message
curl --request POST \
--url https://api.krea.ai/bots/chats/{chat_id}/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"text": "",
"attachments": [],
"idempotency_key": "<string>"
}
'import requests
url = "https://api.krea.ai/bots/chats/{chat_id}/messages"
payload = {
"text": "",
"attachments": [],
"idempotency_key": "<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({text: '', attachments: [], idempotency_key: '<string>'})
};
fetch('https://api.krea.ai/bots/chats/{chat_id}/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://api.krea.ai/bots/chats/{chat_id}/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([
'text' => '',
'attachments' => [
],
'idempotency_key' => '<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://api.krea.ai/bots/chats/{chat_id}/messages"
payload := strings.NewReader("{\n \"text\": \"\",\n \"attachments\": [],\n \"idempotency_key\": \"<string>\"\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://api.krea.ai/bots/chats/{chat_id}/messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"\",\n \"attachments\": [],\n \"idempotency_key\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.krea.ai/bots/chats/{chat_id}/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 \"text\": \"\",\n \"attachments\": [],\n \"idempotency_key\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"chat_id": "<string>",
"title": "<string>",
"message_id": 0,
"cursor": "<string>",
"bots": [
{
"id": "<string>",
"name": "<string>",
"role": "<string>",
"description": "<string>",
"color": "<string>",
"owner": {
"id": "<string>",
"name": "<string>"
},
"is_owner": true,
"shared": true,
"status": "idle"
}
],
"url": "<string>"
}{
"error": "<string>",
"code": "<string>",
"required_plan": "<string>"
}{
"error": "<string>",
"code": "<string>",
"required_plan": "<string>"
}{
"error": "<string>",
"code": "<string>",
"required_plan": "<string>"
}{
"error": "<string>",
"code": "<string>",
"required_plan": "<string>"
}{
"error": "<string>",
"code": "<string>",
"required_plan": "<string>"
}{
"error": "<string>",
"code": "<string>",
"required_plan": "<string>"
}{
"error": "<string>",
"code": "<string>",
"required_plan": "<string>"
}Authorizations
Path Parameters
Body
application/json
Maximum string length:
8000A key of your choosing that names this request. Repeating the request with the same key, for example after a timeout, sends nothing again: it answers with the same chat, message and cursor as the first. A start without a message sends nothing either way, and its cursor always follows your newest message.
Required string length:
1 - 200Response
The message was posted.
Was this page helpful?