Zum Hauptinhalt springen

Automate with n8n

Connect heycreo to the hundreds of apps n8n works with: a new row in a content plan, a product in your shop or a form entry becomes a finished design, and the file goes on to Slack, e-mail or your CMS.

There are two ways, and you can combine them:

  • An AI agent with heycreo as a tool. The agent reads the request in plain words, picks a template and fills it. Good when every request is a little different.
  • Fixed steps without AI. HTTP requests to the REST API do exactly the same thing every time. Good for a known template and structured data.

You need n8n 1.122 or later, cloud or self-hosted, and a heycreo API key of a service account, from Settings → Developers → Service accounts. For the AI agent below, MCP must be allowed for it (it is by default), with the toolsets the agent uses.

1. Create the credential​

In n8n, create a credential of type Multiple Headers Auth with two headers:

NameValue
AuthorizationBearer heycreo_…
X-heycreo-Orgyour workspace's slug, the name in its address: app.heycreo.io/<slug>/…

Name it "heycreo". Both kinds of workflow below use it.

2. An agent that makes designs​

The workflow: a trigger, an AI Agent with a chat model and heycreo as its tool, then wherever the result should go.

  1. Trigger. For example Google Sheets → On row added on your content plan, with columns such as Channel, Headline and Text.

  2. AI Agent. Set the Prompt to the row, for example:

    Prompt
    Create a {{ $json.Channel }} design. Headline: {{ $json.Headline }}.
    Text: {{ $json.Text }}. Export it and answer only with the file's link.

    Under Options → System Message:

    System Message
    You create marketing material in heycreo. Always start from one of the
    workspace's templates. Never invent colors, fonts or logos.
  3. Chat Model on the agent: any model n8n offers, for example Anthropic Chat Model.

  4. Tool on the agent: MCP Client Tool with

    FieldValue
    Endpointhttps://app.heycreo.io/api/mcp
    Server TransportHTTP Streamable
    AuthenticationMultiple Headers Auth, credential "heycreo"
    Tools to IncludeSelected: get-templates, create-template-design, set-template-design-controls, studio-export, get-exports
    Options → Timeout120000
  5. Output. Pass {{ $json.output }}, the agent's answer with the link, to Slack, Gmail or a column in the same sheet.

Selecting the tools keeps the agent to what this workflow is for: it can make and export designs, but cannot delete, publish or change settings. In the agent's tools panel you can also require a person's approval before a tool runs.

3. Fixed steps without AI​

When the template is always the same, use HTTP Request nodes. They need no AI and cost nothing per run. In each node, set Authentication to Generic Credential Type → Bearer Auth with the heycreo API key; the workspace is part of the URL here, so no second header is needed.

  1. Create the design. An HTTP Request node named Create the design, method POST, URL https://app.heycreo.io/api/organizations/ORGANIZATION_ID/posts, Send Body with Body Content Type JSON and Using JSON. Switch the JSON field to Expression so the {{ }} parts are filled in:

    Body
    {
    "name": "{{ $json.Headline }}",
    "templateId": "TEMPLATE_ID",
    "sizes": ["instagram-post"],
    "scopedValues": [
    {
    "kind": "control",
    "scope": {},
    "controlId": "HEADLINE_CONTROL_ID",
    "value": { "valueType": "text", "value": "{{ $json.Headline }}" }
    }
    ]
    }
  2. Start the export. HTTP Request, method POST, URL https://app.heycreo.io/api/organizations/ORGANIZATION_ID/posts/{{ $json.id }}/exports, body {}.

  3. Collect the file, in one of two ways:

    • Wait a minute, then HTTP Request GET …/posts/{{ $('Create the design').item.json.id }}/exports and read imageUrl or videoUrl of the export whose status is completed.
    • Better for videos: a second workflow that starts with a Webhook node and receives heycreo's export.completed event. See below.

Create and export a design explains the request bodies and where the IDs come from.

4. Receive heycreo's events​

A workflow can start when heycreo reports that something is done: an export rendered, a file uploaded, a post published.

  1. Add a Webhook node: HTTP Method POST, a Path such as heycreo, Respond Immediately. Turn on Options → Raw Body if you check the signature (below).
  2. Publish the workflow and copy its Production URL.
  3. In heycreo, open the service account under Settings → Developers → Service accounts and, on its Webhooks tab, add that URL as an endpoint and subscribe to the events you need, for example export.completed.
  4. After the Webhook node, an If or Switch node on {{ $json.body.type }} routes the events; the file of a finished export is in {{ $json.body.data.export.videoUrl }} or imageUrl.

heycreo signs every delivery. To reject requests that do not come from heycreo, check the signature in a Code node as shown in Webhooks. On self-hosted n8n, the Code node may only use Node's crypto module once NODE_FUNCTION_ALLOW_BUILTIN=crypto is set.

See also​