curl --request POST \
--url https://api.getoneprofile.ai/inbox/drafts/ \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"thread_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"steer_text": "<string>"
}
'import requests
url = "https://api.getoneprofile.ai/inbox/drafts/"
payload = {
"thread_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"steer_text": "<string>"
}
headers = {
"X-API-Key": "<api-key>",
"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>', 'Content-Type': 'application/json'},
body: JSON.stringify({thread_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a', steer_text: '<string>'})
};
fetch('https://api.getoneprofile.ai/inbox/drafts/', 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.getoneprofile.ai/inbox/drafts/",
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([
'thread_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'steer_text' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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.getoneprofile.ai/inbox/drafts/"
payload := strings.NewReader("{\n \"thread_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"steer_text\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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.getoneprofile.ai/inbox/drafts/")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"thread_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"steer_text\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getoneprofile.ai/inbox/drafts/")
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["Content-Type"] = 'application/json'
request.body = "{\n \"thread_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"steer_text\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"created_at": "2023-11-07T05:31:56Z",
"detail": "<string>",
"draft": {
"body_text": "<string>",
"confidence": "high",
"confidence_reason": "<string>",
"generated_body_text": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"source": "auto_drafted",
"status": "pending_approval",
"steer_text": "<string>",
"subject": "<string>",
"thread_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"ask_reason": "low_confidence",
"channel": "email",
"confidence_score": 123,
"hand_edited": false,
"in_reply_to_message_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"learning_subject_key": "<string>",
"mailbox_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"newer_reply_message_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"outbound_message_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"rating": "good",
"rewriting": false,
"rewritten_for_learning": "<string>",
"rewritten_for_learning_removed": false,
"send_after": "2023-11-07T05:31:56Z",
"send_outcome": "as_written",
"sent_by_kind": "person",
"set_aside_because": "newer_reply"
},
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"kept_for_this_conversation": [
"<string>"
],
"kind": "answers",
"not_saved": [
{
"question_id": "<string>",
"reason": "names_contact"
}
],
"status": "queued",
"thread_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"updated_at": "2023-11-07T05:31:56Z"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>",
"issues": [
{
"input": "<string>",
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}Generate a reply draft
Write a reply to the conversation’s latest message for a person to approve. The conversation’s sequence’s agent writes it, exactly as it would answer on its own, and the reply waits for a person. A conversation outside every sequence has no agent, and is refused with 409. steer_text is a one-line instruction for this reply. Refused with 409 at once when the agent may not write it now (writing paused, its spending limit, not enough credits), the detail saying why.
Accepted with 202 and written in the background: read the run at GET /inbox/draft-runs/{run_id}/ every second or so until it is drafted, with the reply in draft, or ends without one, detail saying why (nothing usable was written, rather than filler).
curl --request POST \
--url https://api.getoneprofile.ai/inbox/drafts/ \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"thread_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"steer_text": "<string>"
}
'import requests
url = "https://api.getoneprofile.ai/inbox/drafts/"
payload = {
"thread_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"steer_text": "<string>"
}
headers = {
"X-API-Key": "<api-key>",
"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>', 'Content-Type': 'application/json'},
body: JSON.stringify({thread_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a', steer_text: '<string>'})
};
fetch('https://api.getoneprofile.ai/inbox/drafts/', 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.getoneprofile.ai/inbox/drafts/",
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([
'thread_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'steer_text' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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.getoneprofile.ai/inbox/drafts/"
payload := strings.NewReader("{\n \"thread_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"steer_text\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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.getoneprofile.ai/inbox/drafts/")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"thread_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"steer_text\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getoneprofile.ai/inbox/drafts/")
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["Content-Type"] = 'application/json'
request.body = "{\n \"thread_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"steer_text\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"created_at": "2023-11-07T05:31:56Z",
"detail": "<string>",
"draft": {
"body_text": "<string>",
"confidence": "high",
"confidence_reason": "<string>",
"generated_body_text": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"source": "auto_drafted",
"status": "pending_approval",
"steer_text": "<string>",
"subject": "<string>",
"thread_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"ask_reason": "low_confidence",
"channel": "email",
"confidence_score": 123,
"hand_edited": false,
"in_reply_to_message_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"learning_subject_key": "<string>",
"mailbox_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"newer_reply_message_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"outbound_message_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"rating": "good",
"rewriting": false,
"rewritten_for_learning": "<string>",
"rewritten_for_learning_removed": false,
"send_after": "2023-11-07T05:31:56Z",
"send_outcome": "as_written",
"sent_by_kind": "person",
"set_aside_because": "newer_reply"
},
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"kept_for_this_conversation": [
"<string>"
],
"kind": "answers",
"not_saved": [
{
"question_id": "<string>",
"reason": "names_contact"
}
],
"status": "queued",
"thread_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"updated_at": "2023-11-07T05:31:56Z"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>",
"issues": [
{
"input": "<string>",
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}Body
Response
Successful Response
A reply being written in the background for a person who asked for it, and its end.
Where it stands. queued and writing: the agent has not finished; read it again in a second or so. drafted: draft waits for a person in Needs approval. no_draft: nothing usable was written, detail says so, and a card's questions are still open. refused: the agent could not write it now (credits, its sequence's limit, writing paused, the contact on do-not-contact), detail says why. failed: the writing stopped; try again.
queued, writing, drafted, no_draft, refused, failed Was this page helpful?