{
  "name": "tool_draft_email",
  "nodes": [
    {
      "id": "Start",
      "name": "Start",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "typeVersion": 1,
      "position": [
        -620,
        180
      ],
      "parameters": {}
    },
    {
      "id": "Create Draft",
      "name": "Create Draft",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        -380,
        180
      ],
      "parameters": {
        "resource": "draft",
        "operation": "create",
        "toList": "={{ $json.to }}",
        "subject": "={{ $json.subject }}",
        "message": "={{ $json.body }}"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      }
    },
    {
      "id": "Wait Approval",
      "name": "Wait Approval",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        -120,
        180
      ],
      "parameters": {
        "resume": "webhook"
      }
    },
    {
      "id": "Approved?",
      "name": "Approved?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        120,
        180
      ],
      "parameters": {
        "conditions": {
          "boolean": [
            {
              "value1": "={{ $json.approved }}",
              "operation": "isTrue"
            }
          ]
        }
      }
    },
    {
      "id": "Send Message",
      "name": "Send Message",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        340,
        120
      ],
      "parameters": {
        "resource": "message",
        "operation": "send",
        "toList": "={{ $('Start').item.json.to }}",
        "subject": "={{ $('Start').item.json.subject }}",
        "message": "={{ $('Start').item.json.body }}"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      }
    },
    {
      "id": "Rejected",
      "name": "Rejected",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        340,
        260
      ],
      "parameters": {
        "keepOnlySet": true,
        "values": {
          "string": [
            {
              "name": "status",
              "value": "rejected"
            }
          ]
        }
      }
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Create Draft",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Draft": {
      "main": [
        [
          {
            "node": "Wait Approval",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait Approval": {
      "main": [
        [
          {
            "node": "Approved?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Approved?": {
      "main": [
        [
          {
            "node": "Send Message",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Rejected",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false
}