{
  "name": "Discord daily digest for multiple Google Analytics accounts",
  "nodes": [
    {
      "id": "d3bf8c74-1adf-46ca-8bb0-18ad83a1a3e7",
      "name": "Edit Fields2",
      "type": "n8n-nodes-base.set",
      "position": [
        440,
        80
      ]
    },
    {
      "id": "6592e781-3b51-44c7-9b60-0d38cb6143b2",
      "name": "Edit Fields3",
      "type": "n8n-nodes-base.set",
      "position": [
        440,
        280
      ]
    },
    {
      "id": "325bcec9-276a-4a62-9755-04c3033f385f",
      "name": "Google Analytics",
      "type": "n8n-nodes-base.googleAnalytics",
      "position": [
        820,
        380
      ]
    },
    {
      "id": "e8b1a2da-d59f-44fb-8d03-60e6304d0d3a",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        280,
        280
      ]
    },
    {
      "id": "5b91ccf6-5397-4e4b-97a9-bbe196ddbc8e",
      "name": "Schedule Trigger1",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        280,
        80
      ]
    },
    {
      "id": "9073f015-ae42-4461-b423-88fa2d45c205",
      "name": "Sort",
      "type": "n8n-nodes-base.sort",
      "position": [
        980,
        380
      ]
    },
    {
      "id": "a71e1cdd-ddc3-458d-b349-638ad0d59146",
      "name": "Discord",
      "type": "n8n-nodes-base.discord",
      "position": [
        1280,
        380
      ]
    },
    {
      "id": "67074924-8e24-4cf2-bc0b-115112b1bcef",
      "name": "Code",
      "type": "n8n-nodes-base.code",
      "position": [
        1620,
        380
      ]
    },
    {
      "id": "01594d3d-7bc9-425c-af39-27c69d825321",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -40,
        40
      ],
      "parameters": {
        "width": 640,
        "height": 180,
        "content": "## Google Analytics Property 1\n## Discord Channel 1\n"
      }
    },
    {
      "id": "04ed2530-fa65-427f-9019-bf970055481c",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -40,
        240
      ],
      "parameters": {
        "width": 640,
        "height": 180,
        "content": "## Google Analytics Property 2\n## Discord Channel 2\n"
      }
    },
    {
      "id": "7567b2b8-2c12-42d8-898a-be7f59414061",
      "name": "Code1",
      "type": "n8n-nodes-base.code",
      "position": [
        680,
        380
      ]
    },
    {
      "id": "84d96e4a-2da5-4823-ba06-ec56346c5247",
      "name": "gaData",
      "type": "n8n-nodes-base.code",
      "position": [
        1120,
        380
      ]
    },
    {
      "id": "6ea881a9-19ef-4f4c-815c-efd5b963a7fc",
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2380,
        200
      ]
    },
    {
      "id": "e27342c6-4128-4be3-bf95-1d11fdc36126",
      "name": "HTTP Request8",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2340,
        620
      ]
    },
    {
      "id": "113d9181-b7f5-455c-8c98-3592b223544a",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        1840,
        380
      ]
    },
    {
      "id": "e1bb4d90-07d8-4d9a-9fa9-77969b980973",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        2140,
        600
      ]
    },
    {
      "id": "cb148176-64d2-412d-b93f-7a4f41f71bb6",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        2560,
        620
      ]
    },
    {
      "id": "32daa189-fbf3-456f-8fe1-532ea5329163",
      "name": "Loop Over Items4",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        2140,
        160
      ]
    },
    {
      "id": "acfea1dc-6154-419a-bfc3-33d38b88d392",
      "name": "Wait4",
      "type": "n8n-nodes-base.wait",
      "position": [
        2560,
        180
      ]
    },
    {
      "id": "d2aebef9-605a-471a-b0cd-c90946e0ecaf",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2060,
        20
      ],
      "parameters": {
        "width": 700,
        "height": 360,
        "content": "## send a new discord message\n\nif its a new day, then we send a new discord message to the discord server with the latest google analytics data. Google analytics data refreshes at UTC midnight"
      }
    },
    {
      "id": "530cb064-a232-4791-8041-d2e86d081687",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2060,
        440
      ],
      "parameters": {
        "width": 700,
        "height": 400,
        "content": "## update an existing discord message\n\nGoogle analytics data in not real time and the value changes in the next few days. After 7 days, the traffic values are finalized. So in order to display the acc"
      }
    },
    {
      "id": "04c66040-d5dd-46df-874c-13a2f41e5bee",
      "name": "Edit Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        440,
        480
      ]
    },
    {
      "id": "41409245-e194-4e69-866c-f357af2607b1",
      "name": "Edit Fields4",
      "type": "n8n-nodes-base.set",
      "position": [
        440,
        680
      ]
    },
    {
      "id": "15404bc5-657a-4429-ada9-6528d766b779",
      "name": "Schedule Trigger2",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        280,
        680
      ]
    },
    {
      "id": "1901a316-6baa-4674-b8b5-cfa4a35d3818",
      "name": "Schedule Trigger3",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        280,
        480
      ]
    },
    {
      "id": "34d1a765-f42a-4cdd-bc7a-2c97234fd3fd",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -40,
        440
      ],
      "parameters": {
        "width": 640,
        "height": 180,
        "content": "## Google Analytics Property 3\n## Discord Channel 3\n\n"
      }
    },
    {
      "id": "44ca144f-ca2d-4c7a-8348-2a50dbb48772",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -40,
        640
      ],
      "parameters": {
        "width": 640,
        "height": 180,
        "content": "## Google Analytics Property 4\n## Discord Channel 4\n"
      }
    },
    {
      "id": "28e662c6-7071-4d54-b7ca-710d185e3422",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        820,
        200
      ],
      "parameters": {
        "width": 400,
        "height": null,
        "content": "### Fetches and sorts google analytics data\n\nEnsure that your google analytics data is setup properly, follow the [n8n guide here](https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.goo"
      }
    },
    {
      "id": "dfc3412f-e989-4c6f-aa8e-5a2e34b0221d",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1280,
        200
      ],
      "parameters": {
        "width": 260,
        "height": null,
        "content": "### Fetches and sorts discord messages from the channel\n\nEnsure that your discord Oauth is setup properly, follow the [n8n guide to setup discord oauth](https://docs.n8n.io/integrations/builtin/app-no"
      }
    },
    {
      "id": "1287b658-275e-4d72-858c-2f279a20eb41",
      "name": "Sort6",
      "type": "n8n-nodes-base.sort",
      "position": [
        1440,
        380
      ]
    },
    {
      "id": "8a999078-a716-4b1a-b501-dec5beb469f0",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1600,
        200
      ],
      "parameters": {
        "width": 160,
        "height": null,
        "content": "### Maps the data\nusing the Date field"
      }
    },
    {
      "id": "dfe339cd-0335-4f77-8517-a35441eb6193",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2060,
        -140
      ],
      "parameters": {
        "width": 700,
        "height": 120,
        "content": "### Use the discord api to update messages\nHere, we use the official discord api rather than the discord node to update messages because that feature has not been implmented in n8n yet. [Read the offi"
      }
    },
    {
      "id": "39be50dc-79bc-4091-a802-ae7aacdfa684",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -580,
        -20
      ],
      "parameters": {
        "width": 440,
        "height": 480,
        "content": "## Get your discord channel id\n1. Get your discord channel id by sending a text on your discord channel and then copy message link\n2. Paste the text below and you will see your message link in the for"
      }
    },
    {
      "id": "a1032930-f62f-49d4-8e39-28c9c73fe5a2",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -580,
        500
      ],
      "parameters": {
        "width": 440,
        "height": 420,
        "content": "## Get your google analytics id\n1. Find your google analytics id by going to google analytics dashboard, seeing the properties in the top right and copy paste that number to the flow\n![get google anal"
      }
    }
  ],
  "connections": {
    "Code": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sort": {
      "main": [
        [
          {
            "node": "gaData",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code1": {
      "main": [
        [
          {
            "node": "Google Analytics",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sort6": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait4": {
      "main": [
        [
          {
            "node": "Loop Over Items4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "Loop Over Items4",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "gaData": {
      "main": [
        [
          {
            "node": "Discord",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Discord": {
      "main": [
        [
          {
            "node": "Sort6",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Code1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields2": {
      "main": [
        [
          {
            "node": "Code1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields3": {
      "main": [
        [
          {
            "node": "Code1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields4": {
      "main": [
        [
          {
            "node": "Code1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "Wait4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request8": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "HTTP Request8",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Analytics": {
      "main": [
        [
          {
            "node": "Sort",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items4": {
      "main": [
        [],
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Edit Fields3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger1": {
      "main": [
        [
          {
            "node": "Edit Fields2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger2": {
      "main": [
        [
          {
            "node": "Edit Fields4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger3": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}