{
    "name": "Cornersight -> Content Brain, Google Sheets",
    "flow": [
        {
            "id": 1,
            "module": "gateway:CustomWebHook",
            "version": 1,
            "parameters": {
                "hook": null,
                "maxResults": 1
            },
            "mapper": {},
            "metadata": {
                "designer": {
                    "x": 0,
                    "y": 0
                },
                "restore": {
                    "parameters": {
                        "hook": {
                            "label": "Cornersight webhook (click Add to create yours)",
                            "data": {
                                "editable": "true"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "hook",
                        "type": "hook:gateway-webhook",
                        "label": "Webhook",
                        "required": true
                    },
                    {
                        "name": "maxResults",
                        "type": "number",
                        "label": "Maximum number of results"
                    }
                ]
            }
        },
        {
            "id": 2,
            "module": "google-sheets:filterRows",
            "version": 2,
            "parameters": {
                "__IMTCONN__": null
            },
            "mapper": {
                "from": "drive",
                "spreadsheetId": "",
                "sheetId": "Content Brain",
                "includesHeaders": true,
                "tableFirstRow": "A1:Z1",
                "filter": [
                    [
                        {
                            "a": "A",
                            "b": "{{1.data.postUrl}}",
                            "o": "text:equal"
                        }
                    ]
                ],
                "sortOrder": "asc",
                "limit": "1",
                "valueRenderOption": "FORMATTED_VALUE",
                "dateTimeRenderOption": "FORMATTED_STRING"
            },
            "metadata": {
                "designer": {
                    "x": 300,
                    "y": 0
                },
                "restore": {
                    "parameters": {
                        "__IMTCONN__": {
                            "label": "Connect your Google account",
                            "data": {
                                "scoped": "true",
                                "connection": "google"
                            }
                        }
                    },
                    "expect": {
                        "spreadsheetId": {
                            "mode": "chose",
                            "label": "PICK YOUR SHEET"
                        },
                        "sheetId": {
                            "mode": "chose",
                            "label": "Content Brain"
                        },
                        "includesHeaders": {
                            "mode": "chose",
                            "label": "Yes"
                        },
                        "tableFirstRow": {
                            "label": "A-Z"
                        },
                        "sortOrder": {
                            "mode": "chose",
                            "label": "Ascending"
                        },
                        "valueRenderOption": {
                            "mode": "chose",
                            "label": "Formatted value"
                        },
                        "dateTimeRenderOption": {
                            "mode": "chose",
                            "label": "Formatted string"
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "__IMTCONN__",
                        "type": "account:google",
                        "label": "Connection",
                        "required": true
                    }
                ]
            },
            "filter": {
                "name": "Has post text?",
                "conditions": [
                    [
                        {
                            "a": "{{1.data.postText}}",
                            "o": "exist"
                        }
                    ]
                ]
            }
        },
        {
            "id": 3,
            "module": "builtin:BasicAggregator",
            "version": 1,
            "parameters": {
                "feeder": 2
            },
            "mapper": {
                "__ROW_NUMBER__": "{{2.`__ROW_NUMBER__`}}"
            },
            "metadata": {
                "designer": {
                    "x": 600,
                    "y": 0
                },
                "restore": {
                    "extra": {
                        "feeder": {
                            "label": "Google Sheets - Search Rows [2]"
                        },
                        "target": {
                            "label": "Custom"
                        }
                    }
                }
            }
        },
        {
            "id": 4,
            "module": "builtin:BasicRouter",
            "version": 1,
            "mapper": null,
            "metadata": {
                "designer": {
                    "x": 900,
                    "y": 0
                }
            },
            "routes": [
                {
                    "flow": [
                        {
                            "id": 5,
                            "module": "google-sheets:updateRow",
                            "version": 2,
                            "parameters": {
                                "__IMTCONN__": null
                            },
                            "filter": {
                                "name": "Post already in sheet + this is the author",
                                "conditions": [
                                    [
                                        {
                                            "a": "{{1.data.postText}}",
                                            "o": "exist"
                                        },
                                        {
                                            "a": "{{length(3.array)}}",
                                            "b": "0",
                                            "o": "number:greater"
                                        },
                                        {
                                            "a": "{{1.data.engagementType}}",
                                            "b": "Author",
                                            "o": "text:equal"
                                        }
                                    ]
                                ]
                            },
                            "mapper": {
                                "from": "drive",
                                "mode": "select",
                                "spreadsheetId": "",
                                "sheetId": "Content Brain",
                                "rowNumber": "{{first(map(3.array; \"__ROW_NUMBER__\"))}}",
                                "includesHeaders": true,
                                "valueInputOption": "USER_ENTERED",
                                "values": {
                                    "0": "{{1.data.postUrl}}",
                                    "1": "{{1.data.postPostedAt}}",
                                    "2": "{{1.data.trackedProfile}}",
                                    "3": "{{1.data.name}}",
                                    "4": "{{1.data.jobTitle}} at {{1.data.companyName}}",
                                    "5": "{{1.data.linkedinUrl}}",
                                    "6": "{{1.data.postText}}",
                                    "7": "{{1.timestamp}}"
                                }
                            },
                            "metadata": {
                                "designer": {
                                    "x": 1200,
                                    "y": -300
                                },
                                "restore": {
                                    "parameters": {
                                        "__IMTCONN__": {
                                            "label": "Connect your Google account",
                                            "data": {
                                                "scoped": "true",
                                                "connection": "google"
                                            }
                                        }
                                    },
                                    "expect": {
                                        "from": {
                                            "label": "My Drive"
                                        },
                                        "mode": {
                                            "label": "Select from the list"
                                        },
                                        "spreadsheetId": {
                                            "path": [
                                                "PICK YOUR SHEET"
                                            ]
                                        },
                                        "sheetId": {
                                            "label": "Content Brain"
                                        },
                                        "includesHeaders": {
                                            "label": "Yes",
                                            "nested": [
                                                {
                                                    "name": "values",
                                                    "label": "Values",
                                                    "type": "collection",
                                                    "spec": [
                                                        {
                                                            "name": "0",
                                                            "type": "text",
                                                            "label": "postUrl (A)"
                                                        },
                                                        {
                                                            "name": "1",
                                                            "type": "text",
                                                            "label": "postedAt (B)"
                                                        },
                                                        {
                                                            "name": "2",
                                                            "type": "text",
                                                            "label": "keywordOrCreator (C)"
                                                        },
                                                        {
                                                            "name": "3",
                                                            "type": "text",
                                                            "label": "author (D)"
                                                        },
                                                        {
                                                            "name": "4",
                                                            "type": "text",
                                                            "label": "authorTitle (E)"
                                                        },
                                                        {
                                                            "name": "5",
                                                            "type": "text",
                                                            "label": "authorLinkedin (F)"
                                                        },
                                                        {
                                                            "name": "6",
                                                            "type": "text",
                                                            "label": "postText (G)"
                                                        },
                                                        {
                                                            "name": "7",
                                                            "type": "text",
                                                            "label": "lastSeen (H)"
                                                        }
                                                    ]
                                                }
                                            ]
                                        },
                                        "valueInputOption": {
                                            "mode": "chose",
                                            "label": "User entered"
                                        }
                                    }
                                },
                                "parameters": [
                                    {
                                        "name": "__IMTCONN__",
                                        "type": "account:google",
                                        "label": "Connection",
                                        "required": true
                                    }
                                ]
                            }
                        }
                    ]
                },
                {
                    "flow": [
                        {
                            "id": 6,
                            "module": "google-sheets:updateRow",
                            "version": 2,
                            "parameters": {
                                "__IMTCONN__": null
                            },
                            "filter": {
                                "name": "Post already in sheet + like/comment (keep author details)",
                                "conditions": [
                                    [
                                        {
                                            "a": "{{1.data.postText}}",
                                            "o": "exist"
                                        },
                                        {
                                            "a": "{{length(3.array)}}",
                                            "b": "0",
                                            "o": "number:greater"
                                        },
                                        {
                                            "a": "{{1.data.engagementType}}",
                                            "b": "Author",
                                            "o": "text:notequal"
                                        }
                                    ]
                                ]
                            },
                            "mapper": {
                                "from": "drive",
                                "mode": "select",
                                "spreadsheetId": "",
                                "sheetId": "Content Brain",
                                "rowNumber": "{{first(map(3.array; \"__ROW_NUMBER__\"))}}",
                                "includesHeaders": true,
                                "valueInputOption": "USER_ENTERED",
                                "values": {
                                    "0": "{{1.data.postUrl}}",
                                    "1": "{{1.data.postPostedAt}}",
                                    "2": "{{1.data.trackedProfile}}",
                                    "6": "{{1.data.postText}}",
                                    "7": "{{1.timestamp}}"
                                }
                            },
                            "metadata": {
                                "designer": {
                                    "x": 1200,
                                    "y": -100
                                },
                                "restore": {
                                    "parameters": {
                                        "__IMTCONN__": {
                                            "label": "Connect your Google account",
                                            "data": {
                                                "scoped": "true",
                                                "connection": "google"
                                            }
                                        }
                                    },
                                    "expect": {
                                        "from": {
                                            "label": "My Drive"
                                        },
                                        "mode": {
                                            "label": "Select from the list"
                                        },
                                        "spreadsheetId": {
                                            "path": [
                                                "PICK YOUR SHEET"
                                            ]
                                        },
                                        "sheetId": {
                                            "label": "Content Brain"
                                        },
                                        "includesHeaders": {
                                            "label": "Yes",
                                            "nested": [
                                                {
                                                    "name": "values",
                                                    "label": "Values",
                                                    "type": "collection",
                                                    "spec": [
                                                        {
                                                            "name": "0",
                                                            "type": "text",
                                                            "label": "postUrl (A)"
                                                        },
                                                        {
                                                            "name": "1",
                                                            "type": "text",
                                                            "label": "postedAt (B)"
                                                        },
                                                        {
                                                            "name": "2",
                                                            "type": "text",
                                                            "label": "keywordOrCreator (C)"
                                                        },
                                                        {
                                                            "name": "3",
                                                            "type": "text",
                                                            "label": "author (D)"
                                                        },
                                                        {
                                                            "name": "4",
                                                            "type": "text",
                                                            "label": "authorTitle (E)"
                                                        },
                                                        {
                                                            "name": "5",
                                                            "type": "text",
                                                            "label": "authorLinkedin (F)"
                                                        },
                                                        {
                                                            "name": "6",
                                                            "type": "text",
                                                            "label": "postText (G)"
                                                        },
                                                        {
                                                            "name": "7",
                                                            "type": "text",
                                                            "label": "lastSeen (H)"
                                                        }
                                                    ]
                                                }
                                            ]
                                        },
                                        "valueInputOption": {
                                            "mode": "chose",
                                            "label": "User entered"
                                        }
                                    }
                                },
                                "parameters": [
                                    {
                                        "name": "__IMTCONN__",
                                        "type": "account:google",
                                        "label": "Connection",
                                        "required": true
                                    }
                                ]
                            }
                        }
                    ]
                },
                {
                    "flow": [
                        {
                            "id": 7,
                            "module": "google-sheets:addRow",
                            "version": 2,
                            "parameters": {
                                "__IMTCONN__": null
                            },
                            "filter": {
                                "name": "New post + this is the author",
                                "conditions": [
                                    [
                                        {
                                            "a": "{{1.data.postText}}",
                                            "o": "exist"
                                        },
                                        {
                                            "a": "{{length(3.array)}}",
                                            "b": "0",
                                            "o": "number:equal"
                                        },
                                        {
                                            "a": "{{1.data.engagementType}}",
                                            "b": "Author",
                                            "o": "text:equal"
                                        }
                                    ]
                                ]
                            },
                            "mapper": {
                                "from": "drive",
                                "mode": "select",
                                "spreadsheetId": "",
                                "sheetId": "Content Brain",
                                "includesHeaders": true,
                                "insertDataOption": "INSERT_ROWS",
                                "valueInputOption": "USER_ENTERED",
                                "insertUnformatted": false,
                                "values": {
                                    "0": "{{1.data.postUrl}}",
                                    "1": "{{1.data.postPostedAt}}",
                                    "2": "{{1.data.trackedProfile}}",
                                    "3": "{{1.data.name}}",
                                    "4": "{{1.data.jobTitle}} at {{1.data.companyName}}",
                                    "5": "{{1.data.linkedinUrl}}",
                                    "6": "{{1.data.postText}}",
                                    "7": "{{1.timestamp}}"
                                }
                            },
                            "metadata": {
                                "designer": {
                                    "x": 1200,
                                    "y": 100
                                },
                                "restore": {
                                    "parameters": {
                                        "__IMTCONN__": {
                                            "label": "Connect your Google account",
                                            "data": {
                                                "scoped": "true",
                                                "connection": "google"
                                            }
                                        }
                                    },
                                    "expect": {
                                        "from": {
                                            "label": "My Drive"
                                        },
                                        "mode": {
                                            "label": "Select from the list"
                                        },
                                        "spreadsheetId": {
                                            "path": [
                                                "PICK YOUR SHEET"
                                            ]
                                        },
                                        "sheetId": {
                                            "label": "Content Brain"
                                        },
                                        "includesHeaders": {
                                            "label": "Yes",
                                            "nested": [
                                                {
                                                    "name": "values",
                                                    "label": "Values",
                                                    "type": "collection",
                                                    "spec": [
                                                        {
                                                            "name": "0",
                                                            "type": "text",
                                                            "label": "postUrl (A)"
                                                        },
                                                        {
                                                            "name": "1",
                                                            "type": "text",
                                                            "label": "postedAt (B)"
                                                        },
                                                        {
                                                            "name": "2",
                                                            "type": "text",
                                                            "label": "keywordOrCreator (C)"
                                                        },
                                                        {
                                                            "name": "3",
                                                            "type": "text",
                                                            "label": "author (D)"
                                                        },
                                                        {
                                                            "name": "4",
                                                            "type": "text",
                                                            "label": "authorTitle (E)"
                                                        },
                                                        {
                                                            "name": "5",
                                                            "type": "text",
                                                            "label": "authorLinkedin (F)"
                                                        },
                                                        {
                                                            "name": "6",
                                                            "type": "text",
                                                            "label": "postText (G)"
                                                        },
                                                        {
                                                            "name": "7",
                                                            "type": "text",
                                                            "label": "lastSeen (H)"
                                                        }
                                                    ]
                                                }
                                            ]
                                        },
                                        "insertDataOption": {
                                            "mode": "chose",
                                            "label": "Insert rows"
                                        },
                                        "valueInputOption": {
                                            "mode": "chose",
                                            "label": "User entered"
                                        },
                                        "insertUnformatted": {
                                            "mode": "chose"
                                        }
                                    }
                                },
                                "parameters": [
                                    {
                                        "name": "__IMTCONN__",
                                        "type": "account:google",
                                        "label": "Connection",
                                        "required": true
                                    }
                                ]
                            }
                        }
                    ]
                },
                {
                    "flow": [
                        {
                            "id": 8,
                            "module": "google-sheets:addRow",
                            "version": 2,
                            "parameters": {
                                "__IMTCONN__": null
                            },
                            "filter": {
                                "name": "New post + like/comment (no author details)",
                                "conditions": [
                                    [
                                        {
                                            "a": "{{1.data.postText}}",
                                            "o": "exist"
                                        },
                                        {
                                            "a": "{{length(3.array)}}",
                                            "b": "0",
                                            "o": "number:equal"
                                        },
                                        {
                                            "a": "{{1.data.engagementType}}",
                                            "b": "Author",
                                            "o": "text:notequal"
                                        }
                                    ]
                                ]
                            },
                            "mapper": {
                                "from": "drive",
                                "mode": "select",
                                "spreadsheetId": "",
                                "sheetId": "Content Brain",
                                "includesHeaders": true,
                                "insertDataOption": "INSERT_ROWS",
                                "valueInputOption": "USER_ENTERED",
                                "insertUnformatted": false,
                                "values": {
                                    "0": "{{1.data.postUrl}}",
                                    "1": "{{1.data.postPostedAt}}",
                                    "2": "{{1.data.trackedProfile}}",
                                    "6": "{{1.data.postText}}",
                                    "7": "{{1.timestamp}}"
                                }
                            },
                            "metadata": {
                                "designer": {
                                    "x": 1200,
                                    "y": 300
                                },
                                "restore": {
                                    "parameters": {
                                        "__IMTCONN__": {
                                            "label": "Connect your Google account",
                                            "data": {
                                                "scoped": "true",
                                                "connection": "google"
                                            }
                                        }
                                    },
                                    "expect": {
                                        "from": {
                                            "label": "My Drive"
                                        },
                                        "mode": {
                                            "label": "Select from the list"
                                        },
                                        "spreadsheetId": {
                                            "path": [
                                                "PICK YOUR SHEET"
                                            ]
                                        },
                                        "sheetId": {
                                            "label": "Content Brain"
                                        },
                                        "includesHeaders": {
                                            "label": "Yes",
                                            "nested": [
                                                {
                                                    "name": "values",
                                                    "label": "Values",
                                                    "type": "collection",
                                                    "spec": [
                                                        {
                                                            "name": "0",
                                                            "type": "text",
                                                            "label": "postUrl (A)"
                                                        },
                                                        {
                                                            "name": "1",
                                                            "type": "text",
                                                            "label": "postedAt (B)"
                                                        },
                                                        {
                                                            "name": "2",
                                                            "type": "text",
                                                            "label": "keywordOrCreator (C)"
                                                        },
                                                        {
                                                            "name": "3",
                                                            "type": "text",
                                                            "label": "author (D)"
                                                        },
                                                        {
                                                            "name": "4",
                                                            "type": "text",
                                                            "label": "authorTitle (E)"
                                                        },
                                                        {
                                                            "name": "5",
                                                            "type": "text",
                                                            "label": "authorLinkedin (F)"
                                                        },
                                                        {
                                                            "name": "6",
                                                            "type": "text",
                                                            "label": "postText (G)"
                                                        },
                                                        {
                                                            "name": "7",
                                                            "type": "text",
                                                            "label": "lastSeen (H)"
                                                        }
                                                    ]
                                                }
                                            ]
                                        },
                                        "insertDataOption": {
                                            "mode": "chose",
                                            "label": "Insert rows"
                                        },
                                        "valueInputOption": {
                                            "mode": "chose",
                                            "label": "User entered"
                                        },
                                        "insertUnformatted": {
                                            "mode": "chose"
                                        }
                                    }
                                },
                                "parameters": [
                                    {
                                        "name": "__IMTCONN__",
                                        "type": "account:google",
                                        "label": "Connection",
                                        "required": true
                                    }
                                ]
                            }
                        }
                    ]
                }
            ]
        }
    ],
    "metadata": {
        "instant": true,
        "version": 1,
        "scenario": {
            "roundtrips": 1,
            "maxErrors": 3,
            "autoCommit": true,
            "autoCommitTriggerLast": true,
            "sequential": false,
            "confidential": false,
            "dataloss": false,
            "dlq": false,
            "freshVariables": false
        },
        "designer": {
            "orphans": [],
            "notes": [
                {
                    "id": 1,
                    "text": "Cornersight -> Content Brain (Google Sheets).\nKeeps one row per LinkedIn post your keywords and creators surface.\n1. In Cornersight, set up keyword sources with authors ticked.\n2. Click this webhook, click Add, save, copy the URL into each source.\n3. Run once, then send a test lead so Make learns the fields.\n4. Google Sheet: tab named Content Brain, header row in A1: postUrl, postedAt, keywordOrCreator, author, authorTitle, authorLinkedin, postText, lastSeen.\n5. In all five Google Sheets modules: connect Google and pick your Sheet.\nRows match on postUrl (column A), so 50 people liking one post = one row. Author details are only written when Cornersight sends the author, so likes never wipe them.",
                    "filter": false
                }
            ]
        },
        "zone": "us1.make.com"
    }
}
