{
 "name": "Google review request the day after a Stripe invoice is paid (AutomateRecipes)",
 "nodes": [
  {
   "parameters": {
    "events": [
     "invoice.paid"
    ]
   },
   "id": "3937791e-a162-566c-9ebe-1ff27be7228b",
   "name": "Stripe: invoice.paid",
   "type": "n8n-nodes-base.stripeTrigger",
   "typeVersion": 1,
   "position": [
    0,
    0
   ],
   "credentials": {
    "stripeApi": {
     "id": "",
     "name": "YOUR_STRIPEAPI_CREDENTIAL"
    }
   }
  },
  {
   "parameters": {
    "assignments": {
     "assignments": [
      {
       "id": "a",
       "name": "Email",
       "value": "={{ $json.data.object.customer_email }}",
       "type": "string"
      },
      {
       "id": "b",
       "name": "Name",
       "value": "={{ $json.data.object.customer_name }}",
       "type": "string"
      },
      {
       "id": "c",
       "name": "PaidDate",
       "value": "={{ $now.toFormat('yyyy-MM-dd') }}",
       "type": "string"
      },
      {
       "id": "d",
       "name": "Sent",
       "value": "no",
       "type": "string"
      }
     ]
    },
    "options": {}
   },
   "id": "36ded36d-dd81-55e4-bf9d-a1164564e58d",
   "name": "Prepare row",
   "type": "n8n-nodes-base.set",
   "typeVersion": 3.4,
   "position": [
    220,
    0
   ]
  },
  {
   "parameters": {
    "operation": "append",
    "documentId": {
     "__rl": true,
     "mode": "url",
     "value": "https://docs.google.com/spreadsheets/d/YOUR_SHEET_ID/edit"
    },
    "sheetName": {
     "__rl": true,
     "mode": "name",
     "value": "Reviews"
    },
    "columns": {
     "mappingMode": "autoMapInputData",
     "value": {}
    },
    "options": {}
   },
   "id": "d3bee375-14d1-59e6-b1dd-c99be742ca06",
   "name": "Sheets: log paid customer",
   "type": "n8n-nodes-base.googleSheets",
   "typeVersion": 4.5,
   "position": [
    440,
    0
   ],
   "credentials": {
    "googleSheetsOAuth2Api": {
     "id": "",
     "name": "YOUR_GOOGLESHEETSOAUTH2API_CREDENTIAL"
    }
   }
  },
  {
   "parameters": {
    "rule": {
     "interval": [
      {
       "field": "cronExpression",
       "expression": "0 10 * * *"
      }
     ]
    }
   },
   "id": "e737c253-2dbc-554f-a9d4-0b6c687c6707",
   "name": "Every day 10:00",
   "type": "n8n-nodes-base.scheduleTrigger",
   "typeVersion": 1.2,
   "position": [
    0,
    250
   ]
  },
  {
   "parameters": {
    "documentId": {
     "__rl": true,
     "mode": "url",
     "value": "https://docs.google.com/spreadsheets/d/YOUR_SHEET_ID/edit"
    },
    "sheetName": {
     "__rl": true,
     "mode": "name",
     "value": "Reviews"
    },
    "options": {}
   },
   "id": "28f9b0db-a8f0-58b1-ab4f-0c3b86d105e8",
   "name": "Sheets: read customers",
   "type": "n8n-nodes-base.googleSheets",
   "typeVersion": 4.5,
   "position": [
    220,
    250
   ],
   "credentials": {
    "googleSheetsOAuth2Api": {
     "id": "",
     "name": "YOUR_GOOGLESHEETSOAUTH2API_CREDENTIAL"
    }
   }
  },
  {
   "parameters": {
    "conditions": {
     "options": {
      "caseSensitive": true,
      "typeValidation": "loose",
      "version": 1
     },
     "combinator": "and",
     "conditions": [
      {
       "id": "f1",
       "leftValue": "={{ $json.PaidDate }}",
       "rightValue": "={{ $now.minus({days:1}).toFormat('yyyy-MM-dd') }}",
       "operator": {
        "type": "string",
        "operation": "equals"
       }
      },
      {
       "id": "f2",
       "leftValue": "={{ $json.Sent }}",
       "rightValue": "no",
       "operator": {
        "type": "string",
        "operation": "equals"
       }
      }
     ]
    },
    "options": {}
   },
   "id": "b2634d72-ff7f-5669-81b9-94a2e2c0ef94",
   "name": "Paid yesterday, not sent",
   "type": "n8n-nodes-base.filter",
   "typeVersion": 2,
   "position": [
    440,
    250
   ]
  },
  {
   "parameters": {
    "sendTo": "={{ $json.Email }}",
    "subject": "How did we do?",
    "emailType": "text",
    "message": "=Hi {{ $json.Name }},\n\nThanks for your business! Would you leave us a quick Google review? YOUR_GOOGLE_REVIEW_LINK\n\nThank you!",
    "options": {}
   },
   "id": "b29328c2-f60e-57f5-80f3-8d89f22d5796",
   "name": "Gmail: ask for review",
   "type": "n8n-nodes-base.gmail",
   "typeVersion": 2.1,
   "position": [
    660,
    250
   ],
   "credentials": {
    "gmailOAuth2": {
     "id": "",
     "name": "YOUR_GMAILOAUTH2_CREDENTIAL"
    }
   }
  },
  {
   "parameters": {
    "operation": "update",
    "documentId": {
     "__rl": true,
     "mode": "url",
     "value": "https://docs.google.com/spreadsheets/d/YOUR_SHEET_ID/edit"
    },
    "sheetName": {
     "__rl": true,
     "mode": "name",
     "value": "Reviews"
    },
    "columns": {
     "mappingMode": "defineBelow",
     "value": {
      "row_number": "={{ $('Paid yesterday, not sent').item.json.row_number }}",
      "Sent": "yes"
     },
     "matchingColumns": [
      "row_number"
     ]
    },
    "options": {}
   },
   "id": "6d8a5a38-9ac6-53ef-843b-03c37ddd1fb4",
   "name": "Sheets: mark sent",
   "type": "n8n-nodes-base.googleSheets",
   "typeVersion": 4.5,
   "position": [
    880,
    250
   ],
   "credentials": {
    "googleSheetsOAuth2Api": {
     "id": "",
     "name": "YOUR_GOOGLESHEETSOAUTH2API_CREDENTIAL"
    }
   }
  }
 ],
 "connections": {
  "Stripe: invoice.paid": {
   "main": [
    [
     {
      "node": "Prepare row",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "Prepare row": {
   "main": [
    [
     {
      "node": "Sheets: log paid customer",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "Every day 10:00": {
   "main": [
    [
     {
      "node": "Sheets: read customers",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "Sheets: read customers": {
   "main": [
    [
     {
      "node": "Paid yesterday, not sent",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "Paid yesterday, not sent": {
   "main": [
    [
     {
      "node": "Gmail: ask for review",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "Gmail: ask for review": {
   "main": [
    [
     {
      "node": "Sheets: mark sent",
      "type": "main",
      "index": 0
     }
    ]
   ]
  }
 },
 "settings": {
  "executionOrder": "v1"
 },
 "active": false,
 "pinData": {},
 "meta": {
  "note": "Replace YOUR_* placeholders and attach your own credentials. Not tested on real services."
 }
}