{
  "name": "Gary Club — Deal Stage Changed → SMS",
  "nodes": [
    {
      "parameters": {
        "content": "## ⚡ After import — 3 steps\n\n**1. Bind your credential**\nClick the **Get Contact** and **Send SMS** nodes → set **Credential for Header Auth** to your Gary Club Agency key on both.\n\n**2. Register this webhook in Gary Club**\nCopy the **Production URL** from the **Deal Stage Changed** node. In Gary Club → Settings → Webhooks → add the URL for the `deal.stage_changed` event.\n\n**3. Set your target stage and message**\nIn the **Stage Filter** IF node, replace `Proposal Sent` with the exact stage name that should trigger the SMS. Then edit **SMS Content** to set your message text.\n\n📋 **Notes**\n- `data.contact_id` — CRM contact UUID on the deal.\n- `data.new_stage` — the stage name the deal just moved TO.\n- `data.deal_id` — UUID of the deal (for logging).\n- The **Get Contact** node fetches the contact's phone number using the contact ID from the deal.\n- Change the stage filter value or add more IF branches to send different SMS per stage.\n\n📚 Docs: https://docs.gary.club/api/contacts | https://docs.gary.club/api/sms | https://docs.gary.club/api/webhooks",
        "height": 430,
        "width": 400,
        "color": 5
      },
      "id": "99000000-0000-4000-8000-000000000000",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [-220, 60]
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "gary-deal-stage",
        "responseMode": "responseNode",
        "options": {}
      },
      "id": "99000000-0001-4000-8000-000000000001",
      "name": "Deal Stage Changed",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [260, 300],
      "webhookId": "99000000-webhook-4000-8000-000000000001"
    },
    {
      "parameters": {
        "conditions": {
          "options": { "caseSensitive": false, "leftValue": "", "typeValidation": "loose" },
          "conditions": [
            {
              "id": "c1",
              "leftValue": "={{ $json.body.data.new_stage }}",
              "rightValue": "Proposal Sent",
              "operator": { "type": "string", "operation": "equals" }
            }
          ],
          "combinator": "and"
        }
      },
      "id": "99000000-0002-4000-8000-000000000002",
      "name": "Stage Filter",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [500, 300]
    },
    {
      "parameters": {
        "method": "GET",
        "url": "=https://agency.gary.club/api/public/v1/crm/contacts/{{ $('Deal Stage Changed').item.json.body.data.contact_id }}",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "options": {}
      },
      "id": "99000000-0003-4000-8000-000000000003",
      "name": "Get Contact",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [740, 200]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            { "id": "f1", "name": "to", "value": "={{ $json.phone }}", "type": "string" },
            { "id": "f2", "name": "contact_id", "value": "={{ $json.id }}", "type": "string" },
            { "id": "f3", "name": "body", "value": "={{ 'Hi ' + $json.first_name + \"! Your proposal is on its way — check your inbox. Questions? Just reply here. Reply STOP to opt out.\" }}", "type": "string" }
          ]
        },
        "options": {}
      },
      "id": "99000000-0004-4000-8000-000000000004",
      "name": "SMS Content",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [980, 200]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://agency.gary.club/api/public/v1/sms/messages",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            { "name": "to", "value": "={{ $json.to }}" },
            { "name": "body", "value": "={{ $json.body }}" },
            { "name": "contact_id", "value": "={{ $json.contact_id }}" }
          ]
        },
        "options": {}
      },
      "id": "99000000-0005-4000-8000-000000000005",
      "name": "Send SMS",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [1220, 200]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ JSON.stringify({ ok: true }) }}",
        "options": { "responseCode": 200 }
      },
      "id": "99000000-0006-4000-8000-000000000006",
      "name": "Respond 200",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [500, 460]
    }
  ],
  "connections": {
    "Deal Stage Changed": { "main": [[{ "node": "Stage Filter", "type": "main", "index": 0 }]] },
    "Stage Filter": {
      "main": [
        [{ "node": "Get Contact", "type": "main", "index": 0 }],
        [{ "node": "Respond 200", "type": "main", "index": 0 }]
      ]
    },
    "Get Contact": { "main": [[{ "node": "SMS Content", "type": "main", "index": 0 }]] },
    "SMS Content": { "main": [[{ "node": "Send SMS", "type": "main", "index": 0 }]] }
  },
  "active": false,
  "settings": { "executionOrder": "v1" },
  "tags": [{ "name": "gary-club-api" }]
}
