Skip to content

Docs

create_content_from_template

Create draft content from a template (list_templates): the title from its title pattern, the original draft from its text, its campaign labels, and one draft post per target channel account with that channel's text (or the original draft). `values` fills the {placeholders} by name, e.g. `{"product": "Orbit 2.0"}`; one without a value stays as typed and is listed in `unfilledPlaceholders`: edit it before scheduling. `title` overrides the title pattern. `channelAccountIds` limits the posts to some of the template's channels; a disconnected one is skipped (`skippedChannels`). Everything is a draft: nothing is scheduled or published; use request_schedule or add_to_queue next (a human confirms agent requests). Each post comes back with its validation `issues`.

Create draft content from a template (list_templates): the title from its title pattern, the original draft from its text, its campaign labels, and one draft post per target channel account with that channel's text (or the original draft). values fills the {placeholders} by name, e.g. {"product": "Orbit 2.0"}; one without a value stays as typed and is listed in unfilledPlaceholders: edit it before scheduling. title overrides the title pattern. channelAccountIds limits the posts to some of the template's channels; a disconnected one is skipped (skippedChannels). Everything is a draft: nothing is scheduled or published; use request_schedule or add_to_queue next (a human confirms agent requests). Each post comes back with its validation issues.

Access and cost

  • Kind: mutation
  • Scope: workspace
  • Actors: member, agent
  • Credits: Free
  • Requires confirmation: false
  • Accepts idempotency key: false

Input schema

{
  "properties": {
    "workspaceId": {
      "format": "uuid",
      "type": "string"
    },
    "templateId": {
      "format": "uuid",
      "type": "string"
    },
    "values": {
      "additionalProperties": {
        "type": "string"
      },
      "default": {},
      "propertyNames": {
        "pattern": "^[A-Za-z](?:[A-Za-z0-9 _-]{0,38}[A-Za-z0-9_-])?$",
        "type": "string"
      },
      "type": "object"
    },
    "title": {
      "maxLength": 300,
      "minLength": 1,
      "type": "string"
    },
    "status": {
      "default": "drafting",
      "enum": [
        "idea",
        "drafting",
        "in_review"
      ],
      "type": "string"
    },
    "plannedFor": {
      "anyOf": [
        {
          "format": "date",
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "channelAccountIds": {
      "items": {
        "format": "uuid",
        "type": "string"
      },
      "maxItems": 20,
      "type": "array"
    }
  },
  "required": [
    "workspaceId",
    "templateId"
  ],
  "type": "object"
}

Output schema

{
  "additionalProperties": false,
  "properties": {
    "piece": {
      "additionalProperties": false,
      "properties": {
        "id": {
          "format": "uuid",
          "type": "string"
        },
        "workspaceId": {
          "format": "uuid",
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "status": {
          "enum": [
            "idea",
            "drafting",
            "in_review",
            "scheduled",
            "published"
          ],
          "type": "string"
        },
        "campaignLabels": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "ownerAccountId": {
          "anyOf": [
            {
              "format": "uuid",
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "boardPosition": {
          "type": "string"
        },
        "archivedAt": {
          "anyOf": [
            {
              "format": "date-time",
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "createdByAccountId": {
          "anyOf": [
            {
              "format": "uuid",
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "createdByAgentClientId": {
          "anyOf": [
            {
              "format": "uuid",
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "createdAt": {
          "format": "date-time",
          "type": "string"
        },
        "updatedAt": {
          "format": "date-time",
          "type": "string"
        },
        "signoffRequired": {
          "type": "boolean"
        },
        "plannedFor": {
          "anyOf": [
            {
              "format": "date",
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "plannedTime": {
          "anyOf": [
            {
              "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "id",
        "workspaceId",
        "title",
        "status",
        "campaignLabels",
        "ownerAccountId",
        "boardPosition",
        "archivedAt",
        "createdByAccountId",
        "createdByAgentClientId",
        "createdAt",
        "updatedAt",
        "signoffRequired"
      ],
      "type": "object"
    },
    "master": {
      "additionalProperties": false,
      "properties": {
        "pieceId": {
          "format": "uuid",
          "type": "string"
        },
        "workspaceId": {
          "format": "uuid",
          "type": "string"
        },
        "text": {
          "type": "string"
        },
        "media": {
          "items": {
            "additionalProperties": false,
            "properties": {
              "mediaAssetId": {
                "format": "uuid",
                "type": "string"
              },
              "altText": {
                "maxLength": 2000,
                "type": "string"
              }
            },
            "required": [
              "mediaAssetId"
            ],
            "type": "object"
          },
          "type": "array"
        },
        "version": {
          "minimum": 1,
          "type": "integer"
        },
        "updatedByAccountId": {
          "anyOf": [
            {
              "format": "uuid",
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "updatedByAgentClientId": {
          "anyOf": [
            {
              "format": "uuid",
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "createdAt": {
          "format": "date-time",
          "type": "string"
        },
        "updatedAt": {
          "format": "date-time",
          "type": "string"
        }
      },
      "required": [
        "pieceId",
        "workspaceId",
        "text",
        "media",
        "version",
        "updatedByAccountId",
        "updatedByAgentClientId",
        "createdAt",
        "updatedAt"
      ],
      "type": "object"
    },
    "posts": {
      "items": {
        "additionalProperties": false,
        "properties": {
          "post": {
            "additionalProperties": false,
            "properties": {
              "id": {
                "format": "uuid",
                "type": "string"
              },
              "workspaceId": {
                "format": "uuid",
                "type": "string"
              },
              "pieceId": {
                "format": "uuid",
                "type": "string"
              },
              "channelAccountId": {
                "format": "uuid",
                "type": "string"
              },
              "format": {
                "pattern": "^[a-z][a-z0-9_]*$",
                "type": "string"
              },
              "segments": {
                "items": {
                  "additionalProperties": false,
                  "properties": {
                    "text": {
                      "type": "string"
                    },
                    "media": {
                      "items": {
                        "additionalProperties": false,
                        "properties": {
                          "mediaAssetId": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "altText": {
                            "maxLength": 2000,
                            "type": "string"
                          }
                        },
                        "required": [
                          "mediaAssetId"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "text",
                    "media"
                  ],
                  "type": "object"
                },
                "minItems": 1,
                "type": "array"
              },
              "settings": {
                "type": "object"
              },
              "state": {
                "enum": [
                  "draft",
                  "ready",
                  "awaiting_confirmation",
                  "scheduled",
                  "publishing",
                  "published",
                  "failed_retrying",
                  "needs_attention",
                  "failed",
                  "manual",
                  "removed"
                ],
                "type": "string"
              },
              "scheduledAt": {
                "anyOf": [
                  {
                    "format": "date-time",
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "scheduleSource": {
                "anyOf": [
                  {
                    "enum": [
                      "manual",
                      "queue",
                      "recurrence",
                      "evergreen"
                    ],
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "isSkipped": {
                "type": "boolean"
              },
              "version": {
                "minimum": 1,
                "type": "integer"
              },
              "followsOriginal": {
                "type": "boolean"
              },
              "followIssue": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "requestedByAgentClientId": {
                "anyOf": [
                  {
                    "format": "uuid",
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "confirmedByAccountId": {
                "anyOf": [
                  {
                    "format": "uuid",
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "confirmedAt": {
                "anyOf": [
                  {
                    "format": "date-time",
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "lastError": {
                "anyOf": [
                  {
                    "additionalProperties": false,
                    "properties": {
                      "code": {
                        "type": "string"
                      },
                      "message": {
                        "type": "string"
                      },
                      "fix": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "code",
                      "message"
                    ],
                    "type": "object"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "publishedAt": {
                "anyOf": [
                  {
                    "format": "date-time",
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "permalink": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdByAccountId": {
                "anyOf": [
                  {
                    "format": "uuid",
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "createdByAgentClientId": {
                "anyOf": [
                  {
                    "format": "uuid",
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "createdAt": {
                "format": "date-time",
                "type": "string"
              },
              "updatedAt": {
                "format": "date-time",
                "type": "string"
              }
            },
            "required": [
              "id",
              "workspaceId",
              "pieceId",
              "channelAccountId",
              "format",
              "segments",
              "settings",
              "state",
              "scheduledAt",
              "scheduleSource",
              "isSkipped",
              "version",
              "followsOriginal",
              "followIssue",
              "requestedByAgentClientId",
              "confirmedByAccountId",
              "confirmedAt",
              "lastError",
              "publishedAt",
              "permalink",
              "createdByAccountId",
              "createdByAgentClientId",
              "createdAt",
              "updatedAt"
            ],
            "type": "object"
          },
          "issues": {
            "items": {
              "additionalProperties": false,
              "properties": {
                "code": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                },
                "severity": {
                  "enum": [
                    "error",
                    "warning"
                  ],
                  "type": "string"
                },
                "segmentIndex": {
                  "minimum": 0,
                  "type": "integer"
                },
                "field": {
                  "type": "string"
                }
              },
              "required": [
                "code",
                "message",
                "severity"
              ],
              "type": "object"
            },
            "type": "array"
          }
        },
        "required": [
          "post",
          "issues"
        ],
        "type": "object"
      },
      "type": "array"
    },
    "skippedChannels": {
      "items": {
        "additionalProperties": false,
        "properties": {
          "channelAccountId": {
            "format": "uuid",
            "type": "string"
          },
          "reason": {
            "enum": [
              "disconnected",
              "not_selected"
            ],
            "type": "string"
          }
        },
        "required": [
          "channelAccountId",
          "reason"
        ],
        "type": "object"
      },
      "type": "array"
    },
    "unfilledPlaceholders": {
      "items": {
        "type": "string"
      },
      "type": "array"
    }
  },
  "required": [
    "piece",
    "master",
    "posts",
    "skippedChannels",
    "unfilledPlaceholders"
  ],
  "type": "object"
}

Errors

[
  "channel_unavailable"
]

Annotations

{
  "destructiveHint": false,
  "idempotentHint": false,
  "openWorldHint": false,
  "readOnlyHint": false,
  "title": "Create content from a template"
}