{
  "name": "Tread Connection: Monday AR nudge and daily log check",
  "nodes": [
    {
      "parameters": {
        "content": "## Tread Connection agent template\n1. Credentials: add a Bearer Auth credential holding your Tread Connection API key (treadconnection.ai/my/access) and select it on \"Tread Connection MCP\". Add your Anthropic and Slack credentials.\n2. Set the Slack channel on \"Post to Slack\".\n3. Test each branch with Execute Workflow before publishing. One run uses roughly 4 to 6 of your 100 hourly Tread Connection calls.\n4. The AR branch needs an owner (admin) key. See treadconnection.ai/docs/n8n-agents.",
        "height": 300,
        "width": 420
      },
      "id": "n-note",
      "name": "Setup notes",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        0,
        -140
      ]
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "0 7 * * 1"
            }
          ]
        }
      },
      "id": "n-t1",
      "name": "Monday 7am",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        0,
        240
      ]
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "30 16 * * 1-5"
            }
          ]
        }
      },
      "id": "n-t2",
      "name": "Weekdays 4:30pm",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        0,
        440
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "a1",
              "name": "task",
              "value": "=Today is {{ $now.setZone('America/Chicago').toFormat('cccc, LLLL d, yyyy') }}. Run the Monday receivables check for the owner.\n\n1. Call org_ar_aging once with limit 25. Do not call it again.\n2. Write a short Slack message: total open and total more than 30 days past due, then each customer with an invoice more than 30 days past due (customer, amount, days past due). End with the three customers to call first and one line on why each.\n3. Use only numbers the tool returned. Do not round or estimate, and do not work out anything the tool did not give you.\n4. If org_ar_aging is not in your tool list, the key is not an owner key. Say that in one line and stop.\n5. Read only. Never change anything in JobTread.",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "n-s1",
      "name": "Task: AR nudge",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        260,
        240
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "a2",
              "name": "task",
              "value": "=Today is {{ $now.setZone('America/Chicago').toFormat('cccc, LLLL d, yyyy') }}. Run the daily log check.\n\n1. Call my_jobs once with status active and limit 50.\n2. Call my_dailylogs once with limit 100.\n3. List every active job that has no daily log dated today or yesterday. Give job number, job name and the date of its most recent log, or say it has none in the results.\n4. If the newest 100 logs do not reach back to yesterday for the whole org, say the check may be incomplete instead of listing jobs.\n5. If every active job has a recent log, say so in one line.\n6. Use only what the tools returned. Read only. Never change anything in JobTread.",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "n-s2",
      "name": "Task: daily log gaps",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        260,
        440
      ]
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.task }}",
        "options": {
          "systemMessage": "You are the owner's back-office assistant for a construction company. You read JobTread data through the Tread Connection tools. Write plain, short messages for Slack. No headings, no emoji, no filler.",
          "maxIterations": 6
        }
      },
      "id": "n-agent",
      "name": "Tread Connection agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2,
      "position": [
        540,
        340
      ]
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "id",
          "value": "claude-sonnet-5-5"
        },
        "options": {
          "temperature": 0
        }
      },
      "id": "n-model",
      "name": "Anthropic Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "typeVersion": 1.3,
      "position": [
        500,
        580
      ],
      "credentials": {
        "anthropicApi": {
          "id": "REPLACE_ME",
          "name": "Anthropic account"
        }
      }
    },
    {
      "parameters": {
        "endpointUrl": "https://treadconnection.ai/mcp",
        "serverTransport": "httpStreamable",
        "authentication": "bearerAuth",
        "include": "selected",
        "includeTools": [
          "org_ar_aging",
          "my_jobs",
          "my_dailylogs",
          "job_overview"
        ],
        "options": {
          "timeout": 60000
        }
      },
      "id": "n-mcp",
      "name": "Tread Connection MCP",
      "type": "@n8n/n8n-nodes-langchain.mcpClientTool",
      "typeVersion": 1.2,
      "position": [
        700,
        580
      ],
      "credentials": {
        "httpBearerAuth": {
          "id": "REPLACE_ME",
          "name": "Tread Connection member key"
        }
      }
    },
    {
      "parameters": {
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "id",
          "value": "REPLACE_WITH_SLACK_CHANNEL_ID"
        },
        "text": "={{ $json.output }}",
        "otherOptions": {}
      },
      "id": "n-slack",
      "name": "Post to Slack",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.3,
      "position": [
        860,
        340
      ],
      "credentials": {
        "slackApi": {
          "id": "REPLACE_ME",
          "name": "Slack account"
        }
      }
    }
  ],
  "connections": {
    "Monday 7am": {
      "main": [
        [
          {
            "node": "Task: AR nudge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Weekdays 4:30pm": {
      "main": [
        [
          {
            "node": "Task: daily log gaps",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Task: AR nudge": {
      "main": [
        [
          {
            "node": "Tread Connection agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Task: daily log gaps": {
      "main": [
        [
          {
            "node": "Tread Connection agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Anthropic Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Tread Connection agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Tread Connection MCP": {
      "ai_tool": [
        [
          {
            "node": "Tread Connection agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Tread Connection agent": {
      "main": [
        [
          {
            "node": "Post to Slack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "settings": {
    "executionOrder": "v1",
    "timezone": "America/Chicago"
  },
  "active": false,
  "tags": []
}
