Generate Messages
curl --request POST \
--url https://app.pixie.ai/api/campaigns/{id}/generate-messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"action": "resolve",
"prospect_offset": 0,
"count": 50
}
'import requests
url = "https://app.pixie.ai/api/campaigns/{id}/generate-messages"
payload = {
"action": "resolve",
"prospect_offset": 0,
"count": 50
}
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({action: 'resolve', prospect_offset: 0, count: 50})
};
fetch('https://app.pixie.ai/api/campaigns/{id}/generate-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://app.pixie.ai/api/campaigns/{id}/generate-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([
'action' => 'resolve',
'prospect_offset' => 0,
'count' => 50
]),
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://app.pixie.ai/api/campaigns/{id}/generate-messages"
payload := strings.NewReader("{\n \"action\": \"resolve\",\n \"prospect_offset\": 0,\n \"count\": 50\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://app.pixie.ai/api/campaigns/{id}/generate-messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"action\": \"resolve\",\n \"prospect_offset\": 0,\n \"count\": 50\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.pixie.ai/api/campaigns/{id}/generate-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 \"action\": \"resolve\",\n \"prospect_offset\": 0,\n \"count\": 50\n}"
response = http.request(request)
puts response.read_body{
"messages": [
{
"id": "<string>",
"campaign_id": "<string>",
"prospect_id": "<string>",
"node_id": "<string>",
"subject": "<string>",
"body_text": "<string>",
"status": "draft",
"manually_edited": true,
"created_at": "2023-11-07T05:31:56Z",
"body_html": "<string>"
}
]
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Outbound Messages
Generate Messages
Synchronously materialize ordinary recipient drafts while preserving AI personalization slots.
POST
/
api
/
campaigns
/
{id}
/
generate-messages
Generate Messages
curl --request POST \
--url https://app.pixie.ai/api/campaigns/{id}/generate-messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"action": "resolve",
"prospect_offset": 0,
"count": 50
}
'import requests
url = "https://app.pixie.ai/api/campaigns/{id}/generate-messages"
payload = {
"action": "resolve",
"prospect_offset": 0,
"count": 50
}
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({action: 'resolve', prospect_offset: 0, count: 50})
};
fetch('https://app.pixie.ai/api/campaigns/{id}/generate-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://app.pixie.ai/api/campaigns/{id}/generate-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([
'action' => 'resolve',
'prospect_offset' => 0,
'count' => 50
]),
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://app.pixie.ai/api/campaigns/{id}/generate-messages"
payload := strings.NewReader("{\n \"action\": \"resolve\",\n \"prospect_offset\": 0,\n \"count\": 50\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://app.pixie.ai/api/campaigns/{id}/generate-messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"action\": \"resolve\",\n \"prospect_offset\": 0,\n \"count\": 50\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.pixie.ai/api/campaigns/{id}/generate-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 \"action\": \"resolve\",\n \"prospect_offset\": 0,\n \"count\": 50\n}"
response = http.request(request)
puts response.read_body{
"messages": [
{
"id": "<string>",
"campaign_id": "<string>",
"prospect_id": "<string>",
"node_id": "<string>",
"subject": "<string>",
"body_text": "<string>",
"status": "draft",
"manually_edited": true,
"created_at": "2023-11-07T05:31:56Z",
"body_html": "<string>"
}
]
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}CLI:
pixie campaign generate-message --id <id> --action <action>
pixie campaign generate-message --id <id> --action <action> --count <count> --prospect-offset <prospect-offset>
Overview
This endpoint supports one POST action, selected by theaction field in the body:
resolve— synchronously resolves%variables%for ordinary sendable nodes and materializes recipient rows incampaign_prospect_messagesasdraft. For personalized email nodes, it prepares drafts from the saved skeleton and preserves$ai {instruction}$slots for the outbound copy operations. Manually edited rows are preserved; template changes flow through to unedited rows.
draft status. Legacy generate_ai generation is not supported by this endpoint.
AI agent notes
resolve is safe to re-run. It upserts on (campaign_id, prospect_id, node_id) and excludes manually-edited rows from the upsert — template changes propagate without clobbering user customizations. If the “find edited messages” query itself fails, the server falls back to ignoreDuplicates: true for the whole batch to avoid silently overwriting edits.AI copy is a separate operation. resolve does not seed recipient drafts from legacy generated_examples and does not ask a copywriter to fill personalization. Use pixieAgent.previewOutboundCopy to fill a reusable preview for up to five recipients, then use pixieAgent.writeOutboundCopy after explicit user approval to fill every remaining $ai {instruction}$ slot. Previewed copy and manual edits are preserved.Check status before launch. Use pixieAgent.getOutboundCopyStatus to determine whether copy is ready, needs_generation, or needs_attention. A needs_attention response can include copywriterError; surface it and retry the copy operation after correcting any manually unresolved slot. For reading the draft outbox or inline-editing one message, use GET or PATCH on this same campaign messages path.Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Campaign UUID
Body
application/json
Synchronously materializes ordinary draft messages. $ai {prompt}$ personalization slots are preserved for pixieAgent.previewOutboundCopy and pixieAgent.writeOutboundCopy.
Response
Messages were resolved or AI generation was queued.
Show child attributes
Show child attributes
Was this page helpful?