Skip to content

Add AI Block To Email Editor

Tool name: add-email-editor-ai-block

Adds an AI block (Smart Mail) to a column of an automation email: its text is generated per recipient from the instruction, the AI context and the data fields and tags named. Other emails are refused; foreign field or tag ids too. Every recipient then costs credits, see estimate-smart-mail-cost. Without the add-on the block is saved with a warning. Returns the new uuid. Revision-bound, atomic edit: put every change to one email into one call, never parallel calls; drafts only; publishing is publish-newsletter-email-content.

Input schema

editorUrlstring, [ 12 .. 500 ] charactersrequired

Editor URL of the email, as a read returned it

contentRevisionstring, [ 7 .. 100 ] charactersrequired

The contentRevision of the read this change is based on

columnUuidstring, [ 1 .. 100 ] charactersrequired

The uuid of the column the block goes into

promptstring, [ 1 .. 10000 ] charactersrequired

The instruction the text of this block is generated from, per recipient

namenull or string, <= 250 characters

What the editor shows for this block

Default:null
fieldIdsArray of strings, <= 100 items

Data field ids (search-custom-fields) the block may use; omit for those of the AI context

Default:null
tagIdsArray of integers, <= 100 items

Tag ids (search-tags) the block may use; omit for those of the AI context

Default:null
positionnull or integer, >= 0

Where it goes inside the column, counted from zero; omit to append

Default:null
accountIdnull or integer, >= 1

User ID of the account; omit for the account of the access token

Default:null
Input example
{ "editorUrl": "stringstring", "contentRevision": "strings", "columnUuid": "string", "prompt": "string", "name": null, "fieldIds": null, "tagIds": null, "position": null, "accountId": null }

Output schema

One of:
operationstringrequired

"replaced": the stored document is a new one; "unchanged": nothing was persisted.

Enum:"replaced""unchanged"
previousContentStatusstringrequired
Enum:"draft""published""unpublished_changes"
contentStatusstringrequired
Enum:"draft""published""unpublished_changes"
emailIdintegerrequired
contentRevisionstringrequired
warningsArray of stringsrequired
editorUrlstringrequired
createdArray of objectsrequired

What this write created, with uuids: after "addRow" the row and its columns, after "addModule" the block, plus the contentRevision the next write needs. Empty when nothing was created.

nextActionstringrequired

The content action still open: "review_and_publish_content" while the stored draft is not the dispatch content.

Enum:"review_and_publish_content""none"
Output example
{ "operation": "replaced", "previousContentStatus": "draft", "contentStatus": "draft", "emailId": 0, "contentRevision": "string", "warnings": [ "string" ], "editorUrl": "string", "created": [ { "operation": 0, "type": "row", "uuid": "string", "kind": "string", "columns": [ "string" ] } ], "nextAction": "review_and_publish_content" }