Join waitlist →
Automation recipe · advanced

Post Congress + flow confluence to X

When a ticker lights up with unusual options flow and a member of Congress has recently traded it, that's two independent smart-money signals pointing at the same name. This recipe watches for that confluence and auto-composes a concise alert to X (Twitter), turning the "smart money agrees" moment into shareable content for your account.

What it does. Listens for RadarPulse confluence / high-score events, cross-references each ticker against the congressional-trades feed, and when both align, posts a short alert to X with the score, bias, premium, and a link.

Prerequisites

The script

Illustrative Node example, a tiny webhook receiver that posts to X when flow + Congress confluence is found. Verify the RadarPulse webhook signature before acting.

// confluence-to-x.mjs, post smart-money confluence to X
import crypto from "node:crypto";
import express from "express";

const KEY = process.env.RADARPULSE_API_KEY;
const SECRET = process.env.RADARPULSE_WEBHOOK_SECRET;
const BASE = "https://api.radarpulse.io";
const app = express();

// keep the raw body so we can verify the HMAC signature
app.use(express.raw({ type: "*/*" }));

app.post("/radarpulse", async (req, res) => {
  // 1) Verify the signature: HMAC-SHA256 over "timestamp.body" (the exact bytes sent)
  const ts  = req.header("X-RadarPulse-Timestamp") || "";
  const sig = req.header("X-RadarPulse-Signature") || "";
  const mac = "sha256=" + crypto.createHmac("sha256", SECRET)
    .update(ts + "." + req.body).digest("hex");
  if (sig.length !== mac.length ||
      !crypto.timingSafeEqual(Buffer.from(sig), Buffer.from(mac)) ||
      Math.abs(Date.now() - Number(ts)) > 5 * 60_000) return res.sendStatus(401); // forged or stale

  const evt = JSON.parse(req.body.toString());
  res.sendStatus(200); // ack fast

  if (evt.event !== "flow.confluence" && evt.event !== "flow.high_score") return;
  const t = evt.ticker;

  // 2) Cross-reference recent congressional trades for this ticker (Pro+)
  const cg = await fetch(`${BASE}/api/v1/congress?ticker=${t}&days=45`, {
    headers: { "x-api-key": KEY }
  }).then(r => r.json()).catch(() => ({ data: [] }));
  if (!cg.data || !cg.data.length) return; // no Congress overlap → skip

  const m = cg.data[0];
  // 3) Compose + post to X
  const text = `Smart-money confluence: $${t}\n`
    + `⚡ Flow score ${evt.score} (${evt.bias}) · ${evt.premiumFmt} premium\n`
    + `🏛 ${m.name} (${m.chamber}) ${m.type} ${m.amount}\n`
    + `${evt.links.app}`;
  await postToX(text); // your X API client
  console.log("posted", t);
});

app.listen(process.env.PORT || 3000);

Endpoints/fields (flow.confluence webhook, /api/v1/congress, the signed X-RadarPulse-Signature header) are part of the RadarPulse API beta; the live reference ships with your key. postToX() is your own X API call.

How to run it

1. Get a RadarPulse API key + webhook secret (beta) and X API write credentials.
2. Deploy the receiver (Railway/Render) and register its URL for flow.confluence events.
3. Test with a sample event, confirm the signature check passes and a draft posts.
4. Add a per-ticker cooldown so you don't repeat-post the same name; consider a manual-approve step before going fully autonomous.

Risk & responsibility. Congressional disclosures and unusual options prints are data points, not buy or sell signals. Anything this posts is published under your own handle, you are solely responsible for its content, accuracy, and compliance with X's terms and any applicable disclosure rules. Always verify the webhook signature, keep your keys secret, and consider a human-approval step. Not financial advice. Trading and investing involve substantial risk of loss.

Get a beta API key + webhooks

Confluence webhooks + the Congress endpoint power this recipe. Join the waitlist for early API access.

Join the waitlist →

Keep exploring