{
  "name": "TelePilot: Listen to Events with Mapper",
  "nodes": [
    {
      "parameters": {
        "events": [
          "updateNewMessage"
        ]
      },
      "id": "129ad3b2-f2f4-420d-9f0e-8425127a8dda",
      "name": "TelePilot Trigger",
      "type": "@telepilotco/n8n-nodes-telepilot.telePilotTrigger",
      "typeVersion": 1,
      "position": [
        420,
        600
      ],
      "credentials": {
        "telePilotApi": {
          "id": "41",
          "name": "Personal Telegram Co-Pilot account"
        }
      }
    },
    {
      "parameters": {
        "operation": "insert",
        "collection": "all_events",
        "fields": "={{ Object.keys($json).join(\",\") }}",
        "options": {}
      },
      "id": "c6884fc9-918d-4eb0-88fc-e5fb85e9dccd",
      "name": "MongoDB",
      "type": "n8n-nodes-base.mongoDb",
      "typeVersion": 1,
      "position": [
        980,
        600
      ],
      "credentials": {
        "mongoDb": {
          "id": "20",
          "name": "MongoDB account"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "// Get the first item from input (usually the data from the previous node)\nlet item = items[0].json;\n\n// Extract the required fields\nlet result = {\n    \"_\": item._,\n    \"id\": item.message.id,\n    \"senderType\": item.message.sender_id._,\n    \"user_id\": item.message.sender_id.user_id,\n    \"chat_id\": item.message.chat_id,\n    \"text\": item.message.content.text.text,\n};\n\n// Output the transformed item\nreturn [\n    {\n        json: result\n    }\n];\n"
      },
      "id": "9c45fe38-b10d-42e5-a89c-f696a4a22c0b",
      "name": "Code",
      "type": "n8n-nodes-base.code",
      "typeVersion": 1,
      "position": [
        640,
        600
      ]
    }
  ],
  "pinData": {},
  "connections": {
    "TelePilot Trigger": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code": {
      "main": [
        [
          {
            "node": "MongoDB",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {},
  "versionId": "d66df447-f493-42a0-811c-16d85ddbb9ee",
  "id": "34",
  "meta": {
    "instanceId": "instanceId"
  },
  "tags": [
    {
      "createdAt": "2023-06-13T12:43:46.639Z",
      "updatedAt": "2023-06-13T12:43:46.639Z",
      "id": "10",
      "name": "telepilot-workflows"
    }
  ]
}