{
  "name": "Stripe balance transactions into a reconciliation sheet",
  "flow": [
    {
      "id": 1,
      "module": "http:ActionSendData",
      "version": 3,
      "parameters": {
        "handleErrors": true
      },
      "mapper": {
        "url": "https://api.stripe.com/v1/balance_transactions?limit=20",
        "serializeUrl": false,
        "method": "get",
        "headers": [
          {
            "name": "Accept",
            "value": "application/json"
          },
          {
            "name": "Content-Type",
            "value": "application/json"
          },
          {
            "name": "Authorization",
            "value": "Bearer YOUR_API_KEY"
          }
        ],
        "qs": [],
        "bodyType": "raw",
        "parseResponse": true,
        "contentType": "application/json",
        "data": "",
        "timeout": "",
        "shareCookies": false,
        "ca": "",
        "rejectUnauthorized": true,
        "followRedirect": true,
        "useQuerystring": false,
        "gzip": true,
        "useMtls": false,
        "followAllRedirects": false
      },
      "metadata": {
        "designer": {
          "x": 0,
          "y": 0,
          "name": "List balance transactions"
        }
      },
      "onerror": [
        {
          "id": 2,
          "module": "slack:CreateMessage",
          "version": 4,
          "parameters": {},
          "mapper": {
            "channelWType": "list",
            "channelType": "public",
            "channel": "",
            "text": "Balance transaction list failed.",
            "mrkdwn": true,
            "parse": false
          },
          "metadata": {
            "designer": {
              "x": 0,
              "y": 300,
              "name": "Alert Stripe"
            },
            "parameters": [
              {
                "name": "__IMTCONN__",
                "type": "account:slack2,slack3",
                "label": "Connection",
                "required": true
              }
            ]
          }
        },
        {
          "id": 3,
          "module": "builtin:Break",
          "version": 1,
          "parameters": {},
          "mapper": {
            "retry": true,
            "count": 3,
            "interval": 15
          },
          "metadata": {
            "designer": {
              "x": 300,
              "y": 300,
              "name": "Retry (Break)"
            }
          }
        }
      ]
    },
    {
      "id": 4,
      "module": "builtin:BasicFeeder",
      "version": 1,
      "parameters": {},
      "mapper": {
        "array": "{{1.data.data}}"
      },
      "metadata": {
        "designer": {
          "x": 300,
          "y": 0,
          "name": "One bundle per transaction"
        }
      }
    },
    {
      "id": 5,
      "module": "google-sheets:addRow",
      "version": 2,
      "parameters": {},
      "mapper": {
        "from": "drive",
        "mode": "select",
        "spreadsheetId": "",
        "sheetId": "",
        "includesHeaders": true,
        "insertDataOption": "INSERT_ROWS",
        "valueInputOption": "USER_ENTERED",
        "values": {
          "0": "{{now}}",
          "1": "{{4.id}}",
          "2": "{{4.type}}",
          "3": "{{4.amount}}",
          "4": "{{4.currency}}",
          "5": "{{4.created}}",
          "6": ""
        }
      },
      "metadata": {
        "designer": {
          "x": 600,
          "y": 0,
          "name": "Write the transaction"
        },
        "parameters": [
          {
            "name": "__IMTCONN__",
            "type": "account:google",
            "label": "Connection",
            "required": true
          }
        ]
      }
    },
    {
      "id": 6,
      "module": "util:TextAggregator",
      "version": 1,
      "parameters": {
        "feeder": 4,
        "rowSeparator": "\n"
      },
      "mapper": {
        "value": "{{4.id}} {{4.type}} {{4.amount}} {{4.currency}}"
      },
      "metadata": {
        "designer": {
          "x": 900,
          "y": 0,
          "name": "Collect the ids"
        }
      }
    },
    {
      "id": 7,
      "module": "slack:CreateMessage",
      "version": 4,
      "parameters": {},
      "mapper": {
        "channelWType": "list",
        "channelType": "public",
        "channel": "",
        "text": "*Stripe import*\n{{6.text}}",
        "mrkdwn": true,
        "parse": false
      },
      "metadata": {
        "designer": {
          "x": 1200,
          "y": 0,
          "name": "Post the import summary"
        },
        "parameters": [
          {
            "name": "__IMTCONN__",
            "type": "account:slack2,slack3",
            "label": "Connection",
            "required": true
          }
        ]
      },
      "onerror": [
        {
          "id": 8,
          "module": "builtin:Ignore",
          "version": 1,
          "parameters": {},
          "mapper": {},
          "metadata": {
            "designer": {
              "x": 1200,
              "y": 300,
              "name": "Skip (Ignore)"
            }
          }
        }
      ]
    }
  ],
  "metadata": {
    "instant": false,
    "version": 1,
    "designer": {
      "orphans": []
    },
    "scenario": {
      "roundtrips": 1,
      "maxErrors": 3,
      "autoCommit": true,
      "autoCommitTriggerLast": true,
      "sequential": true,
      "confidential": false,
      "dataloss": false,
      "dlq": true,
      "freshVariables": false
    }
  }
}
