Create Text Message
curl --request POST \
--url https://api.in.talqing.com/v1/conversations/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"client_message_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"contact_key": "<string>",
"images": [
{
"data_url": "<string>",
"filename": "<string>"
}
],
"message": ""
}
'import requests
url = "https://api.in.talqing.com/v1/conversations/messages"
payload = {
"client_message_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"contact_key": "<string>",
"images": [
{
"data_url": "<string>",
"filename": "<string>"
}
],
"message": ""
}
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({
client_message_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
contact_key: '<string>',
images: [{data_url: '<string>', filename: '<string>'}],
message: ''
})
};
fetch('https://api.in.talqing.com/v1/conversations/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.in.talqing.com/v1/conversations/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([
'client_message_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'contact_key' => '<string>',
'images' => [
[
'data_url' => '<string>',
'filename' => '<string>'
]
],
'message' => ''
]),
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.in.talqing.com/v1/conversations/messages"
payload := strings.NewReader("{\n \"client_message_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"contact_key\": \"<string>\",\n \"images\": [\n {\n \"data_url\": \"<string>\",\n \"filename\": \"<string>\"\n }\n ],\n \"message\": \"\"\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.in.talqing.com/v1/conversations/messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"client_message_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"contact_key\": \"<string>\",\n \"images\": [\n {\n \"data_url\": \"<string>\",\n \"filename\": \"<string>\"\n }\n ],\n \"message\": \"\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.in.talqing.com/v1/conversations/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 \"client_message_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"contact_key\": \"<string>\",\n \"images\": [\n {\n \"data_url\": \"<string>\",\n \"filename\": \"<string>\"\n }\n ],\n \"message\": \"\"\n}"
response = http.request(request)
puts response.read_body{
"contact_key": "<string>",
"conversation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"item": {
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"agent_version": 123,
"attachments": [
{
"bytes": 123,
"height": 123,
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"mime_type": "<string>",
"url": "<string>",
"url_expires_at": "2023-11-07T05:31:56Z",
"width": 123,
"filename": "<string>",
"kind": "image"
}
],
"client_message_id": "<string>",
"conversation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"delivery_error": {
"message": "<string>"
},
"delivery_status": "not_applicable",
"direction": "inbound",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"metadata": {},
"metrics": {
"e2e_latency": 123,
"end_of_turn_delay": 123,
"llm_metadata": {
"model_name": "<string>",
"model_provider": "<string>"
},
"llm_node_ttft": 123,
"llm_tokens_per_second": 123,
"on_user_turn_completed_delay": 123,
"started_speaking_at": 123,
"stopped_speaking_at": 123,
"stt_metadata": {
"model_name": "<string>",
"model_provider": "<string>"
},
"transcription_delay": 123,
"tts_metadata": {
"model_name": "<string>",
"model_provider": "<string>"
},
"tts_node_ttfb": 123
},
"provider_message_id": "<string>",
"raw_payload": {},
"role": "developer",
"session_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"source": "<string>",
"text": "<string>",
"trigger_item_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"type": "message",
"updated_at": "2023-11-07T05:31:56Z",
"visibility": "customer_visible"
}
}{
"detail": {
"errors": [
"<string>"
],
"message": "<string>"
}
}{
"detail": {
"errors": [
"<string>"
],
"message": "<string>"
}
}{
"detail": {
"errors": [
"<string>"
],
"message": "<string>"
}
}{
"detail": {
"errors": [
"<string>"
],
"message": "<string>"
}
}{
"detail": {
"errors": [
"<string>"
],
"message": "<string>"
}
}{
"detail": {
"errors": [
"<string>"
],
"message": "<string>"
}
}conversations
Create Text Message
Send a message to a text agent — the way to actually talk to one.
Addressed by contact_key, not by id, so the same key always reaches the
same thread. client_message_id is a UUID you generate; re-sending with the
same one is ignored rather than duplicated.
Returns as soon as the message is accepted, carrying only the user’s own
item — poll list_conversation_items for the agent’s reply.
POST
/
v1
/
conversations
/
messages
Create Text Message
curl --request POST \
--url https://api.in.talqing.com/v1/conversations/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"client_message_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"contact_key": "<string>",
"images": [
{
"data_url": "<string>",
"filename": "<string>"
}
],
"message": ""
}
'import requests
url = "https://api.in.talqing.com/v1/conversations/messages"
payload = {
"client_message_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"contact_key": "<string>",
"images": [
{
"data_url": "<string>",
"filename": "<string>"
}
],
"message": ""
}
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({
client_message_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
contact_key: '<string>',
images: [{data_url: '<string>', filename: '<string>'}],
message: ''
})
};
fetch('https://api.in.talqing.com/v1/conversations/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.in.talqing.com/v1/conversations/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([
'client_message_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'contact_key' => '<string>',
'images' => [
[
'data_url' => '<string>',
'filename' => '<string>'
]
],
'message' => ''
]),
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.in.talqing.com/v1/conversations/messages"
payload := strings.NewReader("{\n \"client_message_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"contact_key\": \"<string>\",\n \"images\": [\n {\n \"data_url\": \"<string>\",\n \"filename\": \"<string>\"\n }\n ],\n \"message\": \"\"\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.in.talqing.com/v1/conversations/messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"client_message_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"contact_key\": \"<string>\",\n \"images\": [\n {\n \"data_url\": \"<string>\",\n \"filename\": \"<string>\"\n }\n ],\n \"message\": \"\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.in.talqing.com/v1/conversations/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 \"client_message_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"contact_key\": \"<string>\",\n \"images\": [\n {\n \"data_url\": \"<string>\",\n \"filename\": \"<string>\"\n }\n ],\n \"message\": \"\"\n}"
response = http.request(request)
puts response.read_body{
"contact_key": "<string>",
"conversation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"item": {
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"agent_version": 123,
"attachments": [
{
"bytes": 123,
"height": 123,
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"mime_type": "<string>",
"url": "<string>",
"url_expires_at": "2023-11-07T05:31:56Z",
"width": 123,
"filename": "<string>",
"kind": "image"
}
],
"client_message_id": "<string>",
"conversation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"delivery_error": {
"message": "<string>"
},
"delivery_status": "not_applicable",
"direction": "inbound",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"metadata": {},
"metrics": {
"e2e_latency": 123,
"end_of_turn_delay": 123,
"llm_metadata": {
"model_name": "<string>",
"model_provider": "<string>"
},
"llm_node_ttft": 123,
"llm_tokens_per_second": 123,
"on_user_turn_completed_delay": 123,
"started_speaking_at": 123,
"stopped_speaking_at": 123,
"stt_metadata": {
"model_name": "<string>",
"model_provider": "<string>"
},
"transcription_delay": 123,
"tts_metadata": {
"model_name": "<string>",
"model_provider": "<string>"
},
"tts_node_ttfb": 123
},
"provider_message_id": "<string>",
"raw_payload": {},
"role": "developer",
"session_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"source": "<string>",
"text": "<string>",
"trigger_item_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"type": "message",
"updated_at": "2023-11-07T05:31:56Z",
"visibility": "customer_visible"
}
}{
"detail": {
"errors": [
"<string>"
],
"message": "<string>"
}
}{
"detail": {
"errors": [
"<string>"
],
"message": "<string>"
}
}{
"detail": {
"errors": [
"<string>"
],
"message": "<string>"
}
}{
"detail": {
"errors": [
"<string>"
],
"message": "<string>"
}
}{
"detail": {
"errors": [
"<string>"
],
"message": "<string>"
}
}{
"detail": {
"errors": [
"<string>"
],
"message": "<string>"
}
}Authorizations
BearerAuthSessionCookie
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
One inbound message: what was typed, what was attached, or both.
An image and its caption arrive together and become one turn, one row and one bubble — a photo the agent has to reconcile with a separate sentence is a worse conversation than the one the sender wrote.