@reddoorla/maintenance 0.10.0 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +54 -1
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -314,7 +314,60 @@ RESEND_WEBHOOK_SECRET=whsec_XXXX # only for the deployed webhook
314
314
 
315
315
  Renders + sends every Reports row with `Draft ready=true && Approved to send=true && Sent at IS NULL`. Stamps `Sent at` + `Delivery status=pending` on each.
316
316
 
317
- 5. **Delivery status updates automatically** via the Resend webhook (Netlify Function at `netlify/functions/resend-webhook.mts`) — `Delivery status` flips to `delivered` / `bounced` / `complained` as events arrive.
317
+ 5. **Delivery status updates automatically** via the Resend webhook (Netlify Function at `netlify/functions/resend-webhook.mts`) — `Delivery status` flips to `delivered` / `bounced` / `complained` as events arrive. Deploy procedure: see [Webhook deployment](#webhook-deployment-netlify--resend) below.
318
+
319
+ ### Webhook deployment (Netlify + Resend)
320
+
321
+ The Resend delivery webhook lives at `netlify/functions/resend-webhook.mts` in this repo. Deploying it is a one-time operation per environment: connect the repo to a Netlify site, set three env vars, register the deployed URL with Resend.
322
+
323
+ **1. Create the Netlify site:**
324
+
325
+ - New site → Import from Git → pick `tucksravin/reddoor-maintenance`.
326
+ - Branch to deploy: `main`. Build settings are read from [`netlify.toml`](netlify.toml) (no build command needed — functions-only).
327
+ - Site name: pick something stable (e.g. `reddoor-webhooks`) since it ends up in the public webhook URL.
328
+
329
+ **2. Set env vars** in Site settings → Environment variables:
330
+
331
+ | Variable | Value |
332
+ | ----------------------- | --------------------------------------------------------------------------- |
333
+ | `AIRTABLE_PAT` | Same PAT used by the CLI (read+write on the Websites + Reports tables) |
334
+ | `AIRTABLE_BASE_ID` | `appHG8nLOzULzXOER` |
335
+ | `RESEND_WEBHOOK_SECRET` | Generated by Resend in step 4 — paste back here after creating the endpoint |
336
+
337
+ **3. Trigger a deploy** (Deploys → Trigger deploy → Deploy site). When it goes green, curl the health endpoint:
338
+
339
+ ```bash
340
+ curl https://<your-site>.netlify.app/.netlify/functions/resend-webhook
341
+ ```
342
+
343
+ Expected:
344
+
345
+ ```json
346
+ {
347
+ "status": "ok",
348
+ "service": "reddoor-resend-webhook",
349
+ "env": {
350
+ "RESEND_WEBHOOK_SECRET": true,
351
+ "AIRTABLE_PAT": true,
352
+ "AIRTABLE_BASE_ID": true
353
+ }
354
+ }
355
+ ```
356
+
357
+ Any `false` means the env var didn't land — re-check step 2 and re-deploy. The health endpoint reports presence-only and never returns secret values, so the output is safe to share in a support ticket.
358
+
359
+ **4. Register the webhook in Resend:** [resend.com/webhooks](https://resend.com/webhooks) → Add Endpoint → paste the function URL from step 3 → select events `email.delivered`, `email.bounced`, `email.complained` → save. Copy the generated **Signing Secret** (`whsec_…`) into Netlify's `RESEND_WEBHOOK_SECRET` env var (step 2) and trigger another deploy so the secret takes effect.
360
+
361
+ **5. End-to-end smoke test (using ERP Industrials):**
362
+
363
+ ```bash
364
+ # from your CLI:
365
+ reddoor-maint report erp-industrials # drafts a Maintenance report → Airtable
366
+ # approve the draft in Airtable, then:
367
+ reddoor-maint report --send-ready
368
+ ```
369
+
370
+ Within a few minutes, watch the ERP Reports row's `Delivery status` flip from `pending` → `delivered` as Resend pings the webhook. Function logs in Netlify show each event with its messageId + new status. If the webhook returns 5xx, svix retries; check the Netlify function log for the error envelope.
318
371
 
319
372
  ### Frequency math
320
373
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reddoorla/maintenance",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
4
4
  "description": "Canonical maintenance configs, audits, and recipes for the reddoor stack.",
5
5
  "type": "module",
6
6
  "license": "MIT",