Ricevi email: lettura
Get Thread
Apri un'intera conversazione: il riepilogo e ogni messaggio in ordine cronologico, facoltativamente con i corpi.
https://g.sendcorex.com/v1command: get_threadArgomenti
thread_idstringfacoltativoL'id della conversazione.
idstringfacoltativoL'id di qualsiasi messaggio della conversazione. Usa questo o
thread_id.include_bodybooleanfacoltativotrueaggiungebody(htmletext) a ogni messaggio.
Avvio rapido
import axios from 'axios';
const response = await axios.post(
'https://g.sendcorex.com/v1',
{
commands: [
{
command: "get_thread",
args: {
id: "Vj0xQUJDMTIz",
include_body: true
}
}
]
},
{ headers: { Authorization: process.env.SENDCOREX_TOKEN } },
);
const [result] = response.data.results;
if (result.type !== 'SUCCESS') throw new Error(`${result.code}: ${result.message}`);
console.log(result.data);Risposta
{
"type": "SUCCESS",
"results": [
{
"command": "get_thread",
"id": "0",
"type": "SUCCESS",
"data": {
"thread": {
"thread_id": "thr_9a1c4e72",
"subject": "Invoice for September",
"participants": [
"ana@client.com",
"you@yourdomain.com"
],
"last_senders": [
"ana@client.com"
],
"message_count": 2,
"unread_count": 1,
"folders": [
"INBOX",
"Sent"
]
},
"messages": [
{
"message_uid": "Vj0xQUJDMDA5",
"message_id": "<4c1d…@mail.client.com>",
"in_reply_to": null,
"parent_uid": null,
"depth": 0,
"folders": [
"INBOX"
],
"from_name": "Ana Costa",
"from_email": "ana@client.com",
"direction": "inbound",
"to": [
{
"email": "you@yourdomain.com"
}
],
"reply_to": [],
"subject": "Invoice for September",
"preview": "Hi, attached is the invoice for September…",
"is_read": true,
"is_starred": false,
"is_important": false,
"has_attachments": false,
"received_at": "2026-10-09T09:02:41Z",
"body": {
"html": "<p>Hi, attached is the invoice for September.</p>",
"text": "Hi, attached is the invoice for September."
}
}
]
}
}
]
}Campi della risposta
threadIl riepilogo della conversazione:
thread_id,subject,participants,last_senders,message_count,unread_countefolders.messages[]Messaggi in ordine cronologico.
messages[].message_uid / message_idL'id nella casella e il Message-ID SMTP.
messages[].in_reply_to / parent_uid / depthDove si trova il messaggio nell'albero delle risposte.
messages[].directioninboundooutbound.messages[].from_name / from_email / to / reply_toDati della busta.
messages[].subject / previewOggetto e anteprima.
messages[].is_read / is_starred / is_important / has_attachmentsStato del messaggio.
messages[].received_atQuando il messaggio è stato ricevuto o inviato.
messages[].bodySolo con
include_body: true:{ html, text }.
Errori
Gli errori a livello HTTP restituiscono type, code e message. Gli errori marcati CMD tornano dentro il risultato del comando, con HTTP 200.
- 401
TOKEN_EXPIREDL'access token è scaduto. Chiama Refresh Token e ripeti la richiesta.
- 401
INVALID_TOKENIl token è malformato, sconosciuto o revocato.
- 429
RATE_LIMITEDPiù di 15 richieste/s o 15 in corso per la stessa IP + casella. Attendi i secondi indicati in Retry-After.
- CMD
INVALID_ARGSUn argomento obbligatorio manca o non è valido.
- CMD
NOT_FOUNDIl messaggio, il thread o la cartella non esiste per questo token.
- CMD
INTERNALErrore del server. Il dettaglio viene scritto solo nel log del server.