-
-
Notifications
You must be signed in to change notification settings - Fork 2
plugin mux
Email and webhook pipeline engine with YAML rule routing, AI classification, auto-reply, and a dead-letter queue. Pro plugin (ɳClaw bundle).
Requires: Pro license entitlement.
nself license set nself_pro_...
plugin-mux (service plugin-mux, port 3711) is the routing and automation core of the ɳClaw bundle. It ingests email (Gmail/IMAP/Outlook) and webhook events (GitHub, Slack, Telegram, generic), evaluates them against YAML-defined rules, and dispatches actions through 9 handler groups:
- PatternNotify: match a sender/subject pattern, fire a notification.
- InboxRouter: route a message to a labeled bucket or downstream handler.
- SilentTrash: drop noise without notifying.
- ContentForward: forward the message body to a webhook or another address (SSRF-guarded).
- ObserveNotify: observe-only notifications for audit.
-
CalendarSync: sync calendar invites via the
googleplugin. - AutoReply: generate and (optionally) send a reply, with a human-approval queue.
- SheetLogger: append rows to a Google Sheet.
- DonorHandler: special-case donor/contact handling.
Classification and reply drafting use the ai plugin; notifications use the notify plugin; Google/Gmail integration uses the google plugin. All outbound HTTP (ContentForward, webhook dispatch, DLQ retry) passes through the shared SSRF guard, which blocks RFC-1918, loopback, link-local, and cloud metadata addresses.
nself license set nself_pro_xxxxx...
nself plugin install mux
nself restartThe license gate (requires_license: true, entitlement pro) is enforced by the ping_api middleware on every /mux/* route. Unauthenticated or unentitled calls receive 403.
| Dependency | Required | Purpose |
|---|---|---|
notify plugin |
Yes | Outbound notifications |
google plugin |
Yes | Gmail ingestion, Calendar/Sheets actions |
ai plugin |
Yes | Classification, rule suggestion, reply drafting |
| PostgreSQL | Yes | All state (np_mux_* tables) |
| Redis | Optional | Dedup/cooldown acceleration |
| Env Var | Default | Description |
|---|---|---|
DATABASE_URL |
— (required) | Postgres connection string |
MUX_PORT |
3711 |
Mux service port |
MUX_HOST |
0.0.0.0 |
Bind address |
MUX_RULES_PATH |
— | Path to the YAML rules file |
MUX_AI_ENABLED |
true |
Use the ai plugin for classification |
MUX_PUBSUB_SUBSCRIPTION |
— | Google Pub/Sub subscription for Gmail push |
MUX_DLQ_MAX_RETRIES |
5 |
Max retries before a message is parked in the DLQ |
MUX_DLQ_RETRY_WEBHOOK_URL |
— | Webhook notified on DLQ retry (SSRF-guarded) |
PLUGIN_MUX_SHADOW_MODE |
false |
Evaluate rules but suppress side effects (dry run) |
PLUGIN_MUX_RULES_YAML |
— | Inline YAML rules (alternative to MUX_RULES_PATH) |
PLUGIN_MUX_AI_TOKEN |
— | Override token for the ai plugin call |
PLUGIN_VOICE_INTERNAL_URL |
— | ɳVoice internal URL for TTS notifications |
PLUGIN_VOICE_INTERNAL_SECRET |
— | ɳVoice internal auth secret |
PLUGIN_VOICE_TTS_PROVIDER |
— | TTS provider selector for voice notifications |
| Port | Purpose |
|---|---|
| 3711 | Mux REST API, webhook receiver, and health/metrics |
All routes are mounted under /mux and gated by the ping_api license middleware (except /health, /ready, and /metrics).
| Method | Path | Description |
|---|---|---|
| GET |
/health · /mux/health
|
Liveness probe |
| GET |
/ready · /mux/ready
|
Readiness probe (DB reachable) |
| GET | /mux/health/migrations |
Migration status |
| GET | /mux/health/push-status |
Gmail push subscription health |
| GET | /mux/diagnostics |
Runtime diagnostics |
| GET | /mux/diagnostics/unmatched |
Messages that matched no rule |
| GET |
/mux/metrics · /metrics
|
Prometheus metrics |
| GET |
/internal/tools · /mux/ai/instructions
|
AI tool/instruction manifest |
| GET | /mux/config/schema |
JSON schema for the rule config |
| Method | Path | Description |
|---|---|---|
| POST | /mux/ingest |
Generic message ingest |
| POST | /mux/ingest/webhook |
Generic webhook ingest |
| POST | /mux/trigger |
Token-auth generic trigger |
| POST | /mux/ingest/github |
GitHub webhook (signature-verified) |
| POST | /mux/ingest/slack |
Slack events (signature-verified) |
| POST | /mux/ingest/telegram |
Telegram webhook |
| GET | /mux/ingest/status |
Ingest pipeline status |
| GET | /mux/ingest/rss/feeds |
Configured RSS feeds |
| POST |
/mux/gmail/push · /mux/outlook/push
|
Provider push notifications |
| POST | /mux/push |
Generic push receiver |
| POST | /mux/tokens/import |
Import Gmail OAuth tokens |
| Method | Path | Description |
|---|---|---|
| GET/POST | /mux/accounts |
List / create accounts |
| PATCH/DELETE | /mux/accounts/{id} |
Update / delete an account |
| GET/POST | /mux/rules |
List / create rules |
| GET/PATCH/DELETE | /mux/rules/{id} |
Get / update / delete a rule |
| GET | /mux/rules/export |
Export rules as YAML |
| POST | /mux/rules/import |
Import rules from YAML |
| GET | /mux/rules/{id}/test-history |
Past test results for a rule |
| GET/POST | /mux/rules/suggest |
List / generate AI rule suggestions |
| POST | /mux/rules/test |
Dry-run rules against samples |
| POST | /mux/rules/{id}/compile |
Compile a suggestion into a live rule |
| POST |
/mux/reload · /mux/test · /mux/replay
|
Reload config / test / replay |
| GET | /mux/runs |
Rule execution history |
| Method | Path | Description |
|---|---|---|
| GET |
/mux/messages · /mux/messages/search
|
Query / search ingested messages |
| POST | /mux/messages/summarize-today |
AI summary of today's messages |
| POST | /mux/messages/draft-reply |
Draft an AI reply |
| POST |
/mux/digest/generate · /mux/digests/{id}/send-now
|
Generate / send digests |
| GET | /mux/analytics/{volume,rules,senders,latency,actions} |
Analytics dashboards |
| GET |
/mux/classifications/categories · /mux/classifications/runs
|
Classification data |
| POST |
/mux/classifications/classify · /mux/classifications/feedback
|
Classify / give feedback |
| Method | Path | Description |
|---|---|---|
| POST |
/mux/pending-replies/{id}/approve · /discard
|
Approve / discard a queued reply |
| GET | /mux/auto-reply/audit |
Auto-reply audit log |
| GET | /mux/dlq |
List dead-letter items |
| POST |
/mux/dlq/{id}/retry · /mux/dlq/clear-failed
|
Retry / clear DLQ items |
| DELETE | /mux/dlq/{id} |
Delete a DLQ item |
Core tables declared in plugin.json:
-
np_mux_accounts: connected email/webhook accounts -
np_mux_rules: routing rules -
np_mux_rule_logs: per-rule evaluation log -
np_mux_dedup_log: deduplication ledger -
np_mux_cooldowns: per-rule cooldown windows -
np_mux_runs: rule execution runs
Supporting tables created by migrations include np_mux_messages, np_mux_dlq, np_mux_audit_queue, np_mux_gmail_dlq, np_mux_pending_replies, np_mux_digests, np_mux_classifications_feedback, np_mux_threads, np_mux_newsletter_articles, and np_mux_workflows.
Multi-app isolation (source_account_id TEXT NOT NULL DEFAULT 'primary' with a Hasura row filter {"source_account_id":{"_eq":"X-Hasura-Source-Account-Id"}}) is applied per the Multi-Tenant Convention Wall on the tables that carry it (np_mux_messages, np_mux_deferred_actions, np_mux_newsletter_articles); remaining tables are scoped through their parent account or rule. Cloud-tenant tables (np_mux_gmail_dlq, np_mux_audit_queue) enforce {"tenant_id":{"_eq":"X-Hasura-Tenant-Id"}}.
| Route | Target |
|---|---|
/mux/ingest/* |
Inbound webhook/event receivers |
/mux/ |
Mux management API |
-
Set a Pro license and install:
nself license set nself_pro_xxxxx... nself plugin install mux -
Configure a rules file at
MUX_RULES_PATH(or setPLUGIN_MUX_RULES_YAMLinline):rules: - name: urgent-support match: subject: "(?i)urgent|outage" action: PatternNotify notify: channel: ops
-
Restart and verify health:
nself restart curl -fsS http://localhost:3711/health
-
Reload rules without a restart after editing:
curl -X POST http://localhost:3711/mux/reload
-
Send a test event and confirm a run is recorded:
curl -X POST http://localhost:3711/mux/trigger \ -H "Authorization: Bearer $MUX_TOKEN" \ -d '{"subject":"urgent outage","body":"db down"}' curl http://localhost:3711/mux/runs
| Symptom | Likely cause | Fix |
|---|---|---|
403 on every /mux/* call |
Missing/invalid Pro license |
nself license set nself_pro_..., then nself restart
|
/mux/ingest/webhook returns 403 for an outbound forward |
SSRF guard blocked an RFC-1918/loopback/metadata target | Point ContentForward/MUX_DLQ_RETRY_WEBHOOK_URL at a public host; the guard rejects 10.0.0.0/8, 127.0.0.1, 169.254.169.254 by design |
| Messages never match a rule | Rules file not loaded | Check MUX_RULES_PATH/PLUGIN_MUX_RULES_YAML; GET /mux/diagnostics/unmatched; POST /mux/reload
|
| GitHub/Slack webhooks rejected | Signature verification failed | Confirm the webhook secret matches; check the X-Hub-Signature-256 / X-Slack-Signature headers |
| Gmail ingest stops | Push subscription expired |
GET /mux/health/push-status; re-import tokens via POST /mux/tokens/import
|
| Messages stuck in the DLQ | Downstream handler failing |
GET /mux/dlq; fix the handler; POST /mux/dlq/{id}/retry or POST /mux/dlq/clear-failed
|
| Auto-replies not sending | Pending-approval queue |
GET /mux/auto-reply/audit; approve via POST /mux/pending-replies/{id}/approve
|
| Rules evaluate but nothing happens | Shadow mode on | Unset PLUGIN_MUX_SHADOW_MODE (dry-run flag) and restart |
- ɳClaw bundle overview:
nself plugin list --bundle nclaw - Security-Always-Free doctrine (SSRF guard ships free)
-
ai,notify, andgoogleplugin docs for the action backends
ɳSelf CLI v1.0.9. MIT licensed. Docs CC BY 4.0.
GitHub · Issues · Discussions · nself.org · docs.nself.org
Getting Started
Commands
- Commands, Overview
- Lifecycle: cmd-init · cmd-build · cmd-start · cmd-stop · cmd-restart · cmd-dev
- Monitoring: cmd-status · cmd-logs · cmd-health · cmd-urls · cmd-doctor · cmd-monitor · cmd-alerts · cmd-sentry · cmd-watchdog · cmd-dogfood
- Data: cmd-db · cmd-backup · cmd-dr · cmd-queue · cmd-webhooks
- Config: cmd-config · cmd-service · cmd-env · cmd-promote
- Networking: cmd-ssl · cmd-trust · cmd-dns-setup
- Security: cmd-security · cmd-secrets · cmd-waf
- Tenancy: cmd-tenant · cmd-billing
- Plugins: cmd-plugin · cmd-license
- AI: cmd-ai · cmd-claw · cmd-model
- Templates: cmd-template
- Utilities: cmd-exec · cmd-clean · cmd-reset · cmd-update · cmd-upgrade · cmd-version · cmd-admin · cmd-migrate · cmd-migrate-firebase · cmd-migrate-supabase · cmd-completion
Features
- Features, Overview
- Feature-Auth
- Feature-Storage
- Feature-Search
- Feature-Functions
- Feature-Email
- Feature-Monitoring
- Feature-Plugins
- Feature-ɳClaw, AI Assistant
- Feature-ɳChat, Messaging
- Feature-ɳTV, Media Player
- Feature-ɳFamily, Family Social
- Feature-ɳCloud, Managed Hosting
- Feature-Memory-Rooms, Knowledge Organization
- Feature-Agent-Dashboard, Agent Metrics
- Feature-Image-Generation, AI Image Generation
Configuration
- Configuration, Overview
- Config-Env-Vars
- Config-Postgres
- Config-Hasura
- Config-Auth
- Config-Nginx
- Config-Optional-Services
- Config-Custom-Services
- Config-System
Plugins (87 + 10 monitoring)
Free (25)
- plugin-backup
- plugin-content-acquisition
- plugin-content-progress
- plugin-cron
- plugin-donorbox
- plugin-feature-flags
- plugin-github
- plugin-github-runner
- plugin-invitations
- plugin-jobs
- plugin-link-preview
- plugin-mdns
- plugin-mlflow
- plugin-monitoring
- plugin-notifications
- plugin-notify
- plugin-paypal
- plugin-search
- plugin-shopify
- plugin-stripe
- plugin-subtitle-manager
- plugin-tokens
- plugin-torrent-manager
- plugin-vpn
- plugin-webhooks
Pro (62)
- plugin-access-controls
- plugin-activity-feed
- plugin-admin-api
- nself-ai-gateway
- nself-ai-cc
- nself-ai-mcp
- plugin-analytics
- plugin-auth
- plugin-backup-pro
- plugin-bots
- plugin-browser
- plugin-calendar
- plugin-cdn
- plugin-chat
- plugin-claw
- plugin-claw-budget
- plugin-claw-news
- plugin-claw-web
- plugin-cloudflare
- plugin-cms
- plugin-compliance
- plugin-cron-pro
- plugin-ddns
- plugin-devices
- plugin-documents
- plugin-donorbox-pro
- plugin-entitlements
- plugin-epg
- plugin-file-processing
- plugin-game-metadata
- plugin-geocoding
- plugin-geolocation
- plugin-google
- plugin-home
- plugin-idme
- plugin-knowledge-base
- plugin-linkedin
- plugin-livekit
- plugin-media-processing
- plugin-meetings
- plugin-moderation
- plugin-mux
- plugin-notify-pro
- plugin-object-storage
- plugin-observability
- plugin-paypal-pro
- plugin-photos
- plugin-podcast
- plugin-post
- plugin-realtime
- plugin-recording
- plugin-retro-gaming
- plugin-rom-discovery
- plugin-shopify-pro
- plugin-social
- plugin-sports
- plugin-stream-gateway
- plugin-streaming
- plugin-stripe-pro
- plugin-support
- plugin-tmdb
- plugin-voice
- plugin-web3
- plugin-workflows
Planned (26)
plugin-auditplugin-blogplugin-checkoutplugin-commerceplugin-drmplugin-exportplugin-flowplugin-importplugin-ldapplugin-mailgunplugin-mediaplugin-oauth-providersplugin-pagesplugin-postmarkplugin-rate-limitplugin-reportsplugin-samlplugin-schedulerplugin-sendgridplugin-ssoplugin-subscriptionplugin-thumbplugin-transcoderplugin-twilioplugin-wafplugin-watermark
Guides
- Guide-Production-Deployment
- Guide-SSL-Setup
- Guide-Multi-Tenancy
- Guide-Security-Hardening
- Guide-Monitoring-Setup
- Guide-Backup-Restore
- Guide-Custom-Services
- Guide-Migration-from-v1
Architecture
Reference
- API-Reference
- reference-error-codes, Error Codes
Licensing
Security
Brand
Operations
- operations/release-cascade, Release Cascade
- operations/self-healing, Self-Healing Schema
- operations/redis-tuning, Redis Pool Tuning
- operations/meilisearch-warmup, MeiliSearch Warm-Up
- operations/jwt-rotation, JWT Key Rotation
- operations/windows-wsl2-setup, Windows / WSL2 Setup
- operations/gemini-oauth-reauth, Gemini OAuth Reauth
Contributing
Admin
- USER-ACTION-QUEUE, Pending Admin Actions