{
  "name": "INV 02 - Telegram Escalation Approval Dispatcher",
  "nodes": [
    {
      "name": "Dispatcher Instructions",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -1100,
        -430
      ],
      "parameters": {
        "content": "## Telegram approval dispatcher\nApprove sends the proposed reminder after a live invoice recheck. Edit asks for a Telegram reply and sends the edited text. Skip records no-send. Defer returns the item to the daily planner after 24 hours.",
        "height": 280,
        "width": 760,
        "color": 5
      }
    },
    {
      "name": "Telegram Finance Bot Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "typeVersion": 1.4,
      "position": [
        -1040,
        40
      ],
      "parameters": {
        "updates": [
          "callback_query",
          "message"
        ],
        "additionalFields": {
          "chatIds": "OWNER_CHAT_ID",
          "userIds": "OWNER_CHAT_ID"
        }
      }
    },
    {
      "name": "Normalize Telegram Event",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        -800,
        40
      ],
      "parameters": {
        "jsCode": "const cb=$json.callback_query; const msg=$json.message; if(cb){const [raw,id]=String(cb.data||'').split('|'); return [{json:{event_type:'CALLBACK',action:raw.toUpperCase(),approval_id:id||'',chat_id:String(cb.message?.chat?.id||''),message_id:cb.message?.message_id||'',callback_query_id:cb.id||'',actor_id:String(cb.from?.id||'')}}];}\nreturn [{json:{event_type:'MESSAGE',chat_id:String(msg?.chat?.id||''),actor_id:String(msg?.from?.id||''),text:String(msg?.text||'').trim(),reply_to_message_id:msg?.reply_to_message?.message_id||'',message_id:msg?.message_id||''}}];"
      }
    },
    {
      "name": "Is Button Callback?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        -380,
        40
      ],
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "condition-2",
              "leftValue": "={{ $json.event_type }}",
              "rightValue": "CALLBACK",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      }
    },
    {
      "name": "Acknowledge Button Click",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        -260,
        -140
      ],
      "parameters": {
        "resource": "callback",
        "operation": "answerQuery",
        "queryId": "={{ $(\"Normalize Telegram Event\").item.json.callback_query_id }}",
        "additionalFields": {
          "text": "Processing your decision…",
          "cache_time": 0
        }
      }
    },
    {
      "name": "Read Approval Queue - Callback",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        -140,
        -140
      ],
      "parameters": {
        "authentication": "oAuth2",
        "resource": "sheet",
        "operation": "read",
        "documentId": {
          "mode": "id",
          "value": "SPREADSHEET_ID"
        },
        "sheetName": {
          "mode": "id",
          "value": "APPROVAL_QUEUE_SHEET_ID"
        },
        "filtersUI": {},
        "combineFilters": "AND",
        "options": {}
      },
      "alwaysOutputData": true
    },
    {
      "name": "Validate Pending Approval",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        100,
        -140
      ],
      "parameters": {
        "jsCode": "const e=$('Normalize Telegram Event').item.json; const q=$input.all().map(i=>i.json).find(x=>String(x.approval_id)===String(e.approval_id)); const now=new Date();\nif(!q||String(e.chat_id)!=='OWNER_CHAT_ID'||!['PENDING','EDITING','DEFERRED'].includes(String(q.status).toUpperCase())||(q.expires_at&&new Date(q.expires_at)<now)) return [{json:{...e,valid:false,reason:'This approval is missing, expired, or already resolved.'}}];\nreturn [{json:{...q,...e,valid:true}}];"
      }
    },
    {
      "name": "Reject Invalid Callback",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        340,
        -140
      ],
      "parameters": {
        "jsCode": "if(!$json.valid||!['APPROVE','EDIT','SKIP','DEFER'].includes(String($json.action).toUpperCase())) return []; return [{json:$json}];"
      }
    },
    {
      "name": "Approve Selected?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        580,
        -120
      ],
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "condition-3",
              "leftValue": "={{ $json.action }}",
              "rightValue": "APPROVE",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      }
    },
    {
      "name": "Live Re-read Invoices - Approval",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        820,
        -320
      ],
      "parameters": {
        "authentication": "oAuth2",
        "resource": "sheet",
        "operation": "read",
        "documentId": {
          "mode": "id",
          "value": "SPREADSHEET_ID"
        },
        "sheetName": {
          "mode": "id",
          "value": "INVOICES_SHEET_ID"
        },
        "filtersUI": {},
        "combineFilters": "AND",
        "options": {}
      }
    },
    {
      "name": "Prepare Approved Send",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1060,
        -320
      ],
      "parameters": {
        "jsCode": "const q=$('Validate Pending Approval').item.json; const live=$input.all().map(i=>i.json).find(x=>String(x.invoice_id)===String(q.invoice_id)); const blocked=!live||Number(live.balance_due)<=0||['PAID','VOID','CANCELLED','DISPUTED'].includes(String(live.status).toUpperCase())||String(live.is_disputed).toLowerCase()==='true'; if(blocked) return [];\nreturn [{json:{...q,...live,email_to:live.customer_email,email_subject:q.final_subject||q.proposed_subject,email_body:q.final_body||q.proposed_body,balance_at_event:Number(live.balance_due),event_id:`EVT-${Date.now()}-${q.approval_id}`,event_type:'REMINDER',event_status:'READY',owner_action:'APPROVE',provider:'SMTP'}}];"
      }
    },
    {
      "name": "Send Approved Reminder via SMTP",
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 2.1,
      "position": [
        1300,
        -320
      ],
      "parameters": {
        "resource": "email",
        "operation": "send",
        "fromEmail": "SENDER_NAME <VERIFIED_FROM_ADDRESS>",
        "toEmail": "={{ $json.email_to }}",
        "subject": "={{ $json.email_subject }}",
        "emailFormat": "text",
        "text": "={{ $json.email_body }}",
        "options": {
          "appendAttribution": false
        }
      }
    },
    {
      "name": "Build Approved Resolution",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1540,
        -320
      ],
      "parameters": {
        "jsCode": "const p=$('Prepare Approved Send').item.json; const at=new Date().toISOString(); return [{json:{...p,status:'APPROVED',delivery_status:'SENT',delivery_detail:'SMTP reminder sent',last_updated_at:at,event_status:'SENT',subject:p.email_subject,body:p.email_body,provider_message_id:$json.messageId??$json.id??'',error_summary:'',created_at:at}}];"
      }
    },
    {
      "name": "Update Approved Queue",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 3,
      "position": [
        1780,
        -380
      ],
      "parameters": {
        "authentication": "oAuth2",
        "resource": "sheet",
        "operation": "appendOrUpdate",
        "documentId": {
          "mode": "id",
          "value": "SPREADSHEET_ID"
        },
        "sheetName": {
          "mode": "id",
          "value": "APPROVAL_QUEUE_SHEET_ID"
        },
        "dataMode": "autoMapInputData",
        "columnToMatchOn": "approval_id",
        "options": {
          "handlingExtraData": "ignoreIt"
        }
      }
    },
    {
      "name": "Append Approved Log",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 3,
      "position": [
        1780,
        -240
      ],
      "parameters": {
        "authentication": "oAuth2",
        "resource": "sheet",
        "operation": "append",
        "documentId": {
          "mode": "id",
          "value": "SPREADSHEET_ID"
        },
        "sheetName": {
          "mode": "id",
          "value": "REMINDER_LOG_SHEET_ID"
        },
        "dataMode": "autoMapInputData",
        "options": {
          "handlingExtraData": "ignoreIt"
        }
      }
    },
    {
      "name": "Confirm Approved Send",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        2020,
        -320
      ],
      "parameters": {
        "resource": "message",
        "operation": "sendMessage",
        "chatId": "OWNER_CHAT_ID",
        "text": "={{ `✅ Reminder sent for invoice ${$(\"Build Approved Resolution\").item.json.invoice_number}.` }}",
        "additionalFields": {
          "parse_mode": "HTML",
          "appendAttribution": false
        }
      }
    },
    {
      "name": "Edit Selected?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        820,
        100
      ],
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "condition-4",
              "leftValue": "={{ $json.action }}",
              "rightValue": "EDIT",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      }
    },
    {
      "name": "Ask for Edited Reminder",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        1060,
        60
      ],
      "parameters": {
        "resource": "message",
        "operation": "sendMessage",
        "chatId": "OWNER_CHAT_ID",
        "text": "={{ `✏️ Reply directly to this message with the complete replacement reminder for invoice ${$(\"Validate Pending Approval\").item.json.invoice_number}. The subject will remain: ${$(\"Validate Pending Approval\").item.json.proposed_subject}` }}",
        "additionalFields": {
          "parse_mode": "HTML",
          "appendAttribution": false
        }
      }
    },
    {
      "name": "Save Edit Prompt Context",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1300,
        60
      ],
      "parameters": {
        "jsCode": "const q=$('Validate Pending Approval').item.json; return [{json:{...q,status:'EDITING',owner_action:'EDIT',edit_prompt_message_id:$json.result?.message_id??$json.message_id??'',last_updated_at:new Date().toISOString()}}];"
      }
    },
    {
      "name": "Update Queue for Edit",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 3,
      "position": [
        1540,
        60
      ],
      "parameters": {
        "authentication": "oAuth2",
        "resource": "sheet",
        "operation": "appendOrUpdate",
        "documentId": {
          "mode": "id",
          "value": "SPREADSHEET_ID"
        },
        "sheetName": {
          "mode": "id",
          "value": "APPROVAL_QUEUE_SHEET_ID"
        },
        "dataMode": "autoMapInputData",
        "columnToMatchOn": "approval_id",
        "options": {
          "handlingExtraData": "ignoreIt"
        }
      }
    },
    {
      "name": "Skip Selected?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        1060,
        300
      ],
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "condition-5",
              "leftValue": "={{ $json.action }}",
              "rightValue": "SKIP",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      }
    },
    {
      "name": "Build Skip Resolution",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1300,
        260
      ],
      "parameters": {
        "jsCode": "const q=$('Validate Pending Approval').item.json; const at=new Date().toISOString(); return [{json:{...q,status:'SKIPPED',owner_action:'SKIP',delivery_status:'NOT_SENT',delivery_detail:'Owner skipped reminder',last_updated_at:at,event_id:`EVT-${Date.now()}-${q.approval_id}`,event_type:'APPROVAL',event_status:'SKIPPED',subject:q.proposed_subject,body:q.proposed_body,balance_at_event:q.balance_snapshot,provider:'NONE',provider_message_id:'',error_summary:'',created_at:at}}];"
      }
    },
    {
      "name": "Update Skipped Queue",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 3,
      "position": [
        1540,
        220
      ],
      "parameters": {
        "authentication": "oAuth2",
        "resource": "sheet",
        "operation": "appendOrUpdate",
        "documentId": {
          "mode": "id",
          "value": "SPREADSHEET_ID"
        },
        "sheetName": {
          "mode": "id",
          "value": "APPROVAL_QUEUE_SHEET_ID"
        },
        "dataMode": "autoMapInputData",
        "columnToMatchOn": "approval_id",
        "options": {
          "handlingExtraData": "ignoreIt"
        }
      }
    },
    {
      "name": "Append Skip Log",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 3,
      "position": [
        1540,
        340
      ],
      "parameters": {
        "authentication": "oAuth2",
        "resource": "sheet",
        "operation": "append",
        "documentId": {
          "mode": "id",
          "value": "SPREADSHEET_ID"
        },
        "sheetName": {
          "mode": "id",
          "value": "REMINDER_LOG_SHEET_ID"
        },
        "dataMode": "autoMapInputData",
        "options": {
          "handlingExtraData": "ignoreIt"
        }
      }
    },
    {
      "name": "Confirm Skipped",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        1780,
        280
      ],
      "parameters": {
        "resource": "message",
        "operation": "sendMessage",
        "chatId": "OWNER_CHAT_ID",
        "text": "={{ `⏭ Reminder skipped for invoice ${$(\"Build Skip Resolution\").item.json.invoice_number}.` }}",
        "additionalFields": {
          "parse_mode": "HTML",
          "appendAttribution": false
        }
      }
    },
    {
      "name": "Build Defer Resolution",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1300,
        500
      ],
      "parameters": {
        "jsCode": "const q=$('Validate Pending Approval').item.json; const at=new Date(); return [{json:{...q,status:'DEFERRED',owner_action:'DEFER',defer_until:new Date(at.getTime()+86400000).toISOString(),delivery_status:'DEFERRED',delivery_detail:'Deferred 24 hours',last_updated_at:at.toISOString()}}];"
      }
    },
    {
      "name": "Update Deferred Queue",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 3,
      "position": [
        1540,
        500
      ],
      "parameters": {
        "authentication": "oAuth2",
        "resource": "sheet",
        "operation": "appendOrUpdate",
        "documentId": {
          "mode": "id",
          "value": "SPREADSHEET_ID"
        },
        "sheetName": {
          "mode": "id",
          "value": "APPROVAL_QUEUE_SHEET_ID"
        },
        "dataMode": "autoMapInputData",
        "columnToMatchOn": "approval_id",
        "options": {
          "handlingExtraData": "ignoreIt"
        }
      }
    },
    {
      "name": "Confirm Deferred",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        1780,
        500
      ],
      "parameters": {
        "resource": "message",
        "operation": "sendMessage",
        "chatId": "OWNER_CHAT_ID",
        "text": "={{ `🕒 Invoice ${$(\"Build Defer Resolution\").item.json.invoice_number} deferred for 24 hours.` }}",
        "additionalFields": {
          "parse_mode": "HTML",
          "appendAttribution": false
        }
      }
    },
    {
      "name": "Read Approval Queue - Edit Reply",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        -140,
        420
      ],
      "parameters": {
        "authentication": "oAuth2",
        "resource": "sheet",
        "operation": "read",
        "documentId": {
          "mode": "id",
          "value": "SPREADSHEET_ID"
        },
        "sheetName": {
          "mode": "id",
          "value": "APPROVAL_QUEUE_SHEET_ID"
        },
        "filtersUI": {},
        "combineFilters": "AND",
        "options": {}
      },
      "alwaysOutputData": true
    },
    {
      "name": "Match Edit Reply",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        100,
        420
      ],
      "parameters": {
        "jsCode": "const e=$('Normalize Telegram Event').item.json; const q=$input.all().map(i=>i.json).find(x=>String(x.edit_prompt_message_id)===String(e.reply_to_message_id)&&String(x.status).toUpperCase()==='EDITING'); if(!q||String(e.chat_id)!=='OWNER_CHAT_ID'||!e.text) return []; return [{json:{...q,...e,final_body:e.text,owner_action:'EDIT'}}];"
      }
    },
    {
      "name": "Live Re-read Invoices - Edited",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        340,
        420
      ],
      "parameters": {
        "authentication": "oAuth2",
        "resource": "sheet",
        "operation": "read",
        "documentId": {
          "mode": "id",
          "value": "SPREADSHEET_ID"
        },
        "sheetName": {
          "mode": "id",
          "value": "INVOICES_SHEET_ID"
        },
        "filtersUI": {},
        "combineFilters": "AND",
        "options": {}
      }
    },
    {
      "name": "Prepare Edited Send",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        580,
        420
      ],
      "parameters": {
        "jsCode": "const q=$('Match Edit Reply').item.json; const live=$input.all().map(i=>i.json).find(x=>String(x.invoice_id)===String(q.invoice_id)); const blocked=!live||Number(live.balance_due)<=0||['PAID','VOID','CANCELLED','DISPUTED'].includes(String(live.status).toUpperCase())||String(live.is_disputed).toLowerCase()==='true'; if(blocked) return [];\nreturn [{json:{...q,...live,email_to:live.customer_email,email_subject:q.final_subject||q.proposed_subject,email_body:q.final_body,balance_at_event:Number(live.balance_due),event_id:`EVT-${Date.now()}-${q.approval_id}`,event_type:'REMINDER',event_status:'READY',provider:'SMTP'}}];"
      }
    },
    {
      "name": "Send Edited Reminder via SMTP",
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 2.1,
      "position": [
        820,
        420
      ],
      "parameters": {
        "resource": "email",
        "operation": "send",
        "fromEmail": "SENDER_NAME <VERIFIED_FROM_ADDRESS>",
        "toEmail": "={{ $json.email_to }}",
        "subject": "={{ $json.email_subject }}",
        "emailFormat": "text",
        "text": "={{ $json.email_body }}",
        "options": {
          "appendAttribution": false
        }
      }
    },
    {
      "name": "Build Edited Resolution",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1060,
        420
      ],
      "parameters": {
        "jsCode": "const p=$('Prepare Edited Send').item.json; const at=new Date().toISOString(); return [{json:{...p,status:'APPROVED',delivery_status:'SENT',delivery_detail:'Edited SMTP reminder sent',last_updated_at:at,event_status:'SENT',subject:p.email_subject,body:p.email_body,provider_message_id:$json.messageId??$json.id??'',error_summary:'',created_at:at}}];"
      }
    },
    {
      "name": "Update Edited Queue",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 3,
      "position": [
        1300,
        380
      ],
      "parameters": {
        "authentication": "oAuth2",
        "resource": "sheet",
        "operation": "appendOrUpdate",
        "documentId": {
          "mode": "id",
          "value": "SPREADSHEET_ID"
        },
        "sheetName": {
          "mode": "id",
          "value": "APPROVAL_QUEUE_SHEET_ID"
        },
        "dataMode": "autoMapInputData",
        "columnToMatchOn": "approval_id",
        "options": {
          "handlingExtraData": "ignoreIt"
        }
      }
    },
    {
      "name": "Append Edited Log",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 3,
      "position": [
        1300,
        460
      ],
      "parameters": {
        "authentication": "oAuth2",
        "resource": "sheet",
        "operation": "append",
        "documentId": {
          "mode": "id",
          "value": "SPREADSHEET_ID"
        },
        "sheetName": {
          "mode": "id",
          "value": "REMINDER_LOG_SHEET_ID"
        },
        "dataMode": "autoMapInputData",
        "options": {
          "handlingExtraData": "ignoreIt"
        }
      }
    },
    {
      "name": "Confirm Edited Send",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        1540,
        420
      ],
      "parameters": {
        "resource": "message",
        "operation": "sendMessage",
        "chatId": "OWNER_CHAT_ID",
        "text": "={{ `✅ Edited reminder sent for invoice ${$(\"Build Edited Resolution\").item.json.invoice_number}.` }}",
        "additionalFields": {
          "parse_mode": "HTML",
          "appendAttribution": false
        }
      }
    }
  ],
  "connections": {
    "Telegram Finance Bot Trigger": {
      "main": [
        [
          {
            "node": "Normalize Telegram Event",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Telegram Event": {
      "main": [
        [
          {
            "node": "Is Button Callback?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is Button Callback?": {
      "main": [
        [
          {
            "node": "Acknowledge Button Click",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Read Approval Queue - Edit Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Acknowledge Button Click": {
      "main": [
        [
          {
            "node": "Read Approval Queue - Callback",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Approval Queue - Callback": {
      "main": [
        [
          {
            "node": "Validate Pending Approval",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate Pending Approval": {
      "main": [
        [
          {
            "node": "Reject Invalid Callback",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Reject Invalid Callback": {
      "main": [
        [
          {
            "node": "Approve Selected?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Approve Selected?": {
      "main": [
        [
          {
            "node": "Live Re-read Invoices - Approval",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Edit Selected?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Live Re-read Invoices - Approval": {
      "main": [
        [
          {
            "node": "Prepare Approved Send",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Approved Send": {
      "main": [
        [
          {
            "node": "Send Approved Reminder via SMTP",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Approved Reminder via SMTP": {
      "main": [
        [
          {
            "node": "Build Approved Resolution",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Approved Resolution": {
      "main": [
        [
          {
            "node": "Update Approved Queue",
            "type": "main",
            "index": 0
          },
          {
            "node": "Append Approved Log",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Approved Queue": {
      "main": [
        [
          {
            "node": "Confirm Approved Send",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Selected?": {
      "main": [
        [
          {
            "node": "Ask for Edited Reminder",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Skip Selected?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ask for Edited Reminder": {
      "main": [
        [
          {
            "node": "Save Edit Prompt Context",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save Edit Prompt Context": {
      "main": [
        [
          {
            "node": "Update Queue for Edit",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Skip Selected?": {
      "main": [
        [
          {
            "node": "Build Skip Resolution",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Build Defer Resolution",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Skip Resolution": {
      "main": [
        [
          {
            "node": "Update Skipped Queue",
            "type": "main",
            "index": 0
          },
          {
            "node": "Append Skip Log",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Skipped Queue": {
      "main": [
        [
          {
            "node": "Confirm Skipped",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Defer Resolution": {
      "main": [
        [
          {
            "node": "Update Deferred Queue",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Deferred Queue": {
      "main": [
        [
          {
            "node": "Confirm Deferred",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Approval Queue - Edit Reply": {
      "main": [
        [
          {
            "node": "Match Edit Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Match Edit Reply": {
      "main": [
        [
          {
            "node": "Live Re-read Invoices - Edited",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Live Re-read Invoices - Edited": {
      "main": [
        [
          {
            "node": "Prepare Edited Send",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Edited Send": {
      "main": [
        [
          {
            "node": "Send Edited Reminder via SMTP",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Edited Reminder via SMTP": {
      "main": [
        [
          {
            "node": "Build Edited Resolution",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Edited Resolution": {
      "main": [
        [
          {
            "node": "Update Edited Queue",
            "type": "main",
            "index": 0
          },
          {
            "node": "Append Edited Log",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Edited Queue": {
      "main": [
        [
          {
            "node": "Confirm Edited Send",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "timezone": "TIMEZONE",
    "saveManualExecutions": true,
    "saveExecutionProgress": true,
    "saveDataErrorExecution": "all",
    "saveDataSuccessExecution": "all",
    "executionTimeout": 300
  },
  "pinData": {},
  "tags": []
}
