LogoLogo
  • 📘Introduction
    • What is Forge?
    • Why We Built Forge
  • 🧠How Forge Works
    • Core Architecture
    • Agent System Overview
  • Model Context Protocol (MCP)
  • On-Chain Data Indexing
  • AI Query Handling
  • ⚙️Using Forge
    • Setting Up Forge
    • How to Ask Questions
  • Supported Use Cases
  • Interacting with Agents
  • Limitations and Data Scope
  • 🛠️Advanced Features
    • Agent Personalities and Prompt Logic
  • Creating Custom Agents
  • Integrating External APIs
  • Running Multi-Agent Workflows
  • Token Behavior Tracking
  • Suspicious Wallet Detection
  • 📀Forge Modules
    • Liquidity Pool Scanner
  • LP Burner Tracker
  • Telegram Sniper Detector
  • Contract Creator Profiler
  • Whale Movement Watcher
  • ⚙️Developer Tools
    • Custom Prompt Engineering
  • 📃Appendix
    • Glossary
    • Security and Privacy
    • Roadmap and Vision
Powered by GitBook
On this page
  • Why Integrate External APIs
  • Common Integration Examples
  • Handling Rate Limits and Failures
  • Secure API Keys
  • Best Practices
Export as PDF

Integrating External APIs

Forge is strongest when it sees everything. While its native indexer captures live on-chain events, sometimes you need context from outside the blockchain — like Telegram data, Twitter signals, trending words, or even centralized price feeds. That’s where API integration comes in.

This page explains how to plug external data sources into Forge so your agents can react to signals beyond Solana.


Why Integrate External APIs

On-chain activity only tells half the story. Many key events start off-chain:

  • A Telegram KOL posts alpha

  • A deployer joins a chat group

  • A wallet gets funded after a Discord mention

  • A Twitter thread goes viral and sparks a memecoin pump

By integrating APIs, you allow Forge to:

  • Trigger agents based on social activity

  • Combine off-chain signals with on-chain responses

  • Build richer prompts with external data

  • Monitor coordinated behavior across platforms

This turns Forge into a multi-channel intelligence system.


Common Integration Examples

Here are a few ways APIs are already used inside Forge:

Telegram

  • Track when known wallets join groups

  • Monitor messages in target chats for keywords

  • Flag new deployers who joined high-risk groups

Twitter

  • Scan tweets from influencers

  • Track hashtags tied to new coins

  • Monitor followers of known dev wallets

CoinGecko / Price APIs

  • Pull current SOL price

  • Compare market cap to USD

  • Use real-world benchmarks in risk scoring

TradingView or Custom Signal Feed

  • Check if a coin has crossed RSI thresholds

  • Pull volume metrics for major listings

Handling Rate Limits and Failures

Make sure your API code:

  • Handles timeouts and bad responses

  • Uses caching if data doesn’t change frequently

  • Respects rate limits from the source

You don’t want your agents to crash just because a server is slow.


Secure API Keys

If using services that require API keys:

  • Store keys in .env

  • Never log them or inject them into prompts

  • Use proxy services if needed to obscure source

Example:

iniCopyEditTWITTER_API_KEY=xxxxx

Inside your code:

tsCopyEditconst headers = {
  Authorization: `Bearer ${process.env.TWITTER_API_KEY}`
}

Best Practices

  • Keep off-chain data short and relevant in the prompt

  • Timestamp everything, especially when correlating with blockchain events

  • Sanitize and label external content clearly

  • Don’t overload your prompt with unnecessary noise

Remember, the goal is to make the AI smarter, not just feed it more data.

PreviousCreating Custom AgentsNextRunning Multi-Agent Workflows

Last updated 12 days ago