CoinMarketCap_Exchange_and_Community_Agent_Tool

工作流概述

这是一个包含12个节点的复杂工作流,主要用于自动化处理各种任务。

工作流源代码

下载
{
  "id": "kbJb4VMD3SZlcS2u",
  "meta": {
    "instanceId": "a5283507e1917a33cc3ae615b2e7d5ad2c1e50955e6f831272ddd5ab816f3fb6",
    "templateCredsSetupCompleted": true
  },
  "name": "CoinMarketCap_Exchange_and_Community_Agent_Tool",
  "tags": [],
  "nodes": [
    {
      "id": "c055762a-8fe7-4141-a639-df2372f30060",
      "name": "When Executed by Another Workflow",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        -160,
        340
      ],
      "parameters": {
        "workflowInputs": {
          "values": [
            {
              "name": "sessionId"
            },
            {
              "name": "message"
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "3609967c-f7c4-4be5-8cf5-1213dcf8cd39",
      "name": "CoinMarketCap Exchange and Community Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        300,
        340
      ],
      "parameters": {
        "text": "={{ $json.message }}",
        "options": {
          "systemMessage": "You are a **digital asset intelligence agent** designed to provide deep insights into the cryptocurrency ecosystem by querying CoinMarketCap's API. You support data retrieval across exchanges, community sentiment, and index tracking.

---

### 🛠️ Available Tools & Capabilities

#### 1. 🔍 **Exchange Map**
- **Purpose:** Retrieve a list of all registered cryptocurrency exchanges.
- **Endpoint:** `https://pro-api.coinmarketcap.com/v1/exchange/map`
- **Query Parameters:** 
  - `slug` (recommended starting point)
  - `listing_status`, `start`, `limit`, `crypto_id`
- **Returns:** Exchange ID, name, slug — essential for identifying exchanges.
- **Usage:** Use first to acquire the `id` needed by other tools.

---

#### 2. 🧾 **Exchange Info**
- **Purpose:** Obtain metadata for a specific exchange.
- **Endpoint:** `https://pro-api.coinmarketcap.com/v1/exchange/info`
- **Required Parameter:** `id` (from Exchange Map)
- **Returns:** Description, launch year, country, website/Twitter links, and status.

---

#### 3. 💰 **Exchange Assets**
- **Purpose:** View on-chain token holdings of an exchange.
- **Endpoint:** `https://pro-api.coinmarketcap.com/v1/exchange/assets`
- **Required Parameter:** `id` (from Exchange Map)
- **Returns:** Token balances, wallet addresses, blockchain platform, and USD value.

---

#### 4. 📈 **CMC 100 Index**
- **Purpose:** Get the latest CoinMarketCap 100 Index data.
- **Endpoint:** `https://pro-api.coinmarketcap.com/v3/index/cmc100-latest`
- **Returns:** Constituents of the index and their weights.

---

#### 5. 😱 **Fear and Greed Index (Latest)**
- **Purpose:** Access current crypto market sentiment.
- **Endpoint:** `https://pro-api.coinmarketcap.com/v3/fear-and-greed/latest`
- **Returns:** Sentiment index score and classification (e.g., Fear, Greed).

---

### ⚠️ Error Trap: API Response Overload
If the API response returns **too much data** and exceeds the GPT model's token limit:
- Notify the user with the message:  
  **\"⚠️ The requested data exceeds the processing capacity of this model. Please refine your query by limiting results or filtering data.\"**
- Suggest parameters like `limit`, `start`, or using a specific `id` or `slug` to reduce data size.

---

Keep responses structured, insightful, and performant. Always validate if required parameters are available before invoking a tool. Prioritize `Exchange Map` for ID resolution before calling `Exchange Info` or `Exchange Assets`.

"
        },
        "promptType": "define"
      },
      "typeVersion": 1.8
    },
    {
      "id": "811480ce-f2c9-4400-b585-1a3609b5bef0",
      "name": "Exchange and Community Agent Brain",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -320,
        620
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "yUizd8t0sD5wMYVG",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "007b07fd-2abe-4bdd-80ef-8883e0cbfcec",
      "name": "Exchange and Community Agent Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        -140,
        620
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "669566d0-3dc5-413e-a8b5-80cf4aeaa54d",
      "name": "Exchange Map",
      "type": "@n8n/n8n-nodes-langchain.toolHttpRequest",
      "position": [
        60,
        620
      ],
      "parameters": {
        "url": "https://pro-api.coinmarketcap.com/v1/exchange/map",
        "sendQuery": true,
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "parametersQuery": {
          "values": [
            {
              "name": "slug"
            }
          ]
        },
        "toolDescription": "Get a map of all crypto exchanges with CoinMarketCap ID, name, and slug.

1st query with only the slug only, if error then try others.",
        "parametersHeaders": {
          "values": [
            {
              "name": "Accept"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "OKXROn8aWkgAOvvV",
          "name": "CoinMarketCap Standard"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "03b3e44f-a740-414c-a011-de4d571b7968",
      "name": "Exchange Info",
      "type": "@n8n/n8n-nodes-langchain.toolHttpRequest",
      "position": [
        280,
        620
      ],
      "parameters": {
        "url": "https://pro-api.coinmarketcap.com/v1/exchange/info",
        "sendQuery": true,
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "parametersQuery": {
          "values": [
            {
              "name": "id"
            }
          ]
        },
        "toolDescription": "Get metadata for a crypto exchange including description, launch date, country, and links.",
        "parametersHeaders": {
          "values": [
            {
              "name": "Accept"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "OKXROn8aWkgAOvvV",
          "name": "CoinMarketCap Standard"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "65c2b8ab-7d6d-415e-a436-0a9c14af2457",
      "name": "CMC 100 Index",
      "type": "@n8n/n8n-nodes-langchain.toolHttpRequest",
      "position": [
        740,
        620
      ],
      "parameters": {
        "url": "https://pro-api.coinmarketcap.com/v3/index/cmc100-latest",
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "toolDescription": "Returns the latest CoinMarketCap 100 Index value, including constituents and their weights.",
        "parametersHeaders": {
          "values": [
            {
              "name": "Accept"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "OKXROn8aWkgAOvvV",
          "name": "CoinMarketCap Standard"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "51a94f35-4405-4e53-9fa5-91911759802d",
      "name": "Fear and Greed Latest",
      "type": "@n8n/n8n-nodes-langchain.toolHttpRequest",
      "position": [
        980,
        620
      ],
      "parameters": {
        "url": "https://pro-api.coinmarketcap.com/v3/fear-and-greed/latest",
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "toolDescription": "Returns the latest value from the CMC Crypto Fear and Greed Index.",
        "parametersHeaders": {
          "values": [
            {
              "name": "Accept"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "OKXROn8aWkgAOvvV",
          "name": "CoinMarketCap Standard"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "26240549-9b41-4b6a-bf24-d61c8ee155ca",
      "name": "Exchange Assets",
      "type": "@n8n/n8n-nodes-langchain.toolHttpRequest",
      "position": [
        520,
        620
      ],
      "parameters": {
        "url": "https://pro-api.coinmarketcap.com/v1/exchange/assets",
        "sendQuery": true,
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "parametersQuery": {
          "values": [
            {
              "name": "id"
            }
          ]
        },
        "toolDescription": "Returns token holdings of a specific exchange including wallet addresses, platform, balance, and USD value.",
        "parametersHeaders": {
          "values": [
            {
              "name": "Accept"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "OKXROn8aWkgAOvvV",
          "name": "CoinMarketCap Standard"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "22b5608c-467e-41ff-81d9-559d110b872d",
      "name": "Exchange & Community Guide",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1520,
        -680
      ],
      "parameters": {
        "width": 1200,
        "height": 720,
        "content": "# 🧠 CoinMarketCap_Exchange_and_Community_Agent_Tool Guide

This agent handles **exchange-level** data, **community sentiment**, and **index insights** using CoinMarketCap API endpoints.

## 🔌 Supported Tools
1. `/v1/exchange/map` – Get exchange ID, name, and slug
2. `/v1/exchange/info` – Metadata: launch date, social, location
3. `/v1/exchange/assets` – Token holdings of exchange
4. `/v3/index/cmc100-latest` – CoinMarketCap 100 Index info
5. `/v3/fear-and-greed/latest` – Sentiment index (0–100)

## 🧠 Agent Components:
- **🧠 Brain**: GPT-4o Mini
- **💾 Memory**: Conversation state handler
- **⚙️ Tools**: 5 direct API endpoints

## 🧩 Trigger Parameters:
- `message` – Main query prompt
- `sessionId` – Contextual memory key

## 🔑 Notes:
- Use `Exchange Map` to get valid `id` before calling `Exchange Info` or `Assets`
- Fear & Greed index returns daily updated data points
- Index tools return structured component weights"
      },
      "typeVersion": 1
    },
    {
      "id": "dd38cd37-bff7-4200-94e4-a7f2a0f3b979",
      "name": "Usage & Examples",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        -680
      ],
      "parameters": {
        "color": 5,
        "width": 840,
        "height": 920,
        "content": "## 📌 Usage Instructions

### ✅ Step 1: Provide Inputs
Use `slug` for exchanges or `id` for metadata/assets. 

### ✅ Step 2: Trigger from Supervisor Agent
The main workflow will send `message` and `sessionId`.

### ✅ Step 3: Results Output
Returns JSON with insights on exchanges or index data.

---

## 🔍 Example Prompts

### 1️⃣ Show latest Fear & Greed score
```plaintext
GET /v3/fear-and-greed/latest
```

### 2️⃣ Get Binance exchange token holdings
```plaintext
1. GET /v1/exchange/map?slug=binance
2. Use ID to query /v1/exchange/assets?id=...
```

### 3️⃣ What coins make up the CMC 100 Index?
```plaintext
GET /v3/index/cmc100-latest
```

### 4️⃣ Show info on Coinbase
```plaintext
1. /v1/exchange/map?slug=coinbase
2. /v1/exchange/info?id=...
```"
      },
      "typeVersion": 1
    },
    {
      "id": "ce0e7093-9fe0-4b9c-8cf5-50cdfef45d94",
      "name": "Errors & Licensing",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1020,
        -680
      ],
      "parameters": {
        "color": 3,
        "width": 640,
        "height": 500,
        "content": "## ⚠️ Error Handling Tips

| Error Code | Meaning |
|------------|---------|
| `400` | Bad Request – missing/invalid param |
| `401` | Unauthorized – check API key |
| `429` | Rate Limit Exceeded |
| `500` | CoinMarketCap server error |

### ⚠️ Large Response Warning
If result data exceeds memory limits:
- Prompt: _“⚠️ Data too large, refine query with limit or filters.”_

---

**Need Help?**  
🌐 Connect on LinkedIn:  
🔗 [http://linkedin.com/in/donjayamahajr](http://linkedin.com/in/donjayamahajr)

© 2025 Treasurium Capital Limited Company. All rights reserved.
This AI workflow architecture, including logic, design, and prompt structures, is the intellectual property of Treasurium Capital Limited Company. Unauthorized reproduction, redistribution, or resale is prohibited under U.S. copyright law. Licensed use only."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "faf44acc-2d07-4185-877c-b57f9c8c88bb",
  "connections": {
    "Exchange Map": {
      "ai_tool": [
        [
          {
            "node": "CoinMarketCap Exchange and Community Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "CMC 100 Index": {
      "ai_tool": [
        [
          {
            "node": "CoinMarketCap Exchange and Community Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Exchange Info": {
      "ai_tool": [
        [
          {
            "node": "CoinMarketCap Exchange and Community Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Exchange Assets": {
      "ai_tool": [
        [
          {
            "node": "CoinMarketCap Exchange and Community Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Fear and Greed Latest": {
      "ai_tool": [
        [
          {
            "node": "CoinMarketCap Exchange and Community Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "When Executed by Another Workflow": {
      "main": [
        [
          {
            "node": "CoinMarketCap Exchange and Community Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Exchange and Community Agent Brain": {
      "ai_languageModel": [
        [
          {
            "node": "CoinMarketCap Exchange and Community Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Exchange and Community Agent Memory": {
      "ai_memory": [
        [
          {
            "node": "CoinMarketCap Exchange and Community Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    }
  }
}

功能特点

  • 自动检测新邮件
  • AI智能内容分析
  • 自定义分类规则
  • 批量处理能力
  • 详细的处理日志

技术分析

节点类型及作用

  • Executeworkflowtrigger
  • @N8N/N8N Nodes Langchain.Agent
  • @N8N/N8N Nodes Langchain.Lmchatopenai
  • @N8N/N8N Nodes Langchain.Memorybufferwindow
  • @N8N/N8N Nodes Langchain.Toolhttprequest

复杂度评估

配置难度:
★★★★☆
维护难度:
★★☆☆☆
扩展性:
★★★★☆

实施指南

前置条件

  • 有效的Gmail账户
  • n8n平台访问权限
  • Google API凭证
  • AI分类服务订阅

配置步骤

  1. 在n8n中导入工作流JSON文件
  2. 配置Gmail节点的认证信息
  3. 设置AI分类器的API密钥
  4. 自定义分类规则和标签映射
  5. 测试工作流执行
  6. 配置定时触发器(可选)

关键参数

参数名称 默认值 说明
maxEmails 50 单次处理的最大邮件数量
confidenceThreshold 0.8 分类置信度阈值
autoLabel true 是否自动添加标签

最佳实践

优化建议

  • 定期更新AI分类模型以提高准确性
  • 根据邮件量调整处理批次大小
  • 设置合理的分类置信度阈值
  • 定期清理过期的分类规则

安全注意事项

  • 妥善保管API密钥和认证信息
  • 限制工作流的访问权限
  • 定期审查处理日志
  • 启用双因素认证保护Gmail账户

性能优化

  • 使用增量处理减少重复工作
  • 缓存频繁访问的数据
  • 并行处理多个邮件分类任务
  • 监控系统资源使用情况

故障排除

常见问题

邮件未被正确分类

检查AI分类器的置信度阈值设置,适当降低阈值或更新训练数据。

Gmail认证失败

确认Google API凭证有效且具有正确的权限范围,重新进行OAuth授权。

调试技巧

  • 启用详细日志记录查看每个步骤的执行情况
  • 使用测试邮件验证分类逻辑
  • 检查网络连接和API服务状态
  • 逐步执行工作流定位问题节点

错误处理

工作流包含以下错误处理机制:

  • 网络超时自动重试(最多3次)
  • API错误记录和告警
  • 处理失败邮件的隔离机制
  • 异常情况下的回滚操作