curl --request POST \
--url https://api.protodesk.io/v1/conversations/{conversationId}/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"externalId": "msg_123",
"sender": "customer",
"body": "Hi, is this villa available for yearly rental?",
"channel": "whatsapp",
"attachments": [
{
"id": "file_123",
"url": "https://example.com/files/inquiry.png",
"filename": "inquiry.png",
"contentType": "image/png",
"sizeBytes": 12345,
"metadata": {
"kind": "screenshot"
}
}
],
"metadata": {
"source": "owner_app"
},
"internal": false
}
'import requests
url = "https://api.protodesk.io/v1/conversations/{conversationId}/messages"
payload = {
"externalId": "msg_123",
"sender": "customer",
"body": "Hi, is this villa available for yearly rental?",
"channel": "whatsapp",
"attachments": [
{
"id": "file_123",
"url": "https://example.com/files/inquiry.png",
"filename": "inquiry.png",
"contentType": "image/png",
"sizeBytes": 12345,
"metadata": { "kind": "screenshot" }
}
],
"metadata": { "source": "owner_app" },
"internal": False
}
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({
externalId: 'msg_123',
sender: 'customer',
body: JSON.stringify('Hi, is this villa available for yearly rental?'),
channel: 'whatsapp',
attachments: [
{
id: 'file_123',
url: 'https://example.com/files/inquiry.png',
filename: 'inquiry.png',
contentType: 'image/png',
sizeBytes: 12345,
metadata: {kind: 'screenshot'}
}
],
metadata: {source: 'owner_app'},
internal: false
})
};
fetch('https://api.protodesk.io/v1/conversations/{conversationId}/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.protodesk.io/v1/conversations/{conversationId}/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([
'externalId' => 'msg_123',
'sender' => 'customer',
'body' => 'Hi, is this villa available for yearly rental?',
'channel' => 'whatsapp',
'attachments' => [
[
'id' => 'file_123',
'url' => 'https://example.com/files/inquiry.png',
'filename' => 'inquiry.png',
'contentType' => 'image/png',
'sizeBytes' => 12345,
'metadata' => [
'kind' => 'screenshot'
]
]
],
'metadata' => [
'source' => 'owner_app'
],
'internal' => false
]),
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.protodesk.io/v1/conversations/{conversationId}/messages"
payload := strings.NewReader("{\n \"externalId\": \"msg_123\",\n \"sender\": \"customer\",\n \"body\": \"Hi, is this villa available for yearly rental?\",\n \"channel\": \"whatsapp\",\n \"attachments\": [\n {\n \"id\": \"file_123\",\n \"url\": \"https://example.com/files/inquiry.png\",\n \"filename\": \"inquiry.png\",\n \"contentType\": \"image/png\",\n \"sizeBytes\": 12345,\n \"metadata\": {\n \"kind\": \"screenshot\"\n }\n }\n ],\n \"metadata\": {\n \"source\": \"owner_app\"\n },\n \"internal\": false\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.protodesk.io/v1/conversations/{conversationId}/messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"externalId\": \"msg_123\",\n \"sender\": \"customer\",\n \"body\": \"Hi, is this villa available for yearly rental?\",\n \"channel\": \"whatsapp\",\n \"attachments\": [\n {\n \"id\": \"file_123\",\n \"url\": \"https://example.com/files/inquiry.png\",\n \"filename\": \"inquiry.png\",\n \"contentType\": \"image/png\",\n \"sizeBytes\": 12345,\n \"metadata\": {\n \"kind\": \"screenshot\"\n }\n }\n ],\n \"metadata\": {\n \"source\": \"owner_app\"\n },\n \"internal\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.protodesk.io/v1/conversations/{conversationId}/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 \"externalId\": \"msg_123\",\n \"sender\": \"customer\",\n \"body\": \"Hi, is this villa available for yearly rental?\",\n \"channel\": \"whatsapp\",\n \"attachments\": [\n {\n \"id\": \"file_123\",\n \"url\": \"https://example.com/files/inquiry.png\",\n \"filename\": \"inquiry.png\",\n \"contentType\": \"image/png\",\n \"sizeBytes\": 12345,\n \"metadata\": {\n \"kind\": \"screenshot\"\n }\n }\n ],\n \"metadata\": {\n \"source\": \"owner_app\"\n },\n \"internal\": false\n}"
response = http.request(request)
puts response.read_body{
"id": "msg_x6q5vl75f5d53m7oet2k4r5w6a",
"externalId": "msg_123",
"conversationId": "conv_x6q5vl75f5d53m7oet2k4r5w6a",
"sender": "customer",
"body": "Hi, is this villa available for yearly rental?",
"channel": "whatsapp",
"attachments": [
{
"id": "file_123",
"url": "https://example.com/files/inquiry.png",
"filename": "inquiry.png",
"contentType": "image/png",
"sizeBytes": 12345,
"metadata": {
"kind": "screenshot"
}
}
],
"metadata": {},
"internal": true,
"createdAt": "2023-11-07T05:31:56Z"
}{
"error": {
"code": "route.not_found",
"message": "Not found",
"requestId": "req_x6q5vl75f5d53m7oet2k4r5w6a"
}
}Create a message
curl --request POST \
--url https://api.protodesk.io/v1/conversations/{conversationId}/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"externalId": "msg_123",
"sender": "customer",
"body": "Hi, is this villa available for yearly rental?",
"channel": "whatsapp",
"attachments": [
{
"id": "file_123",
"url": "https://example.com/files/inquiry.png",
"filename": "inquiry.png",
"contentType": "image/png",
"sizeBytes": 12345,
"metadata": {
"kind": "screenshot"
}
}
],
"metadata": {
"source": "owner_app"
},
"internal": false
}
'import requests
url = "https://api.protodesk.io/v1/conversations/{conversationId}/messages"
payload = {
"externalId": "msg_123",
"sender": "customer",
"body": "Hi, is this villa available for yearly rental?",
"channel": "whatsapp",
"attachments": [
{
"id": "file_123",
"url": "https://example.com/files/inquiry.png",
"filename": "inquiry.png",
"contentType": "image/png",
"sizeBytes": 12345,
"metadata": { "kind": "screenshot" }
}
],
"metadata": { "source": "owner_app" },
"internal": False
}
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({
externalId: 'msg_123',
sender: 'customer',
body: JSON.stringify('Hi, is this villa available for yearly rental?'),
channel: 'whatsapp',
attachments: [
{
id: 'file_123',
url: 'https://example.com/files/inquiry.png',
filename: 'inquiry.png',
contentType: 'image/png',
sizeBytes: 12345,
metadata: {kind: 'screenshot'}
}
],
metadata: {source: 'owner_app'},
internal: false
})
};
fetch('https://api.protodesk.io/v1/conversations/{conversationId}/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.protodesk.io/v1/conversations/{conversationId}/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([
'externalId' => 'msg_123',
'sender' => 'customer',
'body' => 'Hi, is this villa available for yearly rental?',
'channel' => 'whatsapp',
'attachments' => [
[
'id' => 'file_123',
'url' => 'https://example.com/files/inquiry.png',
'filename' => 'inquiry.png',
'contentType' => 'image/png',
'sizeBytes' => 12345,
'metadata' => [
'kind' => 'screenshot'
]
]
],
'metadata' => [
'source' => 'owner_app'
],
'internal' => false
]),
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.protodesk.io/v1/conversations/{conversationId}/messages"
payload := strings.NewReader("{\n \"externalId\": \"msg_123\",\n \"sender\": \"customer\",\n \"body\": \"Hi, is this villa available for yearly rental?\",\n \"channel\": \"whatsapp\",\n \"attachments\": [\n {\n \"id\": \"file_123\",\n \"url\": \"https://example.com/files/inquiry.png\",\n \"filename\": \"inquiry.png\",\n \"contentType\": \"image/png\",\n \"sizeBytes\": 12345,\n \"metadata\": {\n \"kind\": \"screenshot\"\n }\n }\n ],\n \"metadata\": {\n \"source\": \"owner_app\"\n },\n \"internal\": false\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.protodesk.io/v1/conversations/{conversationId}/messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"externalId\": \"msg_123\",\n \"sender\": \"customer\",\n \"body\": \"Hi, is this villa available for yearly rental?\",\n \"channel\": \"whatsapp\",\n \"attachments\": [\n {\n \"id\": \"file_123\",\n \"url\": \"https://example.com/files/inquiry.png\",\n \"filename\": \"inquiry.png\",\n \"contentType\": \"image/png\",\n \"sizeBytes\": 12345,\n \"metadata\": {\n \"kind\": \"screenshot\"\n }\n }\n ],\n \"metadata\": {\n \"source\": \"owner_app\"\n },\n \"internal\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.protodesk.io/v1/conversations/{conversationId}/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 \"externalId\": \"msg_123\",\n \"sender\": \"customer\",\n \"body\": \"Hi, is this villa available for yearly rental?\",\n \"channel\": \"whatsapp\",\n \"attachments\": [\n {\n \"id\": \"file_123\",\n \"url\": \"https://example.com/files/inquiry.png\",\n \"filename\": \"inquiry.png\",\n \"contentType\": \"image/png\",\n \"sizeBytes\": 12345,\n \"metadata\": {\n \"kind\": \"screenshot\"\n }\n }\n ],\n \"metadata\": {\n \"source\": \"owner_app\"\n },\n \"internal\": false\n}"
response = http.request(request)
puts response.read_body{
"id": "msg_x6q5vl75f5d53m7oet2k4r5w6a",
"externalId": "msg_123",
"conversationId": "conv_x6q5vl75f5d53m7oet2k4r5w6a",
"sender": "customer",
"body": "Hi, is this villa available for yearly rental?",
"channel": "whatsapp",
"attachments": [
{
"id": "file_123",
"url": "https://example.com/files/inquiry.png",
"filename": "inquiry.png",
"contentType": "image/png",
"sizeBytes": 12345,
"metadata": {
"kind": "screenshot"
}
}
],
"metadata": {},
"internal": true,
"createdAt": "2023-11-07T05:31:56Z"
}{
"error": {
"code": "route.not_found",
"message": "Not found",
"requestId": "req_x6q5vl75f5d53m7oet2k4r5w6a"
}
}Authorizations
Use a workspace API key in the Authorization header. Keys use pk_live_<key_id> for production and pk_test<key_id>_ for test mode.
Headers
Optional retry key for safely replaying create requests. Reusing the same key with a different request body returns 409.
8 - 255"8db8e596-7c1a-4fd5-a728-4d6c99f4e66b"
Path Parameters
"conv_x6q5vl75f5d53m7oet2k4r5w6a"
Body
Requires body or at least one attachment.
Your stable id for this message.
"msg_123"
customer, agent, ai, system "Hi, is this villa available for yearly rental?"
"whatsapp"
Show child attributes
Show child attributes
{ "source": "owner_app" }
True for internal notes that should not be sent to the customer.
Response
Created message.
Every key is always present; optional fields are null when unset.
"msg_x6q5vl75f5d53m7oet2k4r5w6a"
"msg_123"
"conv_x6q5vl75f5d53m7oet2k4r5w6a"
customer, agent, ai, system "Hi, is this villa available for yearly rental?"
"whatsapp"
Show child attributes
Show child attributes
