{
  "name": "UrlChart — chart PNG in a scheduled email",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "days",
              "daysInterval": 1,
              "triggerAtHour": 8,
              "triggerAtMinute": 0
            }
          ]
        }
      },
      "id": "3f1a8c02-6a55-4d4b-9a0e-55b0b8d5a101",
      "name": "Daily at 08:00",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [-320, 0],
      "notes": "Change the interval here. The workflow is inactive on import; activate it after step 5."
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "8f1f2a70-1111-4c4c-8999-000000000001",
              "name": "title",
              "value": "Weekly signups",
              "type": "string"
            },
            {
              "id": "8f1f2a70-1111-4c4c-8999-000000000002",
              "name": "labels",
              "value": "Mon,Tue,Wed,Thu",
              "type": "string"
            },
            {
              "id": "8f1f2a70-1111-4c4c-8999-000000000003",
              "name": "values",
              "value": "12,19,14,23",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "3f1a8c02-6a55-4d4b-9a0e-55b0b8d5a102",
      "name": "Chart data",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [-80, 0],
      "notes": "Replace the three values with data from a previous node, e.g. a Google Sheets or HTTP Request step."
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "8f1f2a70-2222-4c4c-8999-000000000004",
              "name": "chartUrl",
              "value": "=https://urlchart.com/chart?cht=bvg&chs=600x300&chd=t:{{ $json.values }}&chtt={{ encodeURIComponent($json.title) }}&chxl=0:%7C{{ $json.labels.replace(/,/g, '%7C') }}&chxt=x,y&chco=2f5fe0",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "3f1a8c02-6a55-4d4b-9a0e-55b0b8d5a103",
      "name": "Build chart URL",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [160, 0],
      "notes": "Add &key=uc_live_… before &chxt if you send from a paid account. Keep the URL encoded: no raw spaces."
    },
    {
      "parameters": {
        "url": "={{ $json.chartUrl }}",
        "options": {
          "response": {
            "response": {
              "responseFormat": "file",
              "outputPropertyName": "data"
            }
          }
        }
      },
      "id": "3f1a8c02-6a55-4d4b-9a0e-55b0b8d5a104",
      "name": "Fetch chart PNG",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [400, 0],
      "notes": "responseFormat=file turns the PNG into binary data on the property 'data'. No credentials are needed on the free tier."
    },
    {
      "parameters": {
        "fromEmail": "reports@example.com",
        "toEmail": "team@example.com",
        "subject": "=Chart: {{ $('Chart data').item.json.title }}",
        "emailFormat": "html",
        "html": "=<p>The latest chart is attached as <code>chart.png</code>.</p><p>Values: {{ $('Chart data').item.json.values }} ({{ $('Chart data').item.json.labels }}).</p><p>Rendered by <a href=\"https://urlchart.com\">UrlChart</a>.</p>",
        "attachments": "data",
        "options": {
          "appendAttribution": false
        }
      },
      "id": "3f1a8c02-6a55-4d4b-9a0e-55b0b8d5a105",
      "name": "Send email",
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 2.1,
      "position": [640, 0],
      "notes": "Connect SMTP credentials and change from/to. The attachment is the binary property 'data' from the previous node."
    }
  ],
  "connections": {
    "Daily at 08:00": {
      "main": [
        [
          {
            "node": "Chart data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Chart data": {
      "main": [
        [
          {
            "node": "Build chart URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build chart URL": {
      "main": [
        [
          {
            "node": "Fetch chart PNG",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch chart PNG": {
      "main": [
        [
          {
            "node": "Send email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {},
  "versionId": "e2b5f0b4-9f37-4a63-8e0d-2c4c6a7e9b58",
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "tags": []
}
