Generate Message
curl --request POST \
--url https://api.trillet.ai/v1/api/conversations/message/generate \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--header 'x-workspace-id: <x-workspace-id>' \
--data '
{
"flowId": "<string>",
"to": "<string>",
"metadata": {
"customerDetails": {
"name": "<string>"
}
},
"autopilot": true,
"dynamic": {}
}
'import requests
url = "https://api.trillet.ai/v1/api/conversations/message/generate"
payload = {
"flowId": "<string>",
"to": "<string>",
"metadata": { "customerDetails": { "name": "<string>" } },
"autopilot": True,
"dynamic": {}
}
headers = {
"x-api-key": "<api-key>",
"x-workspace-id": "<x-workspace-id>",
"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>',
'x-workspace-id': '<x-workspace-id>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
flowId: '<string>',
to: '<string>',
metadata: {customerDetails: {name: '<string>'}},
autopilot: true,
dynamic: {}
})
};
fetch('https://api.trillet.ai/v1/api/conversations/message/generate', 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.trillet.ai/v1/api/conversations/message/generate",
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([
'flowId' => '<string>',
'to' => '<string>',
'metadata' => [
'customerDetails' => [
'name' => '<string>'
]
],
'autopilot' => true,
'dynamic' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>",
"x-workspace-id: <x-workspace-id>"
],
]);
$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.trillet.ai/v1/api/conversations/message/generate"
payload := strings.NewReader("{\n \"flowId\": \"<string>\",\n \"to\": \"<string>\",\n \"metadata\": {\n \"customerDetails\": {\n \"name\": \"<string>\"\n }\n },\n \"autopilot\": true,\n \"dynamic\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("x-workspace-id", "<x-workspace-id>")
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.trillet.ai/v1/api/conversations/message/generate")
.header("x-api-key", "<api-key>")
.header("x-workspace-id", "<x-workspace-id>")
.header("Content-Type", "application/json")
.body("{\n \"flowId\": \"<string>\",\n \"to\": \"<string>\",\n \"metadata\": {\n \"customerDetails\": {\n \"name\": \"<string>\"\n }\n },\n \"autopilot\": true,\n \"dynamic\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.trillet.ai/v1/api/conversations/message/generate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["x-workspace-id"] = '<x-workspace-id>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"flowId\": \"<string>\",\n \"to\": \"<string>\",\n \"metadata\": {\n \"customerDetails\": {\n \"name\": \"<string>\"\n }\n },\n \"autopilot\": true,\n \"dynamic\": {}\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"conversation_id": "63e63b2a-8b6d-4ea4-ae84-abc123",
"message_id": "56f3459b-c23d-46a4-8a2d-bcd456",
"message": "Your appointment is confirmed for tomorrow at 3 PM."
}
Conversations
Generate Message
Send an AI-generated message through either SMS or email to a specified recipient with optional metadata and dynamic configurations.
POST
/
v1
/
api
/
conversations
/
message
/
generate
Generate Message
curl --request POST \
--url https://api.trillet.ai/v1/api/conversations/message/generate \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--header 'x-workspace-id: <x-workspace-id>' \
--data '
{
"flowId": "<string>",
"to": "<string>",
"metadata": {
"customerDetails": {
"name": "<string>"
}
},
"autopilot": true,
"dynamic": {}
}
'import requests
url = "https://api.trillet.ai/v1/api/conversations/message/generate"
payload = {
"flowId": "<string>",
"to": "<string>",
"metadata": { "customerDetails": { "name": "<string>" } },
"autopilot": True,
"dynamic": {}
}
headers = {
"x-api-key": "<api-key>",
"x-workspace-id": "<x-workspace-id>",
"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>',
'x-workspace-id': '<x-workspace-id>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
flowId: '<string>',
to: '<string>',
metadata: {customerDetails: {name: '<string>'}},
autopilot: true,
dynamic: {}
})
};
fetch('https://api.trillet.ai/v1/api/conversations/message/generate', 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.trillet.ai/v1/api/conversations/message/generate",
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([
'flowId' => '<string>',
'to' => '<string>',
'metadata' => [
'customerDetails' => [
'name' => '<string>'
]
],
'autopilot' => true,
'dynamic' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>",
"x-workspace-id: <x-workspace-id>"
],
]);
$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.trillet.ai/v1/api/conversations/message/generate"
payload := strings.NewReader("{\n \"flowId\": \"<string>\",\n \"to\": \"<string>\",\n \"metadata\": {\n \"customerDetails\": {\n \"name\": \"<string>\"\n }\n },\n \"autopilot\": true,\n \"dynamic\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("x-workspace-id", "<x-workspace-id>")
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.trillet.ai/v1/api/conversations/message/generate")
.header("x-api-key", "<api-key>")
.header("x-workspace-id", "<x-workspace-id>")
.header("Content-Type", "application/json")
.body("{\n \"flowId\": \"<string>\",\n \"to\": \"<string>\",\n \"metadata\": {\n \"customerDetails\": {\n \"name\": \"<string>\"\n }\n },\n \"autopilot\": true,\n \"dynamic\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.trillet.ai/v1/api/conversations/message/generate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["x-workspace-id"] = '<x-workspace-id>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"flowId\": \"<string>\",\n \"to\": \"<string>\",\n \"metadata\": {\n \"customerDetails\": {\n \"name\": \"<string>\"\n }\n },\n \"autopilot\": true,\n \"dynamic\": {}\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"conversation_id": "63e63b2a-8b6d-4ea4-ae84-abc123",
"message_id": "56f3459b-c23d-46a4-8a2d-bcd456",
"message": "Your appointment is confirmed for tomorrow at 3 PM."
}
Headers
string
required
API key used for authenticating requests to the API.
string
required
Workspace identifier for the API.
Request Body
string
required
Unique identifier for the message flow sending the message. Ensure the Message Flow ID belongs to an active flow.
string
required
Recipient’s contact information. Use E.164 format for SMS (e.g.,
+1234567890) and a valid email address format for Email (e.g., user@example.com).Ensure the contact format matches the messageChannel type: SMS for phone numbers and Email for email addresses. Using an incorrect format or type will result in an error.
object
boolean
required
Enable automatically sending the generated message to the intended recipient. If your flow has a
delay enabled, the message will be sent after that delay. Defaults to false.object
Dynamic inputs for AI-generated messages.
Response Fields
string
Indicates (
success) if the request was successful.string
Unique identifier for the newly created or fetched existing conversation.
string
Unique identifier for the newly created message within the conversation.
string
Content of the message sent. This will always be the corresponding message flow’s
initiationMessage.{
"status": "success",
"conversation_id": "63e63b2a-8b6d-4ea4-ae84-abc123",
"message_id": "56f3459b-c23d-46a4-8a2d-bcd456",
"message": "Your appointment is confirmed for tomorrow at 3 PM."
}
⌘I
