Automation Drafts
With UmbSocial Pro licensed, an automation can write posts. The Create social draft action (umbsocial.createDraft, in the UmbSocial group) creates a post from what the automation knows, for example a newly published article, and leaves it for a person. The automation never schedules or publishes anything.
What the post becomes
Section titled “What the post becomes”| Approvals | The post is |
|---|---|
| On | Awaiting approval: approvers are told as for any submission (notification and the Submitted webhook, from the system), and an approver schedules it or returns it. |
| Off | A plain draft: someone with the Schedule permission schedules it. |
Either way the post is marked as coming from an automation (or, with Written by AI on, as AI’s: see Drafts from an AI agent) and has no author, so any approver may approve it (the rule against approving your own post doesn’t apply). Its History tab starts with a Created entry from the system.
Settings
Section titled “Settings”All settings take bindings, for example ${ trigger.contentName }.
| Setting | Use |
|---|---|
Text (text) |
The post’s text. Required. |
Link URL (linkUrl) |
An https link to attach. |
Link title (linkTitle), Link description (linkDescription) |
The link card’s title and description. |
Media key (mediaKey) |
The key of an image in the media library. |
Image alt text (imageAltText) |
The image’s alt text. |
Channels (channels) |
Channel keys separated by commas. Empty means every enabled channel. |
Per-channel text (perChannel) |
Each channel’s own text, as JSON: [{"channelKey": "…", "text": "…"}]. Each channel must be one the post goes to. A channel that is left out, or whose text is blank, uses the post’s text. |
Written by AI (fromAi) |
Turn this on when any field is bound to an AI agent’s output. It’s a switch, not a binding. |
Output: postKey, the new post’s key.
Text is stored exactly as it arrives. Text that looks like a binding (${ … }) or a secret reference is never evaluated a second time.
When it fails
Section titled “When it fails”| Why | Category |
|---|---|
| UmbSocial Pro isn’t licensed. Nothing is created. | Configuration error |
| The text is empty or too long, the link isn’t https, a channel key isn’t a channel (the unknown keys are named), or any other check the editor makes. The error lists the codes. | Validation |
A channel’s own text is too long for its network, or perChannel isn’t valid JSON, names a channel twice, or names a channel the post doesn’t go to. |
Validation |
A Validation failure ends the step without a retry: retrying wouldn’t change the answer. Channels are checked as the composer checks them, so a channel must exist and not be removed or paused. A switched-off channel is accepted, as the composer accepts it; nothing is sent to it while it’s off.
Drafts from an AI agent
Section titled “Drafts from an AI agent”With Umbraco.AI and its Automate integration (Umbraco.AI.Automate) installed, an automation can ask an AI agent to write the post. The Run AI Agent action (umbracoAI.runAgent) runs the agent, and Create social draft turns its answer into a post. The UmbSocial AI add-on isn’t needed for this: the agent is your own, and UmbSocial only stores what it wrote.
Text written by AI is always reviewed
Section titled “Text written by AI is always reviewed”Turn on Written by AI whenever a field is bound to the agent’s output. UmbSocial can’t tell where a bound value came from, so the automation has to say. The post is then marked as AI’s, as if someone had used Draft with AI in the composer:
- It always waits for review, as Awaiting approval, whether approvals are on or off. Approvers are told about it, as for any submission.
- Only a person who may review AI’s text can put it on the calendar: someone with Approve, or, while approvals are off, someone with Schedule. The button reads Review and schedule.
- An automation is never a reviewer, and nor is an API user.
- The post’s History starts with Created and AI used, both from the system, and later names the person who reviewed it.
If you leave Written by AI off, the post is an ordinary automation draft, and nothing makes anyone review AI’s text before it goes out.
The agent
Section titled “The agent”Give the agent an output schema, so it answers in JSON that the action can read. This schema matches what Draft with AI produces:
{ "type": "object", "properties": { "text": { "type": "string", "description": "The post's text." }, "perChannel": { "type": "array", "description": "A channel's own version, only where its network needs one.", "items": { "type": "object", "properties": { "channelKey": { "type": "string", "description": "The channel's key, from the list in the message." }, "text": { "type": "string" } }, "required": ["channelKey", "text"] } }, "linkTitle": { "type": "string" }, "linkDescription": { "type": "string" }, "altText": { "type": "string", "description": "Describes the image for people who can't see it." } }, "required": ["text"]}Run AI Agent always outputs the raw answer as response. When the answer is a JSON object, each of its properties can also be bound, by name.
In the agent’s instructions, name each channel’s key and network, and give its character limit. The action checks each text against its network’s limit exactly as the composer does, and a text that’s too long fails the step rather than being cut short.
An example automation
Section titled “An example automation”- Trigger: Content published, for your article document type. It outputs the page’s key and name (
contentKey,contentName), not its URL. - Get Content (alias
article), with Content Key${ trigger.contentKey }. It outputs the page’sname,urlandproperties. - Run AI Agent (alias
agent), with this message:Write a social post for this article: ${ steps.article.name }, https://www.example.com${ steps.article.url }. Channels: 3f1c…-… (Bluesky, 300 characters), 9a2e…-… (LinkedIn, 3,000 characters). - Create social draft:
| Setting | Value |
|---|---|
| Text | ${ steps.agent.text } |
| Link URL | https://www.example.com${ steps.article.url } |
| Link title | ${ steps.agent.linkTitle } |
| Link description | ${ steps.agent.linkDescription } |
| Media key | The image’s media key, if the post has one |
| Image alt text | ${ steps.agent.altText } |
| Channels | The same channel keys, separated by commas |
| Per-channel text | ${ steps.agent.perChannel | json } |
| Written by AI | On |
Get Content gives the page’s URL as Umbraco does, which is usually relative (/news/spring-sale/). The link must be a full https address, so put your site’s address in front of it, as above. If your site’s URLs are already absolute, bind ${ steps.article.url } on its own.
perChannel is a list, so it’s bound with the json filter, which writes it as the JSON the setting reads. A plain binding works for text values such as text.
Use the step aliases you gave your own steps, and the property names in your agent’s schema. The post then waits in the queue, awaiting approval, until someone who may review it schedules it. With the UmbSocial AI add-on installed, it’s also tagged AI draft, needs review.