feat(notifications): Slack alerts for new pilot requests
- Add src/notifications/slack.ts — Slack webhook integration with rich blocks - Add src/notifications/index.ts — dispatcher with test-submission filtering - Wire notifyNewPilotRequest() into POST /api/pilot-request (fire-and-forget) - Filter out test submissions (@example.com, E2E, Smoke Test, QA Test, Browser Test) - Skip alert gracefully when SLACK_PILOT_WEBHOOK_URL is not set - Update .gitignore to exclude .playwright-mcp/ artifacts
This commit is contained in:
@@ -34,6 +34,7 @@ import { recordUsage, getMonthlyUsage, getUsageBreakdown, checkLimit } from './b
|
||||
import { getCustomerInvoices, getInvoiceByNumber, markInvoiceSent, markInvoicePaid, generateMonthlyInvoice } from './billing/invoices.js';
|
||||
import { getAllPlatformHealth } from './multitenancy/platform-health.js';
|
||||
import { deliverWebhook, isValidWebhookUrl } from './webhooks/delivery.js';
|
||||
import { notifyNewPilotRequest } from './notifications/index.js';
|
||||
import redis from './redis.js';
|
||||
|
||||
const app = express();
|
||||
@@ -2041,6 +2042,10 @@ app.post('/api/pilot-request', async (req, res) => {
|
||||
|
||||
try {
|
||||
await appendPilotRequestToVault(requestId, body, req);
|
||||
// Fire-and-forget notification — don't block response
|
||||
notifyNewPilotRequest(body, requestId, req).catch((err) =>
|
||||
console.error(`[notification] requestId=${requestId} error:`, err)
|
||||
);
|
||||
res.status(201).json({ ok: true, request_id: requestId });
|
||||
} catch (error) {
|
||||
console.error(`[squaremcp] pilot_request ERROR requestId=${requestId}:`, error);
|
||||
|
||||
Reference in New Issue
Block a user