{
  "name": "AI Content Generator with Review Queue",
  "nodes": [
    {
      "id": "wh-001",
      "name": "Invokati Dashboard Trigger",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2.1,
      "position": [-800, 0],
      "parameters": {
        "httpMethod": "POST",
        "path": "ai-content-trigger",
        "options": {}
      }
    },
    {
      "id": "ai-001",
      "name": "Generate Content with Claude",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "typeVersion": 1,
      "position": [-600, 0],
      "parameters": {
        "model": "claude-3-5-sonnet-20241022",
        "messages": {
          "values": [
            {
              "role": "user",
              "content": "Write a professional social media post about: ={{$json.body.topic}}. Tone: ={{$json.body.tone || 'professional'}}. Max 280 characters."
            }
          ]
        }
      }
    },
    {
      "id": "token-001",
      "name": "Log Token Usage",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [-400, 0],
      "parameters": {
        "method": "POST",
        "url": "={{$env.INVOKATI_URL}}/api/token-usage",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [{ "name": "X-API-Key", "value": "={{$env.INVOKATI_API_KEY}}" }]
        },
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            { "name": "workflow_id", "value": "={{$workflow.id}}" },
            { "name": "execution_id", "value": "={{$execution.id}}" },
            { "name": "model_id", "value": "claude-3-5-sonnet-20241022" },
            { "name": "input_tokens", "value": "={{$('Generate Content with Claude').item.json.usage?.input_tokens || 0}}" },
            { "name": "output_tokens", "value": "={{$('Generate Content with Claude').item.json.usage?.output_tokens || 0}}" }
          ]
        }
      }
    },
    {
      "id": "media-001",
      "name": "Post to Media Hub for Review",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [-200, 0],
      "parameters": {
        "method": "POST",
        "url": "={{$env.INVOKATI_URL}}/api/media",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [{ "name": "X-API-Key", "value": "={{$env.INVOKATI_API_KEY}}" }]
        },
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            { "name": "title", "value": "={{$json.body?.topic || 'Generated Content'}}" },
            { "name": "media_type", "value": "document" },
            { "name": "description", "value": "={{$('Generate Content with Claude').item.json.content[0]?.text}}" },
            { "name": "workflow_id", "value": "={{$workflow.id}}" },
            { "name": "execution_id", "value": "={{$execution.id}}" },
            { "name": "human_interaction", "value": "true" },
            { "name": "automation_status", "value": "pending" }
          ]
        }
      }
    },
    {
      "id": "respond-001",
      "name": "Respond to Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [0, 0],
      "parameters": {
        "respondWith": "json",
        "responseBody": "={\"status\": \"queued_for_review\", \"execution_id\": \"={{$execution.id}}\"}"
      }
    }
  ],
  "connections": {
    "Invokati Dashboard Trigger": { "main": [[{ "node": "Generate Content with Claude", "type": "main", "index": 0 }]] },
    "Generate Content with Claude": { "main": [[{ "node": "Log Token Usage", "type": "main", "index": 0 }]] },
    "Log Token Usage": { "main": [[{ "node": "Post to Media Hub for Review", "type": "main", "index": 0 }]] },
    "Post to Media Hub for Review": { "main": [[{ "node": "Respond to Webhook", "type": "main", "index": 0 }]] }
  },
  "settings": { "executionOrder": "v1" },
  "meta": { "instanceId": "invokati-example" }
}
