{
  "name": "Review requests (New Theory template)",
  "nodes": [
    {
      "parameters": {
        "content": "## Review requests: n8n starter\nFree template from New Theory (newtheory.marketing). Built from our playbook records. It is not an official n8n, HubSpot or Zapier template. Every credential is a placeholder: connect your own before you turn it on.\n\n**Fill in, in this order**\n1. **Sale or job done**: publish and send your sale, order or job-done event to the Production URL, from your point of sale, store or CRM, or from a Zap that forwards it.\n2. **Shape the customer**: map your field names and paste your direct review link (Google: Get more reviews > copy link).\n3. **Waits**: about 2 hours after an in-person job, about 5 days after a shipped order.\n4. **Twilio**: connect it and set the From number on your approved A2P 10DLC campaign.\n5. **Email**: connect SMTP and put your postal address in the footer.\n6. **Google Sheets**: connect it and make an Asks tab.\n7. **Customer replied**: point your Twilio number's incoming message webhook here and set the owner's cell.",
        "height": 440,
        "width": 560,
        "color": 4
      },
      "id": "30c2455a-fdf1-422d-a741-54e2307d743d",
      "name": "Start here",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -60,
        -60
      ]
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "review-request",
        "responseMode": "onReceived",
        "options": {}
      },
      "id": "cb710f45-5afa-4ac4-aa30-83feb2426dc0",
      "name": "Sale or job done",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        0,
        520
      ],
      "webhookId": "6df61524-4a15-477d-a8bc-df978eb554b7"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "099b8767-03c6-4339-a206-28fc22509f4a",
              "name": "first_name",
              "value": "={{ $json.body.first_name }}",
              "type": "string"
            },
            {
              "id": "2e973497-3509-435e-a4e2-7c23fbb5cd86",
              "name": "email",
              "value": "={{ String($json.body.email || '').trim().toLowerCase() }}",
              "type": "string"
            },
            {
              "id": "90c0a583-a9f4-43fd-a860-cd86e62acae0",
              "name": "phone",
              "value": "={{ $json.body.phone }}",
              "type": "string"
            },
            {
              "id": "f0529d71-eab3-4d24-a623-f0cbd0fdd7ba",
              "name": "order_id",
              "value": "={{ $json.body.order_id }}",
              "type": "string"
            },
            {
              "id": "726e83a7-a457-4e16-a8f5-2a415acc5ec1",
              "name": "channel",
              "value": "={{ $json.body.channel || 'in_person' }}",
              "type": "string"
            },
            {
              "id": "0c96d801-5d65-49fb-a813-4167d1ff227f",
              "name": "sms_consent",
              "value": "={{ $json.body.sms_consent === true || $json.body.sms_consent === 'yes' }}",
              "type": "boolean"
            },
            {
              "id": "05335208-5ff8-4849-a362-5bad53af58cf",
              "name": "review_link",
              "value": "REPLACE_WITH_YOUR_DIRECT_REVIEW_LINK",
              "type": "string"
            },
            {
              "id": "c16379a5-c1b8-49c5-ac43-2135a45286ea",
              "name": "business_name",
              "value": "REPLACE_WITH_YOUR_BUSINESS_NAME",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "09398ff6-3376-4701-a7c4-0f005e5c380e",
      "name": "Shape the customer",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        220,
        520
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose"
          },
          "conditions": [
            {
              "id": "6c8c84d7-261f-43f6-a492-be2c720c1a39",
              "leftValue": "={{ $json.channel }}",
              "rightValue": "shipped",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "7a1b5b9d-e069-4295-a1c8-c09dd45a73ed",
      "name": "Shipped order?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        440,
        520
      ]
    },
    {
      "parameters": {
        "amount": 5,
        "unit": "days"
      },
      "id": "2bc8e277-f0f4-4df3-a327-cccd6f159ea6",
      "name": "Wait 5 days",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        660,
        420
      ],
      "webhookId": "03c54f55-39c0-4082-a6ae-361295f6afd9"
    },
    {
      "parameters": {
        "amount": 2,
        "unit": "hours"
      },
      "id": "0a40a1af-7a26-458f-a9f2-e061c204cce7",
      "name": "Wait 2 hours",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        660,
        620
      ],
      "webhookId": "5ed10a6b-709a-484e-a0cd-78fd483c4b09"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose"
          },
          "conditions": [
            {
              "id": "9fcdd450-bc57-4c78-aeb4-e492941cc5dc",
              "leftValue": "={{ $('Shape the customer').item.json.sms_consent }}",
              "rightValue": "",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              }
            },
            {
              "id": "180c1475-42f8-4f69-a494-3354045298d0",
              "leftValue": "={{ $('Shape the customer').item.json.phone }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "ef686197-e8d1-4c29-a024-84c2d4c46f57",
      "name": "Can we text?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        880,
        520
      ]
    },
    {
      "parameters": {
        "from": "+15550000000",
        "to": "={{ $('Shape the customer').item.json.phone }}",
        "message": "=Hi {{ $('Shape the customer').item.json.first_name }}, thanks for choosing {{ $('Shape the customer').item.json.business_name }}. How did we do? {{ $('Shape the customer').item.json.review_link }} Reply STOP to opt out.",
        "options": {}
      },
      "id": "62c94f99-0ffe-4603-a9e1-d40cbb2bae9f",
      "name": "Text the review link",
      "type": "n8n-nodes-base.twilio",
      "typeVersion": 1,
      "position": [
        1120,
        420
      ],
      "credentials": {
        "twilioApi": {
          "id": "replace-me",
          "name": "Twilio (connect yours)"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose"
          },
          "conditions": [
            {
              "id": "5e666c00-0108-45f2-aeeb-bb0719985ee0",
              "leftValue": "={{ $('Shape the customer').item.json.email }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "b9741704-e6e7-4f11-a632-9c66beabcfcc",
      "name": "Has an email?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        1120,
        640
      ]
    },
    {
      "parameters": {
        "fromEmail": "REPLACE_WITH_YOUR_SENDER@yourdomain.com",
        "toEmail": "={{ $('Shape the customer').item.json.email }}",
        "subject": "=How did we do, {{ $('Shape the customer').item.json.first_name }}?",
        "emailFormat": "text",
        "text": "=Hi {{ $('Shape the customer').item.json.first_name }},\n\nThanks for your order. If you have a minute, tell people how it went:\n{{ $('Shape the customer').item.json.review_link }}\n\nIf something wasn't right, just reply to this email and I'll fix it.\n\nREPLACE_WITH_YOUR_NAME\n{{ $('Shape the customer').item.json.business_name }}, REPLACE_WITH_POSTAL_ADDRESS\nUnsubscribe: REPLACE_WITH_UNSUBSCRIBE_LINK",
        "options": {}
      },
      "id": "414a5723-f247-4357-a544-e1eedb732482",
      "name": "Email the review link",
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 2.1,
      "position": [
        1340,
        620
      ],
      "credentials": {
        "smtp": {
          "id": "replace-me",
          "name": "SMTP (connect yours)"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "f9bf11e3-a737-4db8-a9ae-842dd7dd448d",
              "name": "asked_at",
              "value": "={{ $now.toISO() }}",
              "type": "string"
            },
            {
              "id": "979e6e63-94ab-490d-a1e0-37e10f3d3868",
              "name": "order_id",
              "value": "={{ $('Shape the customer').item.json.order_id }}",
              "type": "string"
            },
            {
              "id": "dbffc7e7-a60e-473c-a861-7bb23966290f",
              "name": "channel",
              "value": "={{ $('Shape the customer').item.json.channel }}",
              "type": "string"
            },
            {
              "id": "fd051724-3bf4-41bf-a585-8dabf55ad2ab",
              "name": "sent_by",
              "value": "={{ $prevNode.name }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "6009c663-1739-4006-ae6f-81e7d2bac10f",
      "name": "Asked row",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1580,
        520
      ]
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "value": "REPLACE_WITH_YOUR_SHEET_ID",
          "mode": "id"
        },
        "sheetName": {
          "__rl": true,
          "value": "Asks",
          "mode": "name"
        },
        "columns": {
          "mappingMode": "autoMapInputData",
          "value": {},
          "matchingColumns": [],
          "schema": []
        },
        "options": {}
      },
      "id": "aaae400a-c044-423d-a8e4-e8ccb66cc400",
      "name": "Log the ask",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [
        1800,
        520
      ],
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "replace-me",
          "name": "Google Sheets (connect yours)"
        }
      }
    },
    {
      "parameters": {
        "content": "### Ask everyone the same way\n- No rating screen, NPS branch or feedback score in front of the link. Google calls that selective solicitation.\n- No discount, prize or freebie in the same message. Google and Trustpilot ban it.\n- Texts only to people who opted in. Honor STOP and the other opt-out words.\n- One ask per purchase and one reminder at most.",
        "height": 240,
        "width": 460,
        "color": 3
      },
      "id": "aa32a180-c59e-4cfd-ad8f-bad1fc487163",
      "name": "Rules",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        860,
        140
      ]
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "review-replies",
        "responseMode": "onReceived",
        "options": {}
      },
      "id": "5ff849eb-7e46-4efe-a3fe-17bc126333b1",
      "name": "Customer replied (Twilio)",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        0,
        900
      ],
      "webhookId": "36176908-2bf8-425c-a2bd-5ac5a5357c14"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose"
          },
          "conditions": [
            {
              "id": "99bdc432-2e6a-4cf6-a9bb-c5d93e6da860",
              "leftValue": "={{ ['STOP','UNSUBSCRIBE','END','QUIT','STOPALL','REVOKE','OPTOUT','CANCEL','JOIN'].includes(String($json.body.Body || '').trim().toUpperCase()) }}",
              "rightValue": "",
              "operator": {
                "type": "boolean",
                "operation": "false",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "665aec08-e578-43af-af42-b36ab6899d09",
      "name": "Not an opt-out word?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        220,
        900
      ]
    },
    {
      "parameters": {
        "from": "+15550000000",
        "to": "REPLACE_WITH_OWNER_CELL",
        "message": "=Reply from {{ $('Customer replied (Twilio)').item.json.body.From }}: {{ $('Customer replied (Twilio)').item.json.body.Body }}",
        "options": {}
      },
      "id": "f16ea0f9-001a-45ea-a748-411881beed8e",
      "name": "Forward to the owner",
      "type": "n8n-nodes-base.twilio",
      "typeVersion": 1,
      "position": [
        440,
        900
      ],
      "credentials": {
        "twilioApi": {
          "id": "replace-me",
          "name": "Twilio (connect yours)"
        }
      }
    }
  ],
  "connections": {
    "Sale or job done": {
      "main": [
        [
          {
            "node": "Shape the customer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Shape the customer": {
      "main": [
        [
          {
            "node": "Shipped order?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Shipped order?": {
      "main": [
        [
          {
            "node": "Wait 5 days",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait 2 hours",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 5 days": {
      "main": [
        [
          {
            "node": "Can we text?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 2 hours": {
      "main": [
        [
          {
            "node": "Can we text?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Can we text?": {
      "main": [
        [
          {
            "node": "Text the review link",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Has an email?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Has an email?": {
      "main": [
        [
          {
            "node": "Email the review link",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Text the review link": {
      "main": [
        [
          {
            "node": "Asked row",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email the review link": {
      "main": [
        [
          {
            "node": "Asked row",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Asked row": {
      "main": [
        [
          {
            "node": "Log the ask",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Customer replied (Twilio)": {
      "main": [
        [
          {
            "node": "Not an opt-out word?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Not an opt-out word?": {
      "main": [
        [
          {
            "node": "Forward to the owner",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {},
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "tags": []
}
