Beta DocsWebhook Portal
Beta Guide · Port 8081

Webhook Portal

The signal gatekeeper. Receives webhooks from TradingView, custom scripts, or the Twitter Monitor — runs them through 10 rule types and 31 live indicator filters — and only lets approved signals reach Gunbot.

URL: http://localhost:8081 Webhook: http://localhost:8081/webhook Requires: Gunbot on :3001

1. What a Webhook Is (Plain English)

A webhook is an automated HTTP message — like a text message sent between pieces of software over the internet. When TradingView fires an alert (e.g. "RSI crossed below 30"), it can send that alert as a webhook: a small package of data delivered to a URL you specify.

The Webhook Portal is the address that receives those messages. When a signal arrives, it does not blindly pass it to Gunbot. Instead, it acts like a bouncer:

StepWhat happens
1. ArrivesSignal knocks on the door (POST to http://localhost:8081/webhook)
2. AuthenticatedSignature checked if a secret is configured. If signature fails REJECTED
3. Gate rules checkedTime window, rate limit, symbol filter, etc. If any rule fails GATED
4. Indicators checkedLive RSI, MACD, Bollinger, etc. fetched from Gunbot. If any filter fails GATED
5. ExecutedOrder sent to Gunbot EXECUTED. Gunbot places the trade on your exchange.

You can send webhooks from TradingView alerts, custom Python or Node.js scripts, the Twitter Monitor, or any tool that can make an HTTP POST request (including Postman or curl for testing).

2. The Log Tab

The Log tab is your live feed of every signal that has arrived, with its outcome. The feed updates automatically via a live server connection (SSE) — you do not need to reload the page.

Status Badges

Every log entry has a colour-coded badge:

BadgeMeaningWhat caused it
EXECUTEDPassed all gates. Order sent to Gunbot.All rules and indicators passed; Gunbot accepted the order
GATEDBlocked by a gate rule or indicator filter. No order sent.One of your configured rules returned false
REJECTEDBad format, failed authentication, or unrecognisable payload.Invalid JSON, missing required field, or wrong HMAC signature
PENDINGWaiting for consensus (consensus mode only).Multiple sources must agree before executing
TESTInjected manually using the test tool.You sent it via the Test panel — not a real incoming signal

Viewing Details

Click any log entry to expand it and see: the full JSON payload, which gate rule blocked it (for GATED), the rejection reason (for REJECTED), the Gunbot response (for EXECUTED), and a millisecond-precise timestamp.

Filter Buttons

Use the filter row above the log to show only signals with a specific status: All, Executed, Gated, Rejected, Pending. If you filter to "Gated" and the log is empty, the "No gated webhooks" state shows a button to clear the filter and show all signals.

3. Config Tab

FieldWhat it doesDefaultNotes
Gunbot URLWhere Gunbot's API liveshttp://localhost:3001Only change if Gunbot runs on a non-standard port
Gunbot TokenYour Gunbot API key, used to authenticate trade orders(empty)Find it in Gunbot Settings API
Webhook SecretHMAC signing key — signals must be signed with this to pass(empty)Leave empty for TradingView — TV cannot send custom headers
Gate EnabledMaster switch for all gate rules and indicator filtersOnOff = all valid signals execute immediately, no filtering
Indicator PairWhich pair's candle data is used for indicator calculationsUSDT-BTCMust be a pair that exists in Gunbot on the indicator exchange
Indicator ExchangeWhich exchange to pull candle data frombinanceMust be a configured exchange in Gunbot

Settings are saved to a config file automatically when you click Save — they persist across server restarts.

4. Gate Rules

Gate rules are the filters that decide whether a signal is allowed through. They run in order — if any rule fails, the signal is GATED immediately and subsequent rules are not checked. You can enable, disable, or reorder rules in the Gate tab.

Rule TypeWhat it doesKey settings
Gunbot AuthChecks that Gunbot is online and authenticated before executing. Prevents orders being sent to an offline Gunbot.None — automatic check
Indicator GateRuns all your enabled indicator filters. If any filter fails, the signal is gated.Configured separately in the Indicators tab
Time WindowOnly allows signals during specified hours and days of the week.Start hour, end hour, days of week (0=Sun, 1=Mon … 6=Sat)
Symbol FilterAllows or blocks signals for specific trading pairs.symbols[] list; mode: allowlist or blocklist
Rate LimitMaximum number of signals allowed within a rolling time window.windowMinutes (default 60), maxCount (default 10)
CooldownMinimum time that must pass between any two signals executing.seconds (default 60)
Action FilterOnly allows specific trade actions. Use to make the portal buy-only or sell-only.allowed: ["buy"], ["sell"], or ["buy","sell"]
Source FilterAllows or blocks signals based on their source field.sources[] list; mode: allowlist or blocklist
Price DeviationBlocks if the signal price is too far from the current market price. Catches stale or erroneous signals.maxPercent (e.g. 5 = block if signal price is >5% from market price)
Balance CheckVerifies sufficient balance exists before executing. Prevents failed orders due to insufficient funds.None — automatic check against Gunbot balances

To add a new rule: click + Add Rule in the Gate tab, select the type, configure its settings, and save. To reorder rules, drag them — rules are checked top to bottom.

5. Indicators Tab

The Indicators tab shows all 31 available technical indicator filters. Enable any indicator and set a condition — the Indicator Gate rule will then check this condition live for every incoming signal.

The candle data used comes from the Indicator Pair and Indicator Exchange set in the Config tab (e.g. USDT-BTC on Binance). Indicators update every 10 seconds. At least 14 candles of data must be available before indicators can be calculated.

Condition Types

ConditionMeaningExample
rangeValue must be between low and high (inclusive)RSI range [30, 50] pass if RSI is between 30 and 50
minValue must be at or above this numberADX min 25 pass if ADX ≥ 25 (trend is strong)
maxValue must be at or below this numberRSI max 40 pass if RSI ≤ 40 (oversold zone)

All 31 Indicators

Field NameIndicatorWhat it measuresTypical range
rsiRSI (14)Momentum oscillator0–100 · Buy zone: <40
macdMACD LineTrend momentumVaries · Positive = bullish
macdSignalMACD SignalMACD trigger lineVaries · Cross above = buy
macdHistMACD HistogramMACD minus SignalVaries · Positive = rising momentum
bbUpperBollinger Upper BandMean + 2σ price levelPrice-relative · Above = overbought
bbLowerBollinger Lower BandMean − 2σ price levelPrice-relative · Below = oversold
bbMiddleBollinger Middle20-period SMAPrice-relative
bbPctBollinger %BWhere price sits within the bands0–1 · Below 0 = outside lower band
bbWidthBollinger WidthBand spread (volatility proxy)Varies · High = high volatility
ema8EMA 8 %% price is above/below 8-period EMANegative = price below EMA
ema21EMA 21 %% price is above/below 21-period EMANegative = short-term bearish
ema50EMA 50 %% price is above/below 50-period EMANegative = medium-term bearish
ema200EMA 200 %% price is above/below 200-period EMANegative = long-term bear trend
sma20SMA 20 %% price is above/below 20-period SMAVaries
vwapVWAP %% price is above/below VWAPNegative = below fair value
atrATRAverage True Range — absolute volatilityPrice-relative
atrPctATR %ATR as a percentage of price>2% = high volatility
stochKStochastic %KFast stochastic oscillator0–100 · Below 20 = oversold
stochDStochastic %DSlow stochastic (signal line)0–100 · Below 20 = oversold
williamsWilliams %RMomentum indicator−100 to 0 · Below −80 = oversold
cciCCICommodity Channel IndexVaries · Below −100 = oversold
mfiMFIMoney Flow Index (volume-weighted RSI)0–100 · Below 20 = oversold
rocROCRate of Change %Varies · Negative = price declining
adxADXTrend strength (directionless)0–100 · Above 25 = strong trend
obvOBVOn-Balance VolumeVaries · Rising = accumulation
vwma20VWMA 20 %% price above/below volume-weighted MAVaries
donchianUpperDonchian UpperHighest high over 20 periodsPrice-relative · Breakout = bullish
donchianLowerDonchian LowerLowest low over 20 periodsPrice-relative · Breakdown = bearish
donchianMidPctDonchian Mid %% price above/below Donchian midlineVaries
chaikinChaikin MFChaikin Money Flow−1 to 1 · Above 0 = buying pressure
aroonAroon OscillatorTrend direction strength−100 to 100 · Above 0 = uptrend

6. Sending a Test Signal

Use the Test panel in the Webhook Portal UI to inject a signal without sending it from an external source. This lets you verify your gate rules and indicators are working before connecting TradingView.

Signal JSON Format

signal.json
{
  "action": "buy",           // required: "buy" or "sell"
  "exchange": "binance",     // required: Gunbot exchange name
  "symbol": "USDT-BTC",      // required: Gunbot pair format
  "amount": 50,             // required: trade size in base currency
  "price": 65000,           // optional: 0 or omit = use market price
  "source": "tradingview",   // optional: label shown in the log
  "type": "MARKET",         // optional: defaults to "MARKET"
  "refPrice": 65000        // optional: used by Price Deviation gate only
}
FieldRequiredAccepted values
actionYes"buy" or "sell"
exchangeYesGunbot exchange name (e.g. "binance", "bybit")
symbolYesGunbot pair format: "USDT-BTC", "USDT-ETH"
amountYesNumber — trade size in base currency units
priceNoNumber — reference price. 0 or omit = use live market price
sourceNoString — label shown in log (e.g. "tradingview", "script")
typeNo"MARKET" (default)
refPriceNoNumber — only used by the Price Deviation gate rule

7. TradingView Setup

TradingView alerts can be sent as webhooks to the Portal. Because TradingView is on the internet and the Portal runs on your local machine, you need ngrok to create a public tunnel to your local port 8081.

Setup Steps

StepWhat to do
1Download ngrok from ngrok.com, create a free account, and authenticate it
2Run: ngrok http 8081 — copy the https://xxxx.ngrok.io URL it shows
3In TradingView, create an alert. Under "Notifications", enable "Webhook URL"
4Enter: https://xxxx.ngrok.io/webhook as the webhook URL
5In the alert message box, enter JSON using TradingView's dynamic variables

Example Alert Message

TradingView Alert Message
{
  "action": "{{strategy.order.action}}",
  "exchange": "binance",
  "symbol": "USDT-BTC",
  "amount": 50,
  "price": {{close}},
  "source": "tradingview"
}
Critical: Leave the Webhook Secret empty when using TradingView
TradingView alerts cannot send custom HTTP headers. The Webhook Portal's HMAC signature check relies on a custom header (X-WEN-Signature). If you set a webhook secret, every TradingView alert will be rejected with a 401 error. Leave the Webhook Secret field blank when using TradingView as your signal source.
ngrok free tier: URL changes on every restart
Each time you restart ngrok, it gives you a new URL. You must update all your TradingView alert webhook URLs to match. The paid ngrok plan gives you a fixed domain.

8. Gate Performance Stats

The Gate tab shows aggregate statistics since the server started:

StatWhat it shows
Total receivedAll signals that arrived at the webhook endpoint
ExecutedSignals that passed all gates and were sent to Gunbot
GatedSignals blocked by a gate rule or indicator filter
RejectedSignals that failed authentication or had bad format
Pass rateExecuted Total as a percentage

A high gated count with strict indicator filters is expected — that's the gate working. A high rejected count suggests a misconfigured source (bad JSON format, wrong HMAC key).

9. Testing Checklist

  • Send a test signal with valid JSON via the Test panel should appear as EXECUTED in the log
  • Send a test signal with "action": "hold" (invalid) should appear as REJECTED
  • Enable the Time Window rule set to hours in the past send a signal should be GATED
  • Enable Rate Limit with maxCount=1 send two signals quickly second should be GATED
  • Enable Symbol Filter as blocklist containing USDT-BTC send USDT-BTC signal should be GATED
  • Enable RSI filter set to range [0, 5] (always false) next signal should be GATED by indicator gate
  • Turn off the Gate (Config Gate Enabled: Off) all valid signals should execute immediately
  • Set a Webhook Secret send a signal without a signature should be REJECTED with 401
  • Clear the Webhook Secret same signal should now pass
  • Check the Indicators tab shows live values (not all "—") for your configured pair
  • Verify indicator values update every ~10 seconds without page reload
  • Check Gate Stats panel after sending several signals — counts should be accurate
  • Health check returns valid JSON: http://localhost:8081/health
  • Log auto-updates when a signal arrives (SSE is working) — no page reload needed

10. Known Limitations

LimitationDetail
TradingView HMACCannot use webhook secrets with TradingView — TV does not support custom request headers
ngrok URL changesFree tier ngrok gives a new URL every restart; must update TradingView alerts each time
Indicator warmupRequires at least 14 candles of data before RSI and other indicators can be calculated (~14 minutes on 1m timeframe)
Log limitOnly the last 500 log entries are kept — older entries are dropped automatically
Payload sizeMaximum 64 KB per webhook payload — more than enough for any signal, but extremely large payloads will be rejected
Single exchange for indicatorsAll indicator filters use data from one pair/exchange combination — there is no per-signal indicator source

11. Troubleshooting

SymptomLikely causeFix
All signals REJECTEDInvalid JSON format, or a webhook secret is set but the source isn't signingTest with the built-in test panel first. If TradingView: clear the webhook secret
Signals always GATED by indicator gateIndicator data not loaded, or filter condition is too strictCheck the Indicators tab — if values show "—", wait for candle warmup (~14 minutes). Loosen the filter range
Gunbot Auth gate always failingGunbot is offline, or the Gunbot token is wrongVerify Gunbot is running. Re-enter the token in Config
Log stops auto-updatingSSE connection dropped (network interruption or long idle)Reload the page — SSE reconnects automatically on load
"Gate: indicator data unavailable"Gunbot cannot fetch candle data for the indicator pairCheck the Indicator Pair and Exchange in Config — ensure that pair exists and is active in Gunbot
TradingView alert gives 401Webhook secret is setClear the webhook secret in Config

12. Bug Report Checklist

Include all of the following when reporting a Webhook Portal bug:

  • Tool: Webhook Portal (:8081)
  • Step-by-step description of what you were doing
  • What you expected to happen vs what actually happened
  • The exact JSON of the signal you sent (paste it in full)
  • The log entry — click it and paste the full expanded detail
  • Which gate rules were enabled, and their settings
  • Which indicator filters were enabled, and the live values shown at the time
  • Health check JSON: http://localhost:8081/health
  • Screenshot of the full Log tab and the expanded signal detail
  • Browser and OS version
  • Approximate time it happened