Insider Buying Alerts in Slack with the SEC EDGAR API
On November 25, 2026, Atlassian CEO Michael Cannon-Brookes bought $1.86 million of Atlassian stock, and the Form 4 hit SEC EDGAR the same day. Getting that into a Slack channel automatically takes about 85 lines of Python.
Insider buying alerts in Slack take three parts: a feed of new open-market purchases from SEC Form 4 filings, a filter that drops noise like funds and small buys, and a Slack incoming webhook to post each new buy once. This guide builds that bot in Python with Edgrapi's insider API, tested end to end, plus a daily cluster-buying digest and a watchlist option.
How do you get insider buying alerts in Slack?
Create a Slack incoming webhook for your channel, then run a small script on a schedule. The script calls an insider-buys API for new open-market purchases (Form 4, transaction code P), skips any it has already posted, filters out funds and small trades, and POSTs each new buy to the webhook as a Slack message. Cron or GitHub Actions runs it every hour or two.
You don't need a server or a database for this, and you don't touch SEC XML, since the feed does the parsing.
The feed here is Edgrapi's /v1/insider/latest endpoint, which is my own API (the same feed runs the free insider radar page), so weigh that accordingly, but the bot works with any source that gives you a ticker, a dollar value and an accession number. It reads the SEC's live Form 4 stream, parses each filing and keeps only open-market purchases.
You can build that feed yourself from EDGAR, and I wrote up what that takes, but it's a lot of XML parsing to find a few buys a day.
Here's what the bot posts to Slack:
*Cannon-Brookes Michael* bought *$1,860,561* of *TEAM* (Atlassian Corp)
CEO, Co-Founder
Form 4 on SEC EDGAR
Which insider trades are worth an alert?
Alert on open-market purchases, transaction code P, and mostly ignore everything else. A purchase is the one Form 4 trade where an insider spends their own cash at the market price. Grants, option exercises and tax withholding are compensation. Sales happen for many reasons, and the research finds they carry little signal. Buys are rarer and more informative.
The academic work mostly agrees on this. Jeng, Metrick and Zeckhauser found that insider purchases earn abnormal returns of more than 6% per year, while insider sales don't earn significant abnormal returns.
Lakonishok and Lee, studying 1975 to 1995, found that insider selling appears to have no predictive ability. The buying signal was strongest in smaller companies.
Cohen, Malloy and Pomorski split insiders into routine traders and opportunistic ones. Following only the opportunistic insiders earned 82 basis points a month in value-weighted abnormal returns. The routine traders earned about zero.
So if you pipe every Form 4 into a channel it turns into noise fast, and a channel of open-market buys over a dollar threshold is the version that stays useful.
Insiders must file Form 4 within two business days of the trade, so a fast alert gets you the buy within a couple of days of when it happened.
If you want the full background on reading these filings, see how to track insider buying.
What do you need before you start?
You need three things: a Slack incoming webhook URL for the channel, an Edgrapi API key, and Python 3 with the requests library. The webhook takes a few minutes to set up in Slack's app settings. The API key comes from a free Edgrapi account, which includes 50 credits, enough for 10 test runs.
Setting up the Slack webhook, per Slack's incoming webhooks guide:
- Create a Slack app at api.slack.com/apps, or pick an existing one.
- Open Incoming Webhooks and switch it on.
- Click Add New Webhook to Workspace, pick the channel, and authorize.
- Copy the webhook URL.
Treat that URL like a password. Slack's docs say it contains a secret, and Slack actively searches for leaked webhook URLs and revokes them. Keep it in an environment variable, not in your code or a public repo.
You also can't change the channel, username or icon from the payload, so the webhook always posts to the channel you picked when you created it.
Get your API key from the Edgrapi dashboard, then set both values:
export EDGRAPI_KEY="your_edgrapi_key"
export SLACK_WEBHOOK_URL="https://hooks.slack.com/services/..."
pip install requests
How does the Python Slack bot work?
The bot fetches the latest open-market insider buys over $100,000, drops any it has already posted by checking the accession number against a local file, filters out pure 10% owners, and posts each remaining buy to Slack as a formatted message. It waits a second between messages and backs off if Slack returns HTTP 429. Run it with --seed once first.
Here's the full script. I ran it against the live API on November 26, 2026.
"""Post new open-market insider buys (SEC Form 4, code P) to a Slack channel."""
import json, os, sys, time
import requests
API = "https://api.edgrapi.com/v1/insider/latest"
MIN_VALUE = 100_000 # ignore buys under $100k
SKIP_FUNDS = True # drop buys where the only role is "10% owner"
SEEN_FILE = "seen_buys.json"
def load_seen():
try:
with open(SEEN_FILE) as f:
return set(json.load(f))
except FileNotFoundError:
return set()
def save_seen(seen):
with open(SEEN_FILE, "w") as f:
json.dump(sorted(seen)[-5000:], f)
def esc(s):
# Slack treats &, < and > as control characters
return str(s).replace("&", "&").replace("<", "<").replace(">", ">")
def fetch_buys():
r = requests.get(API, headers={"X-API-Key": os.environ["EDGRAPI_KEY"]},
params={"min_value": MIN_VALUE, "limit": 50}, timeout=60)
r.raise_for_status()
return r.json()["buys"]
def keep(buy):
roles = buy.get("relationship") or []
if SKIP_FUNDS and roles == ["10% owner"]:
return False
return True
def to_message(b):
role = b.get("officer_title") or ", ".join(b.get("relationship") or [])
line = "*%s* bought *$%s* of *%s* (%s)" % (
esc(b["owner"]), f"{b['buy_value']:,.0f}", esc(b["ticker"]), esc(b["company"]))
return {
"text": "Insider buy: %s $%s of %s" % (b["owner"], f"{b['buy_value']:,.0f}", b["ticker"]),
"blocks": [
{"type": "section", "text": {"type": "mrkdwn", "text": line + "\n" + esc(role)}},
{"type": "context", "elements": [{"type": "mrkdwn",
"text": "<%s|Form 4 on SEC EDGAR>" % b["filed_url"]}]},
],
}
def post(msg):
url = os.environ["SLACK_WEBHOOK_URL"]
for _ in range(3):
r = requests.post(url, json=msg, timeout=30)
if r.status_code == 429: # rate limited: wait as told
time.sleep(int(r.headers.get("Retry-After", "30")))
continue
r.raise_for_status()
return
raise RuntimeError("Slack kept rate-limiting us")
def main():
seed = "--seed" in sys.argv # first run: remember today's buys, post nothing
seen = load_seen()
new = [b for b in fetch_buys() if b["accession"] not in seen and keep(b)]
for b in sorted(new, key=lambda b: b["buy_value"], reverse=True):
if not seed:
post(to_message(b))
time.sleep(1.1) # Slack: about 1 message per second
seen.add(b["accession"])
save_seen(seen)
print("posted" if not seed else "seeded", len(new))
if __name__ == "__main__":
main()
The text field is the plain fallback Slack uses for notifications and the blocks carry the formatted version, and Slack's docs show both together, so I send both.
Don't drop esc(). Slack treats &, < and > as control characters, per its formatting guide. A company like "Babcock & Wilcox" would break a message without it.
The link uses Slack's <url|text> syntax, so the channel sees "Form 4 on SEC EDGAR" instead of a long EDGAR URL.
On the first live run, the API returned 10 buys over $100,000. The script posted 8 and skipped 2 fund buys. A second run a minute later posted 0, because every accession was already in seen_buys.json.
I tested the Slack side against a local server that mimics the webhook, including a forced 429 response. The retry waited and the message went through. I haven't posted to a real Slack workspace for this article, so check the first message in a test channel.
How do you stop duplicate and noisy insider alerts?
Dedupe on the accession number, the unique ID SEC gives every filing, and filter on value and role. The bot stores every accession it has posted in a small JSON file and skips repeats. A $100,000 floor drops token buys. Skipping owners whose only role is "10% owner" removes most fund activity, which made up four of the 13 buys in one day's feed.
Here's what the feed looked like when I pulled it on November 26, 2026, with a $50,000 floor:
| Filter step | Buys left |
|---|---|
| Open-market buys over $50,000 | 13 |
| Over $100,000 | 10 |
| Drop "10% owner" only | 8 |
Four of the 13 were the same buyer: Saba Capital Management, a hedge fund, buying shares in closed-end funds where it already owns more than 10%. That's real insider buying under SEC rules, but it's not what most people want in an "insiders are buying" channel.
What was left looked like the alerts people actually want: the CEO of Atlassian buying $1.86 million, the CEO and CFO of Galaxy Digital buying $956,000 and $268,000, and directors at five other companies.
Don't filter out repeat buyers, though. Cannon-Brookes filed three Form 4s for three straight trading days, November 23 to 25, for $5.64 million in total. Each filing has its own accession number, so a bot running all week would have posted three alerts, which is what you want, since three days of buying in a row tells you more than one buy does.
A few more filters worth adding, depending on your channel:
- Officers only. Keep buys where
officer_titleis set, if you only care about CEOs and CFOs. - A watchlist. Keep only tickers in a set, like your portfolio.
- A higher floor. $250,000 or $500,000 cuts the channel to a few posts a week.
Sales get one more layer of noise. Since the SEC's December 2022 Rule 10b5-1 amendments, directors and officers wait at least 90 days between adopting a trading plan and trading under it. Those plan trades are scheduled, so they say little, and since this bot only posts buys you can mostly ignore it.
curl -H "X-API-Key: edgr_your_key" "https://api.edgrapi.com/v1/insider/AAPL"Get a free API key 50 free credits, no card.How do you add a daily cluster buying digest?
Call the clusters endpoint once a day and post the list as one Slack message. A cluster is three or more insiders at the same company buying within 15 days. Edgrapi's /v1/insider/clusters returns each company with the insider count, the total value and each buyer, and the whole digest costs five credits a day.
Cluster buying is worth its own message because it's a stronger signal than a single buy. Alldredge and Blank found that clustered insider purchases are followed by abnormal returns above 2% in the next month.
"""Once a day: post companies where 3+ insiders bought in the last 15 days."""
import os
import requests
r = requests.get("https://api.edgrapi.com/v1/insider/clusters",
headers={"X-API-Key": os.environ["EDGRAPI_KEY"]},
params={"days": 15, "min_insiders": 3}, timeout=60)
r.raise_for_status()
clusters = r.json()["clusters"][:10]
lines = []
for c in clusters:
lines.append("*%s* (%s): %d insiders, $%s" % (
c["ticker"], c["company"].replace("&", "&"), c["insider_count"],
f"{c['total_value']:,.0f}"))
text = "Cluster buys, last 15 days\n" + ("\n".join(lines) or "None today.")
requests.post(os.environ["SLACK_WEBHOOK_URL"], json={"text": text}, timeout=30).raise_for_status()
print(text)
On November 26, 2026, it found six clusters:
| Ticker | Company | Insiders buying | Total value |
|---|---|---|---|
| LRMR | Larimar Therapeutics | 9 | $402,143 |
| HAWK | HawkEye 360 | 8 | $173,405 |
| RMIX | Suncrete | 7 | $1,298,741 |
| GNL | Global Net Lease | 7 | $636,281 |
| CTSO | Cytosorbents | 7 | $499,984 |
| BW | Babcock & Wilcox | 6 | $1,016,974 |
Nine insiders at Larimar bought within 15 days, including the CEO, the CFO and the COO, but only one of the nine buys was over $100,000, so with a $100,000 floor the main bot would have posted just that one.
How often should the bot run, and what does it cost?
Every one to two hours on weekdays is enough for most channels. The latest-buys feed keeps up to the last 24 hours of buys, so you won't miss anything between runs. Each run costs 5 credits. Running every two hours from 6am to 10pm Eastern on weekdays, plus the daily digest, uses about 1,100 credits a month.
Here's the math for common schedules, using 22 weekdays or 30 days a month:
| Schedule | Calls a month | Credits | Fits on |
|---|---|---|---|
| Every 2 hours, 6am-10pm ET, weekdays, plus digest | 220 | 1,100 | Lite, $3 |
| Hourly, 6am-10pm ET, weekdays, plus digest | 396 | 1,980 | Starter, $10 |
| Hourly, around the clock | 720 | 3,600 | Starter, $10 |
| Every 15 minutes, around the clock | 2,880 | 14,400 | Pro, $29 |
Every response tells you what it cost in the X-Credits-Cost header, and your balance in X-Credits-Remaining. Plans and credit costs per endpoint are on the pricing page.
For the scheduler, a crontab line runs it every two hours on weekdays:
0 6-22/2 * * 1-5 cd /path/to/bot && python slack_insider_alerts.py
Cron uses the server's time zone, so set it to Eastern or adjust the hours. GitHub Actions works too, but its runners don't keep files between runs, so commit seen_buys.json back or store it somewhere persistent.
Can you get Slack alerts for specific tickers instead?
Yes. Register an Edgrapi webhook with up to 50 tickers and the insider event, and Edgrapi POSTs each new Form 4 for those companies to your endpoint, signed with HMAC-SHA256. A short relay checks the signature, keeps open-market buys, and forwards them to Slack. Webhook deliveries don't use credits. You need a public HTTPS endpoint to receive them.
You need the relay because a Slack incoming webhook expects Slack's own message format and Edgrapi sends its own JSON, so something has to sit in between.
"""Receive Edgrapi watchlist webhooks, keep open-market buys, forward them to Slack."""
import hashlib, hmac, os
import requests
from flask import Flask, abort, request
app = Flask(__name__)
SECRET = os.environ["EDGRAPI_WEBHOOK_SECRET"] # shown once when you create the webhook
@app.post("/edgrapi")
def edgrapi_hook():
raw = request.get_data()
sig = hmac.new(SECRET.encode(), raw, hashlib.sha256).hexdigest()
if not hmac.compare_digest(sig, request.headers.get("X-Edgrapi-Signature", "")):
abort(401)
ev = request.get_json()
if ev.get("event") != "insider.filed":
return "ignored"
txns = (ev.get("data") or {}).get("transactions") or []
buys = [t for t in txns if t.get("code") == "P" and t.get("acquired_disposed") == "A"]
if not buys:
return "no buys"
total = sum(t.get("value") or 0 for t in buys)
text = "%s bought $%s of %s\n<%s|Form 4>" % (
ev["data"]["owner"], f"{total:,.0f}", ev["ticker"], ev["url"])
requests.post(os.environ["SLACK_WEBHOOK_URL"], json={"text": text}, timeout=30)
return "ok"
I tested it with a real Atlassian Form 4 payload and a locally signed request. A correct signature forwarded "Cannon-Brookes Michael bought $1,860,561 of TEAM". A wrong one got a 401.
Register the webhook with one call:
curl -X POST https://api.edgrapi.com/v1/webhooks \
-H "X-API-Key: $EDGRAPI_KEY" -H "Content-Type: application/json" \
-d '{"url": "https://your-app.example.com/edgrapi", "tickers": ["TEAM", "GLXY"], "events": ["insider"]}'
Save the secret in the response. It's shown once. The webhooks guide covers testing deliveries and reading the delivery log.
Use the polling bot for "any insider buying anywhere" and the webhook for "anything at the companies I own", and if you want both, point them at different channels.
What are the limits of this setup?
The polling bot only sees what's in the latest-buys window, up to the last 24 hours, so a bot that's down for a day can miss buys. Slack allows about one message per second per channel. The alert is only as fast as the filing, and insiders have two business days to file. And a buy is a signal to research, not a trade.
A few specifics:
- Downtime. If your scheduler stops for more than a day, buys from that gap may be gone from the window. For full history on one company, call
/v1/insider/{ticker}. - Rate limits. Slack's rate limits page allows one message per second per channel, with short bursts. The 1.1-second sleep and the 429 handling cover it.
- Message size. A section block's text maxes out at 3,000 characters, and a message can hold 50 blocks. One buy per message stays far under both.
- Amendments. The feed reads original Form 4s, not Form 4/A amendments. If a number looks off, open the filing link and check for a later correction.
- What a buy means. The research shows averages across thousands of trades. Any single insider can be wrong.
Start with one channel and a $100,000 floor
Create a #insider-buys channel, set up the webhook, and run the bot with --seed once. Schedule it every two hours on weekdays with a $100,000 floor and the fund filter on. Add the daily cluster digest after a week, once you know how busy the channel gets. Raise the floor if it's too loud.
The free tier's 50 credits cover 10 runs, which is enough to see it work before you pay for anything, and you can get a key here.
Frequently asked questions
How do I get insider trading alerts in Slack?
Create a Slack incoming webhook for a channel, then schedule a script that calls an insider-buys API, skips buys it has already posted, and POSTs each new one to the webhook. With Edgrapi's /v1/insider/latest endpoint, the whole bot is about 85 lines of Python and costs 5 credits per run.
Which insider trades should I get alerts for?
Open-market purchases, Form 4 transaction code P. They're the trades where insiders spend their own money at market prices, and research by Jeng, Metrick and Zeckhauser found they earn abnormal returns of more than 6% a year. Insider sales showed no significant abnormal returns in that study, so most alert channels skip them.
What is cluster buying?
Cluster buying is when several insiders at one company buy shares within a short window, usually three or more in 15 days. Alldredge and Blank found clustered purchases were followed by abnormal returns above 2% in the next month. Edgrapi's /v1/insider/clusters endpoint returns these companies with each buyer and the total value.
How fast do insider trades show up?
Insiders must file Form 4 within two business days of the trade. Once the filing reaches SEC EDGAR, Edgrapi's feed picks it up within minutes, and your bot posts it on its next run. So the alert arrives up to two business days after the trade, plus your schedule's interval.
Can I send insider alerts to Discord instead of Slack?
Yes. Discord webhooks work the same way, but take a "content" field instead of Slack's "text" and "blocks". Swap the message builder and the bot works as is. The congress trading tracker bot shows both Slack and Discord versions of the same pattern.
Do I need a server to run a Slack insider alert bot?
No. The polling bot runs on any schedule: cron on a small VM, Windows Task Scheduler, or GitHub Actions. Only the watchlist webhook option needs a public HTTPS endpoint, because Edgrapi has to reach it to deliver each filing.
Related guides: Insider trades and fund holdings
- SEC EDGAR API with Google Sheets: Auto-Refresh a 13F Holdings Tracker
- What Is SEC Form 144? Who Files It, When, and Rule 144 Limits (2026)
- What Is a Schedule 13D? Filing Rules, Deadlines and 13D vs 13G (2026)
- WhaleWisdom Alternatives for 13F Data, Tested (2026)
- SpaceX Lockup Expiration: Every SPCX Unlock Date, Checked