{
  "name": "Курс ЦБ каждое утро в Telegram",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 9
            }
          ]
        }
      },
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        0,
        0
      ]
    },
    {
      "parameters": {
        "url": "https://www.cbr-xml-daily.ru/daily_json.js",
        "options": {
          "response": {
            "response": {
              "responseFormat": "json"
            }
          }
        }
      },
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        220,
        0
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "a1",
              "name": "date",
              "value": "={{ DateTime.fromISO($json.Date).toFormat('dd.MM.yyyy') }}",
              "type": "string"
            },
            {
              "id": "a2",
              "name": "usd",
              "value": "={{ $json.Valute.USD.Value.toFixed(2).replace('.', ',') }}",
              "type": "string"
            },
            {
              "id": "a3",
              "name": "eur",
              "value": "={{ $json.Valute.EUR.Value.toFixed(2).replace('.', ',') }}",
              "type": "string"
            },
            {
              "id": "a4",
              "name": "text",
              "value": "=Курс ЦБ на {{ DateTime.fromISO($json.Date).toFormat('dd.MM.yyyy') }}\nДоллар: {{ $json.Valute.USD.Value.toFixed(2).replace('.', ',') }} ₽\nЕвро: {{ $json.Valute.EUR.Value.toFixed(2).replace('.', ',') }} ₽",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "name": "Edit Fields",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        440,
        0
      ]
    },
    {
      "parameters": {
        "chatId": "ВАШ_CHAT_ID",
        "text": "={{ $json.text }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "name": "Telegram",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        660,
        0
      ]
    }
  ],
  "connections": {
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}
