{
  "name": "Fleetix: nová rezervácia → Google Sheets, Slack a e-mail",
  "flow": [
    {
      "id": 1,
      "module": "gateway:CustomWebHook",
      "version": 1,
      "parameters": {
        "hook": null,
        "maxResults": 1
      },
      "mapper": {},
      "metadata": {
        "designer": {
          "x": 0,
          "y": 0
        },
        "restore": {}
      }
    },
    {
      "id": 2,
      "module": "http:ActionSendData",
      "version": 3,
      "filter": {
        "name": "Len nové rezervácie",
        "conditions": [
          [
            {
              "a": "{{1.type}}",
              "b": "reservation.created",
              "o": "text:equal"
            }
          ]
        ]
      },
      "parameters": {
        "handleErrors": false,
        "useNewZLibDeCompress": true
      },
      "mapper": {
        "url": "https://api.fleetix.eu/v1/vehicles/{{1.data.reservation.vehicleId}}",
        "method": "get",
        "headers": [
          {
            "name": "Authorization",
            "value": "Bearer fx_live_VAS_KLUC"
          }
        ],
        "parseResponse": true,
        "timeout": "",
        "followRedirect": true,
        "useQuerystring": false,
        "gzip": true,
        "useMtls": false,
        "shareCookies": false,
        "rejectUnauthorized": true,
        "followAllRedirects": false
      },
      "metadata": {
        "designer": {
          "x": 300,
          "y": 0,
          "name": "Načítať auto z API Fleetixu"
        }
      }
    },
    {
      "id": 3,
      "module": "builtin:BasicRouter",
      "version": 1,
      "mapper": null,
      "metadata": {
        "designer": {
          "x": 600,
          "y": 0
        }
      },
      "routes": [
        {
          "flow": [
            {
              "id": 4,
              "module": "google-sheets:addRow",
              "version": 2,
              "parameters": {
                "__IMTCONN__": null
              },
              "mapper": {
                "from": "drive",
                "mode": "select",
                "spreadsheetId": "",
                "sheetId": "Rezervácie",
                "includesHeaders": true,
                "insertDataOption": "INSERT_ROWS",
                "valueInputOption": "USER_ENTERED",
                "insertUnformatted": false,
                "values": {
                  "0": "{{1.data.reservation.number}}",
                  "1": "{{1.data.reservation.status}}",
                  "2": "{{2.data.name}}",
                  "3": "{{1.data.reservation.pickupAt}}",
                  "4": "{{1.data.reservation.returnAt}}",
                  "5": "{{1.data.reservation.price.total}}",
                  "6": "{{1.data.reservation.currency}}",
                  "7": "{{1.data.reservation.source}}",
                  "8": "{{1.data.reservation.portalUrl}}"
                }
              },
              "metadata": {
                "designer": {
                  "x": 900,
                  "y": -150,
                  "name": "Riadok do Google Sheets"
                }
              }
            }
          ]
        },
        {
          "flow": [
            {
              "id": 5,
              "module": "slack:CreateMessage",
              "version": 4,
              "parameters": {
                "__IMTCONN__": null
              },
              "mapper": {
                "channelType": "public",
                "channel": "",
                "text": "Nová rezervácia {{1.data.reservation.number}}: {{2.data.name}}, {{formatDate(1.data.reservation.pickupAt; \"D. M. HH:mm\"; \"Europe/Bratislava\")}} až {{formatDate(1.data.reservation.returnAt; \"D. M. HH:mm\"; \"Europe/Bratislava\")}}, {{1.data.reservation.price.total}} {{1.data.reservation.currency}}"
              },
              "metadata": {
                "designer": {
                  "x": 900,
                  "y": 0,
                  "name": "Správa do Slacku"
                }
              }
            }
          ]
        },
        {
          "flow": [
            {
              "id": 6,
              "module": "email:ActionSendEmail",
              "version": 7,
              "parameters": {
                "account": null
              },
              "mapper": {
                "to": [
                  "pobocka@vasa-firma.sk"
                ],
                "subject": "Nová rezervácia {{1.data.reservation.number}}",
                "contentType": "text",
                "content": "Auto: {{2.data.name}}\nPrevzatie: {{1.data.reservation.pickupAt}}\nVrátenie: {{1.data.reservation.returnAt}}\nCena: {{1.data.reservation.price.total}} {{1.data.reservation.currency}}\nPotvrďte ju vo Fleetixe."
              },
              "metadata": {
                "designer": {
                  "x": 900,
                  "y": 150,
                  "name": "E-mail pobočke"
                }
              }
            }
          ]
        }
      ]
    }
  ],
  "metadata": {
    "instant": true,
    "version": 1,
    "scenario": {
      "roundtrips": 1,
      "maxErrors": 3,
      "autoCommit": true,
      "autoCommitTriggerLast": true,
      "sequential": false,
      "slots": null,
      "confidential": false,
      "dataloss": false,
      "dlq": false,
      "freshVariables": false
    },
    "designer": {
      "orphans": []
    },
    "zone": "eu1.make.com"
  }
}
