{
  "name": "Webhook to Layerre: generate images and post to Slack",
  "nodes": [
    {
      "id": "c639d949-8bc9-44e4-a9a5-582e07c8bc43",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        560,
        480
      ],
      "parameters": {
        "path": "layerre-image",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 2
    },
    {
      "id": "8e201086-1ffa-4805-ad51-82962d587a69",
      "name": "Workflow Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "parameters": {
        "width": 464,
        "height": 728,
        "content": "## Webhook \u2192 Layerre \u2192 Slack\n\nGenerate a custom image from incoming webhook data (e.g. form submissions, Typeform, Tally, or custom API) and post the result to a Slack channel.\n\n### How it works\n1. **Webhook**: Receives POST with JSON body (e.g. `{\"name\": \"Jane\", \"imageUrl\": \"https://...\"}`)\n2. **Create Template** (run once manually): Create a Layerre template from your Canva design, then select it in the variant node\n3. **Create Variant**: On each webhook, build one variant using body fields\n4. **Slack**: Post the rendered image URL (or message) to a channel\n\n### Prerequisites\n- [Layerre account](https://layerre.com) with API key\n- Canva design with customizable layers\n- Slack workspace and app (incoming webhook or Bot token)\n\n### Customization\n- Map webhook body fields to your Canva layer IDs in the Create Variant node\n- Use Respond to Webhook to return the image URL in the HTTP response\n- Add error handling or rate limiting as needed\n\n### Resources\n- [Layerre Documentation](https://layerre.com/docs)\n- [Layerre n8n Node](https://github.com/layerre/n8n-nodes-layerre)"
      },
      "typeVersion": 1
    },
    {
      "id": "fa8110f5-1de8-4f4f-b140-e2b15baae38e",
      "name": "Step 1 Instructions",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        800,
        192
      ],
      "parameters": {
        "color": 7,
        "width": 320,
        "height": 200,
        "content": "## Step 1: Create Template (one-time, run manually)\n\nRun this node once: paste your Canva design URL and execute. Then in **Create Variant from Webhook**, select that template from the **Template** dropdown. This node is not in the webhook path."
      },
      "typeVersion": 1
    },
    {
      "id": "37fbde2c-176f-49fe-958c-113f9b3a7be7",
      "name": "Step 2 Instructions",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1248,
        160
      ],
      "parameters": {
        "color": 7,
        "width": 360,
        "height": 260,
        "content": "## Step 2: Create Variant from webhook body\n\nSelect your template from the **Template** dropdown (from Step 1). Map webhook JSON fields to your Canva layers. Example body: `{\"name\": \"Jane\", \"photoUrl\": \"https://...\"}`. Overrides use `$json.body.name` and `$json.body.photoUrl`."
      },
      "typeVersion": 1
    },
    {
      "id": "221887f0-fac1-4f31-a278-f31e896c74bc",
      "name": "Step 3 Instructions",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1712,
        192
      ],
      "parameters": {
        "color": 7,
        "width": 340,
        "height": 200,
        "content": "## Step 3: Post to Slack\n\nSend the rendered image URL (or a message) to a Slack channel. Configure your Slack credentials and channel."
      },
      "typeVersion": 1
    },
    {
      "id": "6deff95d-1215-4201-96fa-46d0ebc74005",
      "name": "Post to Slack",
      "type": "n8n-nodes-base.slack",
      "position": [
        1792,
        480
      ],
      "parameters": {
        "text": "=New image: {{ $json.url }}\n",
        "user": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultName": ""
        },
        "select": "user",
        "otherOptions": {}
      },
      "credentials": {},
      "typeVersion": 2.2
    },
    {
      "id": "457b746b-95b3-440b-8550-9198de09b055",
      "name": "Respond to Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        2048,
        480
      ],
      "parameters": {
        "options": {},
        "respondWith": "json",
        "responseBody": "={{ { \"success\": true, \"imageUrl\": $json.renderedImageUrl || $json.imageUrl } }}"
      },
      "typeVersion": 1.1
    },
    {
      "id": "3d39edd6-bebc-4336-b46c-43ff5dd0b7f9",
      "name": "Create a template",
      "type": "n8n-nodes-layerre.layerre",
      "position": [
        928,
        480
      ],
      "parameters": {
        "canvaUrl": "",
        "requestOptions": {}
      },
      "credentials": {},
      "typeVersion": 1
    },
    {
      "id": "18a89aaf-85c7-40f9-91cf-f550043b0915",
      "name": "Create a variant",
      "type": "n8n-nodes-layerre.layerre",
      "position": [
        1376,
        480
      ],
      "parameters": {
        "resource": "variant",
        "overrides": {
          "override": [
            {
              "layerId": "",
              "overrideOptions": {
                "text": "={{ $json.body.name }}"
              }
            },
            {
              "layerId": "",
              "overrideOptions": {
                "imgUrl": "={{ $json.body.imageUrl }}"
              }
            }
          ]
        },
        "templateId": "={{ $('Create a template').item.json.id }}",
        "requestOptions": {},
        "variantDimensions": {}
      },
      "credentials": {},
      "typeVersion": 1
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Create a template",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Post to Slack": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create a variant": {
      "main": [
        [
          {
            "node": "Post to Slack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create a template": {
      "main": [
        [
          {
            "node": "Create a variant",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}