Create Message
curl --request POST \
--url https://api.decodahealth.com/comms/chat/send-message \
--header 'API-KEY: <api-key>' \
--header 'Content-Type: multipart/form-data' \
--header 'TENANT: <tenant>' \
--form 'sender_id=<string>' \
--form 'chat_id=<string>' \
--form 'content=<string>' \
--form 'message_uid=<string>' \
--form 'quote_id=<string>' \
--form 'files=<string>' \
--form 'event_id=<string>' \
--form files.0.items='@example-file'import requests
url = "https://api.decodahealth.com/comms/chat/send-message"
files = { "files.0.items": ("example-file", open("example-file", "rb")) }
payload = {
"sender_id": "<string>",
"chat_id": "<string>",
"content": "<string>",
"message_uid": "<string>",
"quote_id": "<string>",
"files": "<string>",
"event_id": "<string>"
}
headers = {
"TENANT": "<tenant>",
"API-KEY": "<api-key>"
}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('sender_id', '<string>');
form.append('chat_id', '<string>');
form.append('content', '<string>');
form.append('message_uid', '<string>');
form.append('quote_id', '<string>');
form.append('files', '<string>');
form.append('event_id', '<string>');
form.append('files.0.items', '{
"fileName": "example-file"
}');
const options = {method: 'POST', headers: {TENANT: '<tenant>', 'API-KEY': '<api-key>'}};
options.body = form;
fetch('https://api.decodahealth.com/comms/chat/send-message', 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.decodahealth.com/comms/chat/send-message",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"sender_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"chat_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"content\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"message_uid\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"quote_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"event_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files.0.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"API-KEY: <api-key>",
"Content-Type: multipart/form-data",
"TENANT: <tenant>"
],
]);
$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.decodahealth.com/comms/chat/send-message"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"sender_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"chat_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"content\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"message_uid\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"quote_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"event_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files.0.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("TENANT", "<tenant>")
req.Header.Add("API-KEY", "<api-key>")
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.decodahealth.com/comms/chat/send-message")
.header("TENANT", "<tenant>")
.header("API-KEY", "<api-key>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"sender_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"chat_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"content\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"message_uid\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"quote_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"event_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files.0.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.decodahealth.com/comms/chat/send-message")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["TENANT"] = '<tenant>'
request["API-KEY"] = '<api-key>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"sender_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"chat_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"content\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"message_uid\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"quote_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"event_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files.0.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"chatId": "<string>",
"sender": {
"id": "<string>",
"firstName": "<string>",
"lastName": "<string>",
"phoneNumber": "<string>",
"email": "<string>",
"locationId": "<string>"
},
"createdDate": "2023-11-07T05:31:56Z",
"messageUid": "<string>",
"content": "<string>",
"errorMessage": "<string>",
"sendoMessageId": "<string>",
"functionCall": {},
"files": [],
"suggestedMessages": [
{
"id": "<string>",
"chatId": "<string>",
"fromMessageId": "<string>",
"content": "<string>",
"assistantId": "<string>",
"isSelected": true,
"createdDate": "2023-11-07T05:31:56Z"
}
],
"toolCalls": [
{
"id": "<string>",
"toolName": "<string>",
"toolArguments": {},
"createdDate": "2023-11-07T05:31:56Z",
"callId": "<string>",
"messageId": "<string>",
"alertId": "<string>",
"toolCallId": "<string>",
"result": {},
"toolCallDescription": "<string>",
"hasBeenCalled": false
}
],
"eventId": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Comms
Create Message
Create a new message with optional file attachments
POST
/
comms
/
chat
/
send-message
Create Message
curl --request POST \
--url https://api.decodahealth.com/comms/chat/send-message \
--header 'API-KEY: <api-key>' \
--header 'Content-Type: multipart/form-data' \
--header 'TENANT: <tenant>' \
--form 'sender_id=<string>' \
--form 'chat_id=<string>' \
--form 'content=<string>' \
--form 'message_uid=<string>' \
--form 'quote_id=<string>' \
--form 'files=<string>' \
--form 'event_id=<string>' \
--form files.0.items='@example-file'import requests
url = "https://api.decodahealth.com/comms/chat/send-message"
files = { "files.0.items": ("example-file", open("example-file", "rb")) }
payload = {
"sender_id": "<string>",
"chat_id": "<string>",
"content": "<string>",
"message_uid": "<string>",
"quote_id": "<string>",
"files": "<string>",
"event_id": "<string>"
}
headers = {
"TENANT": "<tenant>",
"API-KEY": "<api-key>"
}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('sender_id', '<string>');
form.append('chat_id', '<string>');
form.append('content', '<string>');
form.append('message_uid', '<string>');
form.append('quote_id', '<string>');
form.append('files', '<string>');
form.append('event_id', '<string>');
form.append('files.0.items', '{
"fileName": "example-file"
}');
const options = {method: 'POST', headers: {TENANT: '<tenant>', 'API-KEY': '<api-key>'}};
options.body = form;
fetch('https://api.decodahealth.com/comms/chat/send-message', 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.decodahealth.com/comms/chat/send-message",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"sender_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"chat_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"content\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"message_uid\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"quote_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"event_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files.0.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"API-KEY: <api-key>",
"Content-Type: multipart/form-data",
"TENANT: <tenant>"
],
]);
$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.decodahealth.com/comms/chat/send-message"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"sender_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"chat_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"content\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"message_uid\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"quote_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"event_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files.0.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("TENANT", "<tenant>")
req.Header.Add("API-KEY", "<api-key>")
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.decodahealth.com/comms/chat/send-message")
.header("TENANT", "<tenant>")
.header("API-KEY", "<api-key>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"sender_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"chat_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"content\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"message_uid\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"quote_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"event_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files.0.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.decodahealth.com/comms/chat/send-message")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["TENANT"] = '<tenant>'
request["API-KEY"] = '<api-key>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"sender_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"chat_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"content\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"message_uid\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"quote_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"event_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files.0.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"chatId": "<string>",
"sender": {
"id": "<string>",
"firstName": "<string>",
"lastName": "<string>",
"phoneNumber": "<string>",
"email": "<string>",
"locationId": "<string>"
},
"createdDate": "2023-11-07T05:31:56Z",
"messageUid": "<string>",
"content": "<string>",
"errorMessage": "<string>",
"sendoMessageId": "<string>",
"functionCall": {},
"files": [],
"suggestedMessages": [
{
"id": "<string>",
"chatId": "<string>",
"fromMessageId": "<string>",
"content": "<string>",
"assistantId": "<string>",
"isSelected": true,
"createdDate": "2023-11-07T05:31:56Z"
}
],
"toolCalls": [
{
"id": "<string>",
"toolName": "<string>",
"toolArguments": {},
"createdDate": "2023-11-07T05:31:56Z",
"callId": "<string>",
"messageId": "<string>",
"alertId": "<string>",
"toolCallId": "<string>",
"result": {},
"toolCallDescription": "<string>",
"hasBeenCalled": false
}
],
"eventId": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Headers
The tenant you are making this request on behalf of
Your api key
Body
multipart/form-data
Response
Successful Response
Available options:
CREATED, QUEUED, SCHEDULED, SENDING, SENT, UNDELIVERED, DELIVERED, READ, FAILED, EXPIRED, OPTED_OUT Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Available options:
REMINDER, OVERRIDE, FOLLOW_UP, EXPIRED, CONFIRMATION, INTRODUCTORY, CANCELLED, UPDATE ⌘I
