getting-started

Your first DEX TradingView Webhook (RSI alert → CoW fill on Base)

Pre-signed buy/sell pools, gas-free fills triggered by TradingView

20 min · intermediate

What you'll have when finished

  • Have one armed DEX webhook with pre-signed buy + sell pools
  • Know how to wire a TradingView alert end-to-end
  • Understand the body-secret vs HMAC dual auth design

Before you start

  • The webhook secret is shown ONCE in a modal after commit — copy it immediately. After that only the masked version is visible
  • Anyone with both your webhook URL AND secret can fire it — treat both as private
  • A 5-each-side pool = 10 signatures back-to-back. Be ready for the popup cadence

Walkthrough

  1. Have 25 USDC + tiny ETH on Base

    You need 25 USDC for one 5-each-side pool (5 × $5 per cycle), AND ~$0.50 of native ETH for approval gas. If you already approved USDC on CoW + Base previously, no new approval needed.

    Success criteria: MetaMask shows ≥ 25 USDC + some native ETH on Base

  2. Open DEX TradingView Webhooks + connect wallet

    DEX Trade → DEX TradingView Webhooks. Connect Wallet. Green Connected banner.

    Success criteria: Green Connected banner visible

  3. Pick CoW + Base + USDC/WETH + per-cycle $5

    Protocol = CoW. Network = Base. Sell = USDC. Buy = WETH. Per-cycle amount = 5 USDC. Pool size = 5 each side. The page shows total commitment = 25 USDC (5 cycles × $5) + 10 signatures.

    Success criteria: All pickers match the values above

  4. Sign approval + 10 cycle signatures

    Click Arm Webhook. First-time USDC: ERC-20 approval (gas ~$0.05). Then 10 EIP-712 signatures back-to-back — 5 buy cycles, 5 sell cycles. Click Sign 10 times. Each has its validTo staggered by 1 second to dodge the CoW DuplicatedOrder rejection.

    Success criteria: All 10 signatures complete AND secret-reveal modal opens

  5. Copy URL + secret from the reveal modal

    Modal shows webhook URL (like api.haythix.com/api/dex/tv/...) and the secret. Click Show + Copy on both. Paste them into a temporary notepad — the secret is shown ONCE; after closing this modal only the masked version is visible.

    Success criteria: You have both URL and secret saved somewhere

  6. In TradingView, create an RSI alert on ETH/USDC

    Open TradingView. Load ETH/USD chart, 1H timeframe. Add RSI indicator. Right-click RSI line → Add Alert → condition = RSI crossing down 35. Open the Notifications tab. Tick Webhook URL → paste the haythix URL. In Message field paste exactly: {"action":"buy","secret":"<your_secret>"}. Click Create.

    Success criteria: TradingView alert is saved with webhook URL + JSON message visible

  7. Click Test on the haythix row + watch first real fire

    In haythix, find your webhook row. Click Test — sends a synthetic alert end-to-end. You should see status "Test alert delivered" and one cycle marked used in the pool. Then when RSI on ETH actually crosses below 35, TradingView fires the real alert, which fires one buy cycle from your pool. Capacity bar shows 4/5 buy remaining.

    Success criteria: Test fire succeeded AND when first real RSI cross fires, capacity bar decrements

What's next

You have a working TradingView → DEX pipeline. Next refinements: create a sell-side alert using the same secret but {"action":"sell"...}. Refill when buy pool drops to ≤30% remaining. For HMAC-authenticated relays (n8n / Pipedream), drop the secret from the body and sign HMAC-SHA256 of the body in the X-Webhook-Signature header instead — better security.