Skip to content

Commit f254212

Browse files
author
Neo
committed
fix: wire notifications into gateway + README polish
Wire the NotificationDispatcher all the way through at startup so configured channels actually fire at runtime. Previously the dispatcher existed but nothing instantiated it. Changes: - gateway/server.py * Instantiate `self.notifier = NotificationDispatcher(config)` during GatewayServer.__init__, log enabled channels or the setup_communications hint when none are configured. * Attach the EventBroadcaster to WebChatChannel via set_broadcaster() so web-chat notifications flow into /api/v1/events/stream. - README.md * Remove dead links to ROADMAP.md, RUNBOOK.md, and blockchain/docs/ components.md (all deleted earlier). * Replace the stale "50+ services" blurb with an accurate "221 capabilities across 21 categories" section that documents the capability catalog and shows the /api/v1/capabilities endpoints. * Add setup_communications.py guidance + health-check curl to Quick Start. - .env.example * Expand notifications section with every supported env var: Telegram, Discord, Slack, SMTP, Twilio SMS/WhatsApp, APNs, generic webhook.
1 parent 0998a74 commit f254212

3 files changed

Lines changed: 98 additions & 16 deletions

File tree

.env.example

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,41 @@
1919
# BASE_RPC_URL=https://sepolia.base.org
2020

2121
# ── Notifications ──
22+
# Set any subset. Run `python setup_communications.py` for guided setup.
23+
# Telegram
2224
# TELEGRAM_BOT_TOKEN=
23-
# OWNER_TELEGRAM_ID= # Your Telegram user ID — used by the bridge approval gate
25+
# OWNER_TELEGRAM_ID= # Your Telegram chat ID
26+
# Discord
27+
# DISCORD_WEBHOOK_URL=
28+
# Slack
29+
# SLACK_WEBHOOK_URL=
30+
# Email (SMTP)
31+
# SMTP_HOST=smtp.gmail.com
32+
# SMTP_PORT=587
33+
# SMTP_USER=
34+
# SMTP_PASS=
35+
# SMTP_FROM=
36+
# SMTP_TO=
37+
# SMS / WhatsApp (Twilio)
38+
# TWILIO_ACCOUNT_SID=
39+
# TWILIO_AUTH_TOKEN=
40+
# TWILIO_FROM_NUMBER=
41+
# TWILIO_TO_NUMBER=
42+
# TWILIO_WHATSAPP_FROM= # e.g. +14155238886 (Twilio sandbox)
43+
# TWILIO_WHATSAPP_TO=
44+
# iOS push (APNs) — for the MTRX iOS app
45+
# APNS_KEY_ID=
46+
# APNS_TEAM_ID=
47+
# APNS_BUNDLE_ID=com.opnmatrx.mtrx
48+
# Generic webhook
49+
# NOTIFY_WEBHOOK_URL=
50+
# NOTIFY_WEBHOOK_BEARER=
2451

2552
# ── Social media ──
2653
# TWITTER_API_KEY=
2754
# TWITTER_API_SECRET=
2855
# TWITTER_ACCESS_TOKEN=
2956
# TWITTER_ACCESS_SECRET=
30-
# DISCORD_WEBHOOK_URL=
3157
# DISCORD_ANNOUNCEMENTS_WEBHOOK=
3258

3359
# ── Protocol Integrations ────────────────────────────────────

README.md

Lines changed: 41 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,20 @@ The interactive setup walks you through everything — model provider, blockchai
8383
After setup:
8484

8585
```bash
86-
python -m gateway.server
86+
python -m gateway.server # starts on port 18790 (or $PORT)
87+
curl http://localhost:18790/health # {"status": "ok", ...}
8788
```
8889

89-
Or use the install script:
90+
Need to add a notification channel later (Telegram, Discord, Slack, SMS,
91+
Email, WhatsApp, iOS push, webhook)?
92+
93+
```bash
94+
python setup_communications.py # interactive menu
95+
python setup_communications.py telegram # jump to one channel
96+
python setup_communications.py --list # show enabled channels
97+
```
98+
99+
Or use the one-liner install script:
90100

91101
```bash
92102
curl -fsSL https://raw.githubusercontent.com/ItsDardanRexhepi/0pnMatrx/main/install.sh | bash
@@ -132,8 +142,9 @@ What works today, no chain required:
132142

133143
What activates the moment a chain is configured: actual contract
134144
deployment, on-chain attestations, paymaster gas sponsorship, and the
135-
NeoSafe ETH transfer. See `ROADMAP.md` → "Blockchain Activation" for the
136-
checklist.
145+
NeoSafe ETH transfer. Populate `blockchain.*` in `openmatrix.config.json`
146+
and run `python -m contracts.deploy` to flip any "not_deployed" response
147+
into live on-chain behavior.
137148

138149
---
139150

@@ -149,15 +160,32 @@ Every decision made by every agent on 0pnMatrx passes through the Unified Rexhep
149160

150161
---
151162

152-
## Blockchain Infrastructure
163+
## Web3 Capability Surface
164+
165+
**221 capabilities across 21 categories** — smart contracts, DeFi,
166+
DeFi advanced (perps, options, synthetics, orderbook), NFTs, NFT
167+
finance (lending, fractionalization, ERC-6551), identity (DID, KYC),
168+
governance (DAOs, veTokens, quadratic voting, RetroPGF), social
169+
(Lens, Farcaster, Push, creator coins), creator platforms (Sound.xyz,
170+
Mirror, Paragraph), payments (streaming, escrow, channels), cross-chain
171+
(CCIP, Hyperlane, Wormhole, Stargate, Axelar), staking & restaking
172+
(EigenLayer, Symbiotic, Karak, Lido, Rocket Pool), privacy & ZK,
173+
oracles (Chainlink, Pyth, RedStone, API3, Keepers), storage (IPFS,
174+
Arweave, Filecoin, Ceramic, OrbitDB), compute & DePIN (Akash, Gensyn,
175+
Render), real-world assets, markets (prediction, auction), gaming,
176+
and security (MPC, social recovery, session keys).
177+
178+
Every capability is catalogued in `runtime/capabilities/catalog.py`.
179+
Browse them at runtime:
180+
181+
```bash
182+
curl http://localhost:18790/api/v1/capabilities # list all
183+
curl http://localhost:18790/api/v1/capabilities/categories # 21 buckets
184+
```
153185

154-
50+ blockchain services run natively on Base (Ethereum L2) and
155-
return a well-formed `{"status": "not_deployed", ...}` envelope
156-
whenever a chain is not configured, so every flow is safe to exercise
157-
offline. All transaction fees are covered by the platform paymaster
158-
once deployed — users never pay gas. See
159-
`blockchain/docs/components.md` and `ROADMAP.md` for the activation
160-
checklist.
186+
All transactions are sponsored by the platform paymaster — users never
187+
pay gas. Capabilities return `{"status": "not_deployed", ...}` until
188+
contracts are deployed, keeping every flow safe to exercise offline.
161189

162190
---
163191

@@ -295,8 +323,7 @@ kubectl apply -f k8s/
295323
./scripts/build-contracts.sh
296324
```
297325

298-
See `docs/RUNBOOK.md` for the full on-call playbook and
299-
`docs/api-reference.md` for the complete HTTP / WebSocket surface.
326+
See `docs/api-reference.md` for the complete HTTP / WebSocket surface.
300327

301328
---
302329

gateway/server.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,28 @@ def __init__(self, config: dict):
284284
self.badge_manager = None
285285
self.certification_manager = None
286286

287+
# ── Notifications (unified 9-channel dispatcher) ────────────
288+
# Available channels: telegram, discord, slack, email, sms,
289+
# whatsapp, web_chat, ios_push, webhook. Configure with
290+
# `python setup_communications.py`. Every channel is optional;
291+
# the dispatcher is always instantiated so callers can rely on
292+
# it without guarding imports.
293+
try:
294+
from runtime.notifications import NotificationDispatcher
295+
self.notifier = NotificationDispatcher(config)
296+
enabled = self.notifier.list_enabled_channels()
297+
if enabled:
298+
logger.info("Notifications ready: %s", ", ".join(enabled))
299+
else:
300+
logger.info(
301+
"Notifications: no channels configured. "
302+
"Run `python setup_communications.py` to add Telegram, "
303+
"Discord, Slack, SMS, Email, WhatsApp, iOS push, or webhooks."
304+
)
305+
except Exception as exc:
306+
logger.warning("NotificationDispatcher init failed: %s", exc)
307+
self.notifier = None
308+
287309
# Rate limiting — three buckets:
288310
# - ``rate_limiter_auth`` : API-key bearer auth (operator tokens)
289311
# - ``rate_limiter_wallet`` : per-SIWE-address, keyed by wallet
@@ -1492,6 +1514,13 @@ def create_app(self) -> web.Application:
14921514
# service dispatchers, metrics) can push live events into
14931515
# /api/v1/events/stream.
14941516
self.event_broadcaster = service_routes.broadcaster
1517+
# Connect the WebChatChannel so /api/v1/events/stream
1518+
# receives notifications broadcast by the NotificationDispatcher.
1519+
try:
1520+
from runtime.notifications.web_chat import WebChatChannel
1521+
WebChatChannel.set_broadcaster(self.event_broadcaster)
1522+
except Exception as _exc:
1523+
logger.debug("Web chat broadcaster not wired: %s", _exc)
14951524
logger.info("Service routes registered successfully.")
14961525
except Exception as e:
14971526
logger.warning("Service routes registration skipped: %s", e)

0 commit comments

Comments
 (0)