{
  "id": "kw0000000000001",
  "name": "kintone の Webhook で新規レコードを Chatwork に通知",
  "active": false,
  "nodes": [
    {
      "id": "w1",
      "name": "kintone の Webhook を受ける",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [0, 0],
      "webhookId": "b2c3d4e5-0000-4000-8000-000000000003",
      "parameters": {
        "httpMethod": "POST",
        "path": "kintone-record",
        "responseMode": "onReceived",
        "options": {}
      }
    },
    {
      "id": "w2",
      "name": "新規登録だけ通す",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [240, 0],
      "parameters": {
        "conditions": {
          "options": { "caseSensitive": true, "leftValue": "", "typeValidation": "strict" },
          "conditions": [
            {
              "id": "c1",
              "leftValue": "={{ $json.body.type }}",
              "rightValue": "ADD_RECORD",
              "operator": { "type": "string", "operation": "equals" }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      }
    },
    {
      "id": "w3",
      "name": "Chatwork に投稿",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [480, -100],
      "parameters": {
        "method": "POST",
        "url": "={{ $env.CHATWORK_BASE }}/v2/rooms/{{ $env.CHATWORK_ROOM }}/messages",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [{ "name": "X-ChatWorkToken", "value": "={{ $env.CHATWORK_TOKEN }}" }]
        },
        "sendBody": true,
        "contentType": "form-urlencoded",
        "bodyParameters": {
          "parameters": [
            {
              "name": "body",
              "value": "=[info][title]kintone に新しいレコード（{{ $json.body.app.name }}）[/title]会社名: {{ $json.body.record['会社名'].value }}\n担当者: {{ $json.body.record['担当者'].value }}\nレコード番号: {{ $json.body.record['$id'].value }}\n{{ $json.body.url }}[/info]"
            }
          ]
        },
        "options": {}
      }
    },
    {
      "id": "w4",
      "name": "通知しない（編集・削除など）",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [480, 100],
      "parameters": {}
    }
  ],
  "connections": {
    "kintone の Webhook を受ける": {
      "main": [[{ "node": "新規登録だけ通す", "type": "main", "index": 0 }]]
    },
    "新規登録だけ通す": {
      "main": [
        [{ "node": "Chatwork に投稿", "type": "main", "index": 0 }],
        [{ "node": "通知しない（編集・削除など）", "type": "main", "index": 0 }]
      ]
    }
  },
  "settings": { "executionOrder": "v1" },
  "versionId": "33333333-3333-4333-8333-333333333333"
}
