Edit Generated Message
curl --request PATCH \
--url https://app.puffle.ai/api/campaigns/{id}/generate-messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"message_id": "<string>",
"subject": "<string>",
"body_text": "<string>"
}
'import requests
url = "https://app.puffle.ai/api/campaigns/{id}/generate-messages"
payload = {
"message_id": "<string>",
"subject": "<string>",
"body_text": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({message_id: '<string>', subject: '<string>', body_text: '<string>'})
};
fetch('https://app.puffle.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.puffle.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 => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'message_id' => '<string>',
'subject' => '<string>',
'body_text' => '<string>'
]),
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.puffle.ai/api/campaigns/{id}/generate-messages"
payload := strings.NewReader("{\n \"message_id\": \"<string>\",\n \"subject\": \"<string>\",\n \"body_text\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://app.puffle.ai/api/campaigns/{id}/generate-messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"message_id\": \"<string>\",\n \"subject\": \"<string>\",\n \"body_text\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.puffle.ai/api/campaigns/{id}/generate-messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"message_id\": \"<string>\",\n \"subject\": \"<string>\",\n \"body_text\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"message": {
"id": "<string>",
"campaign_id": "<string>",
"prospect_id": "<string>",
"node_id": "<string>",
"subject": "<string>",
"body_text": "<string>",
"manually_edited": true,
"created_at": "2023-11-07T05:31:56Z",
"body_html": "<string>"
}
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Outbound Messages
Edit Generated Message
Update a generated campaign message
PATCH
/
api
/
campaigns
/
{id}
/
generate-messages
Edit Generated Message
curl --request PATCH \
--url https://app.puffle.ai/api/campaigns/{id}/generate-messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"message_id": "<string>",
"subject": "<string>",
"body_text": "<string>"
}
'import requests
url = "https://app.puffle.ai/api/campaigns/{id}/generate-messages"
payload = {
"message_id": "<string>",
"subject": "<string>",
"body_text": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({message_id: '<string>', subject: '<string>', body_text: '<string>'})
};
fetch('https://app.puffle.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.puffle.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 => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'message_id' => '<string>',
'subject' => '<string>',
'body_text' => '<string>'
]),
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.puffle.ai/api/campaigns/{id}/generate-messages"
payload := strings.NewReader("{\n \"message_id\": \"<string>\",\n \"subject\": \"<string>\",\n \"body_text\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://app.puffle.ai/api/campaigns/{id}/generate-messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"message_id\": \"<string>\",\n \"subject\": \"<string>\",\n \"body_text\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.puffle.ai/api/campaigns/{id}/generate-messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"message_id\": \"<string>\",\n \"subject\": \"<string>\",\n \"body_text\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"message": {
"id": "<string>",
"campaign_id": "<string>",
"prospect_id": "<string>",
"node_id": "<string>",
"subject": "<string>",
"body_text": "<string>",
"manually_edited": true,
"created_at": "2023-11-07T05:31:56Z",
"body_html": "<string>"
}
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}CLI:
puffle campaign generate-message update --id <id> --message-id <message-id>
puffle campaign generate-message update --id <id> --message-id <message-id> --subject <subject> --body-text <body-text>
Overview
Edits one generated email draft inside a campaign. The path identifies the campaign, and the body identifies the generated message withmessage_id.
Send subject, body_text, or both. When the plaintext body changes, Puffle preserves any previously saved custom HTML suffix instead of rebuilding the entire message from scratch.
AI agent notes
Use this only after the human approves a concrete edit to a draft generated email. Do not use it to regenerate all messages or to send a message. If the target message is already pending or sent, surface the validation error instead of retrying with the same payload.Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Campaign UUID
Response
Draft generated message updated successfully.
Show child attributes
Show child attributes
Was this page helpful?
⌘I