claude-plugin-wordpress-manager 2.6.0 → 2.9.0
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.
- package/CHANGELOG.md +61 -0
- package/agents/wp-monitoring-agent.md +44 -0
- package/agents/wp-site-manager.md +19 -0
- package/docs/plans/2026-03-01-tier4-5-implementation.md +1783 -0
- package/docs/plans/2026-03-01-tier4-5-observability-automation-design.md +426 -0
- package/docs/plans/2026-03-01-wcop-reassessment-v2.6.0.md +403 -0
- package/hooks/hooks.json +9 -0
- package/package.json +10 -3
- package/servers/wp-rest-bridge/build/tools/cwv.d.ts +3 -0
- package/servers/wp-rest-bridge/build/tools/cwv.js +196 -0
- package/servers/wp-rest-bridge/build/tools/ga4.d.ts +3 -0
- package/servers/wp-rest-bridge/build/tools/ga4.js +323 -0
- package/servers/wp-rest-bridge/build/tools/index.js +15 -0
- package/servers/wp-rest-bridge/build/tools/plausible.d.ts +3 -0
- package/servers/wp-rest-bridge/build/tools/plausible.js +207 -0
- package/servers/wp-rest-bridge/build/tools/slack.d.ts +3 -0
- package/servers/wp-rest-bridge/build/tools/slack.js +129 -0
- package/servers/wp-rest-bridge/build/tools/wc-workflows.d.ts +3 -0
- package/servers/wp-rest-bridge/build/tools/wc-workflows.js +222 -0
- package/servers/wp-rest-bridge/build/wordpress.d.ts +18 -0
- package/servers/wp-rest-bridge/build/wordpress.js +139 -0
- package/skills/wordpress-router/SKILL.md +1 -1
- package/skills/wordpress-router/references/decision-tree.md +8 -2
- package/skills/wp-alerting/SKILL.md +142 -0
- package/skills/wp-alerting/references/alert-thresholds.md +79 -0
- package/skills/wp-alerting/references/escalation-paths.md +92 -0
- package/skills/wp-alerting/references/report-scheduling.md +142 -0
- package/skills/wp-alerting/references/slack-integration.md +109 -0
- package/skills/wp-alerting/scripts/alerting_inspect.mjs +150 -0
- package/skills/wp-analytics/SKILL.md +158 -0
- package/skills/wp-analytics/references/analytics-dashboards.md +83 -0
- package/skills/wp-analytics/references/cwv-monitoring.md +101 -0
- package/skills/wp-analytics/references/ga4-integration.md +76 -0
- package/skills/wp-analytics/references/plausible-setup.md +92 -0
- package/skills/wp-analytics/references/traffic-attribution.md +92 -0
- package/skills/wp-analytics/scripts/analytics_inspect.mjs +153 -0
- package/skills/wp-content-attribution/SKILL.md +1 -0
- package/skills/wp-content-optimization/SKILL.md +1 -0
- package/skills/wp-content-workflows/SKILL.md +142 -0
- package/skills/wp-content-workflows/references/content-lifecycle-hooks.md +131 -0
- package/skills/wp-content-workflows/references/multi-channel-actions.md +151 -0
- package/skills/wp-content-workflows/references/schedule-triggers.md +118 -0
- package/skills/wp-content-workflows/references/trigger-management.md +159 -0
- package/skills/wp-content-workflows/references/wp-action-hooks.md +114 -0
- package/skills/wp-content-workflows/scripts/workflow_inspect.mjs +202 -0
- package/skills/wp-monitoring/SKILL.md +2 -0
- package/skills/wp-search-console/SKILL.md +1 -0
- package/skills/wp-social-email/SKILL.md +1 -0
- package/skills/wp-webhooks/SKILL.md +1 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: wp-alerting
|
|
3
|
+
description: This skill should be used when the user asks about "alerting",
|
|
4
|
+
"alerts", "Slack notifications", "email alerts", "monitoring alerts",
|
|
5
|
+
"threshold alerts", "health reports", "escalation", "incident notifications",
|
|
6
|
+
"uptime alerts", "error alerts", "performance alerts", "scheduled reports",
|
|
7
|
+
or mentions setting up notification channels for WordPress monitoring events.
|
|
8
|
+
version: 1.0.0
|
|
9
|
+
tags: [alerting, slack, notifications, monitoring, email]
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# WordPress Alerting Skill
|
|
13
|
+
|
|
14
|
+
## Overview
|
|
15
|
+
|
|
16
|
+
Cross-cutting alerting system combining Slack (webhook + Bot Token) and SendGrid email for WordPress monitoring events. Provides severity-based routing, configurable thresholds, escalation paths, and scheduled health reports. This skill connects monitoring data from other skills (analytics, performance, uptime) to notification channels, ensuring the right people are informed at the right time with the right level of urgency.
|
|
17
|
+
|
|
18
|
+
## When to Use
|
|
19
|
+
|
|
20
|
+
- User wants to set up Slack notifications for WordPress events
|
|
21
|
+
- User needs email alerts for critical site issues (downtime, errors)
|
|
22
|
+
- User asks about alert thresholds (CWV scores, error rates, disk usage)
|
|
23
|
+
- User wants to configure escalation rules (info vs warning vs critical)
|
|
24
|
+
- User needs scheduled health reports (daily digest, weekly summary)
|
|
25
|
+
- User asks about alert cooldown, deduplication, or routing logic
|
|
26
|
+
- User wants to integrate monitoring data with notification channels
|
|
27
|
+
- User needs to test alert delivery (Slack webhook or SendGrid)
|
|
28
|
+
|
|
29
|
+
## Decision Tree
|
|
30
|
+
|
|
31
|
+
1. **What notification channel?**
|
|
32
|
+
- "Slack webhook" / "simple alerts" → Slack Webhook Setup (Procedure 1)
|
|
33
|
+
- "Slack bot" / "Block Kit" / "advanced Slack" → Slack Bot Setup (Procedure 2)
|
|
34
|
+
- "email alerts" / "SendGrid alerts" → Use SendGrid config from `wp-social-email`
|
|
35
|
+
- "both" / "escalation" → Alert Dispatch with severity routing (Procedure 4)
|
|
36
|
+
|
|
37
|
+
2. **Run detection first:**
|
|
38
|
+
```bash
|
|
39
|
+
node skills/wp-alerting/scripts/alerting_inspect.mjs [--cwd=/path/to/project]
|
|
40
|
+
```
|
|
41
|
+
This identifies configured Slack credentials, SendGrid keys, and monitoring plugins.
|
|
42
|
+
|
|
43
|
+
## Procedures
|
|
44
|
+
|
|
45
|
+
### Procedure 1: Slack Webhook Setup (Simple Alerts)
|
|
46
|
+
|
|
47
|
+
See `references/slack-integration.md`
|
|
48
|
+
- Create Incoming Webhook in Slack App dashboard
|
|
49
|
+
- Add `slack_webhook_url` to WP_SITES_CONFIG
|
|
50
|
+
- Optionally set `slack_channel` for default channel override
|
|
51
|
+
- Send test message via `slack_send_webhook` tool
|
|
52
|
+
- Validate delivery and format
|
|
53
|
+
|
|
54
|
+
### Procedure 2: Slack Bot Setup (Advanced Messaging)
|
|
55
|
+
|
|
56
|
+
See `references/slack-integration.md`
|
|
57
|
+
- Create Slack App with Bot Token (OAuth scopes: `chat:write`, `channels:read`)
|
|
58
|
+
- Add `slack_bot_token` and `slack_channel` to WP_SITES_CONFIG
|
|
59
|
+
- Use Block Kit formatting for structured alert messages
|
|
60
|
+
- Support for threaded replies, reactions, and channel management
|
|
61
|
+
- Send test message via `slack_send_message` tool
|
|
62
|
+
|
|
63
|
+
### Procedure 3: Alert Threshold Configuration
|
|
64
|
+
|
|
65
|
+
See `references/alert-thresholds.md`
|
|
66
|
+
- Define thresholds for Core Web Vitals (LCP, CLS, INP, FCP, TTFB)
|
|
67
|
+
- Set uptime and error rate thresholds (5xx rate, response time)
|
|
68
|
+
- Configure disk usage and resource limits
|
|
69
|
+
- Set plugin update and content freshness alerts
|
|
70
|
+
- Map each threshold to a severity level (info, warning, critical)
|
|
71
|
+
|
|
72
|
+
### Procedure 4: Alert Dispatch (Severity-Based Routing)
|
|
73
|
+
|
|
74
|
+
See `references/escalation-paths.md`
|
|
75
|
+
- **Info** — Slack message only (general channel)
|
|
76
|
+
- **Warning** — Slack message + threaded details
|
|
77
|
+
- **Critical** — Slack message + email notification (SendGrid) + urgent flag
|
|
78
|
+
- Cooldown periods to prevent alert fatigue
|
|
79
|
+
- Deduplication rules to avoid repeated notifications
|
|
80
|
+
- Acknowledgment tracking for critical alerts
|
|
81
|
+
|
|
82
|
+
### Procedure 5: Scheduled Health Reports
|
|
83
|
+
|
|
84
|
+
See `references/report-scheduling.md`
|
|
85
|
+
- Daily digest: key metrics summary, new alerts, resolved alerts
|
|
86
|
+
- Weekly performance summary: CWV trends, traffic changes, uptime stats
|
|
87
|
+
- Monthly analytics report: comprehensive overview with comparisons
|
|
88
|
+
- On-demand report generation via command
|
|
89
|
+
- Report format templates using Slack Block Kit
|
|
90
|
+
|
|
91
|
+
## MCP Tools Reference
|
|
92
|
+
|
|
93
|
+
| Tool | Description |
|
|
94
|
+
|------|-------------|
|
|
95
|
+
| `slack_send_webhook` | Send alert via Slack Incoming Webhook URL |
|
|
96
|
+
| `slack_send_message` | Send alert via Slack Bot Token (supports Block Kit) |
|
|
97
|
+
| `slack_list_channels` | List available Slack channels for alert routing |
|
|
98
|
+
| `sg_send_email` | Send alert email via SendGrid |
|
|
99
|
+
| `sg_send_template_email` | Send templated alert email via SendGrid |
|
|
100
|
+
| `sg_list_templates` | List available SendGrid email templates |
|
|
101
|
+
| `sg_create_template` | Create a new alert email template |
|
|
102
|
+
| `sg_get_template` | Get alert email template details |
|
|
103
|
+
| `sg_validate_email` | Validate alert recipient email address |
|
|
104
|
+
|
|
105
|
+
## Reference Files
|
|
106
|
+
|
|
107
|
+
| File | Content |
|
|
108
|
+
|------|---------|
|
|
109
|
+
| `references/slack-integration.md` | Slack Incoming Webhook + Bot Token setup, Block Kit formatting, best practices |
|
|
110
|
+
| `references/alert-thresholds.md` | Threshold definitions for CWV, uptime, error rate, disk, plugins, content |
|
|
111
|
+
| `references/escalation-paths.md` | Severity levels, routing rules, cooldown, dedup, acknowledgment |
|
|
112
|
+
| `references/report-scheduling.md` | Scheduled reports: daily, weekly, monthly, on-demand, Block Kit templates |
|
|
113
|
+
|
|
114
|
+
## Recommended Agent
|
|
115
|
+
|
|
116
|
+
Use the **`wp-monitoring-agent`** for automated alerting workflows that combine threshold monitoring, severity-based dispatch, and scheduled health report generation.
|
|
117
|
+
|
|
118
|
+
## Related Skills
|
|
119
|
+
|
|
120
|
+
- **`wp-monitoring`** — source of monitoring data that triggers alerts
|
|
121
|
+
- **`wp-analytics`** — analytics metrics used in threshold evaluation and reports
|
|
122
|
+
- **`wp-social-email`** — shares SendGrid configuration for email delivery
|
|
123
|
+
|
|
124
|
+
## Cross-references
|
|
125
|
+
|
|
126
|
+
- Alert thresholds pair with `wp-analytics` CWV data for performance alerting
|
|
127
|
+
- Slack integration connects to `wp-monitoring` for uptime and health alerts
|
|
128
|
+
- SendGrid config is shared with `wp-social-email` for consistent email delivery
|
|
129
|
+
- Scheduled reports aggregate data from `wp-analytics` and `wp-monitoring`
|
|
130
|
+
|
|
131
|
+
## Troubleshooting
|
|
132
|
+
|
|
133
|
+
| Issue | Cause | Resolution |
|
|
134
|
+
|-------|-------|------------|
|
|
135
|
+
| Slack webhook returns 404 | Webhook URL invalid or deleted | Recreate webhook in Slack App dashboard and update WP_SITES_CONFIG |
|
|
136
|
+
| Slack bot "not_in_channel" | Bot not invited to target channel | Invite bot to channel with `/invite @botname` or use `channels:join` scope |
|
|
137
|
+
| Slack bot "missing_scope" | Bot token lacks required OAuth scopes | Add `chat:write` and `channels:read` scopes in Slack App settings |
|
|
138
|
+
| Slack rate limited (429) | Too many messages per second | Implement cooldown periods; batch non-critical alerts |
|
|
139
|
+
| SendGrid 403 error | API key lacks Mail Send permission | Regenerate API key with "Mail Send" access in SendGrid dashboard |
|
|
140
|
+
| Alerts not firing | Thresholds not configured or too high | Review threshold config; lower thresholds for testing |
|
|
141
|
+
| Duplicate alerts | No dedup rules configured | Enable deduplication with cooldown period per alert type |
|
|
142
|
+
| Detection script exit 1 | No alerting config found | Add slack_webhook_url, slack_bot_token, or sg_api_key to WP_SITES_CONFIG |
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Alert Threshold Definitions
|
|
2
|
+
|
|
3
|
+
## Core Web Vitals Thresholds
|
|
4
|
+
|
|
5
|
+
| Metric | Good | Warning | Critical | Unit |
|
|
6
|
+
|--------|------|---------|----------|------|
|
|
7
|
+
| LCP (Largest Contentful Paint) | < 2.5s | 2.5s - 4.0s | > 4.0s | seconds |
|
|
8
|
+
| FCP (First Contentful Paint) | < 1.8s | 1.8s - 3.0s | > 3.0s | seconds |
|
|
9
|
+
| CLS (Cumulative Layout Shift) | < 0.1 | 0.1 - 0.25 | > 0.25 | score |
|
|
10
|
+
| INP (Interaction to Next Paint) | < 200ms | 200ms - 500ms | > 500ms | milliseconds |
|
|
11
|
+
| TTFB (Time to First Byte) | < 800ms | 800ms - 1800ms | > 1800ms | milliseconds |
|
|
12
|
+
|
|
13
|
+
These follow Google's published CWV thresholds. A warning indicates "needs improvement," critical indicates "poor."
|
|
14
|
+
|
|
15
|
+
## Uptime & Availability Thresholds
|
|
16
|
+
|
|
17
|
+
| Metric | Warning | Critical | Window |
|
|
18
|
+
|--------|---------|----------|--------|
|
|
19
|
+
| HTTP 5xx error rate | > 2% of requests | > 5% of requests | per hour |
|
|
20
|
+
| Response time (avg) | > 2s | > 5s | per 15 minutes |
|
|
21
|
+
| Response time (p95) | > 4s | > 10s | per 15 minutes |
|
|
22
|
+
| Downtime duration | > 1 minute | > 5 minutes | consecutive |
|
|
23
|
+
| SSL certificate expiry | < 30 days | < 7 days | daily check |
|
|
24
|
+
|
|
25
|
+
## Error Rate Thresholds
|
|
26
|
+
|
|
27
|
+
| Metric | Warning | Critical | Notes |
|
|
28
|
+
|--------|---------|----------|-------|
|
|
29
|
+
| PHP fatal errors | > 5/hour | > 20/hour | Check `debug.log` or error tracking |
|
|
30
|
+
| PHP warnings | > 50/hour | > 200/hour | May indicate plugin conflicts |
|
|
31
|
+
| JavaScript errors | > 10/hour | > 50/hour | Frontend console errors |
|
|
32
|
+
| 404 rate | > 5% of requests | > 15% of requests | May indicate broken links or attacks |
|
|
33
|
+
| Database query errors | > 1/hour | > 10/hour | Check slow query log |
|
|
34
|
+
|
|
35
|
+
## Resource Usage Thresholds
|
|
36
|
+
|
|
37
|
+
| Metric | Warning | Critical | Notes |
|
|
38
|
+
|--------|---------|----------|-------|
|
|
39
|
+
| Disk usage | > 80% | > 95% | Check uploads, logs, backups |
|
|
40
|
+
| PHP memory usage | > 80% of limit | > 95% of limit | Per-request memory |
|
|
41
|
+
| Database size growth | > 10%/week | > 25%/week | May indicate spam or logging |
|
|
42
|
+
| Backup age | > 24 hours | > 72 hours | Last successful backup |
|
|
43
|
+
|
|
44
|
+
## Plugin & Update Thresholds
|
|
45
|
+
|
|
46
|
+
| Metric | Severity | Notes |
|
|
47
|
+
|--------|----------|-------|
|
|
48
|
+
| Plugin updates available | Info (1-2), Warning (3-5), Critical (6+) | Security updates always critical |
|
|
49
|
+
| Theme updates available | Warning | Check compatibility first |
|
|
50
|
+
| WordPress core update | Warning (minor), Critical (security) | Security patches are urgent |
|
|
51
|
+
| Plugin vulnerability found | Critical | Immediate action required |
|
|
52
|
+
|
|
53
|
+
## Content Freshness Thresholds
|
|
54
|
+
|
|
55
|
+
| Metric | Warning | Critical | Notes |
|
|
56
|
+
|--------|---------|----------|-------|
|
|
57
|
+
| Last published post | > 14 days | > 30 days | Blog/news sites |
|
|
58
|
+
| Stale draft count | > 10 drafts | > 25 drafts | Content pipeline health |
|
|
59
|
+
| Broken internal links | > 5 | > 20 | SEO and UX impact |
|
|
60
|
+
| Missing alt text (new images) | > 10% | > 25% | Accessibility compliance |
|
|
61
|
+
|
|
62
|
+
## Custom Threshold Configuration
|
|
63
|
+
|
|
64
|
+
Thresholds are configurable per site via `WP_SITES_CONFIG`:
|
|
65
|
+
|
|
66
|
+
```json
|
|
67
|
+
{
|
|
68
|
+
"alert_thresholds": {
|
|
69
|
+
"lcp_warning": 2.5,
|
|
70
|
+
"lcp_critical": 4.0,
|
|
71
|
+
"error_rate_warning": 0.02,
|
|
72
|
+
"error_rate_critical": 0.05,
|
|
73
|
+
"disk_warning": 0.80,
|
|
74
|
+
"disk_critical": 0.95
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Override defaults by adding the `alert_thresholds` object to any site entry. Unspecified thresholds fall back to the defaults listed above.
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Escalation Paths
|
|
2
|
+
|
|
3
|
+
## Severity Levels
|
|
4
|
+
|
|
5
|
+
| Level | Icon | Description | Example Triggers |
|
|
6
|
+
|-------|------|-------------|-----------------|
|
|
7
|
+
| **Info** | :information_source: | Informational, no action needed | Plugin updates available, backup completed, content published |
|
|
8
|
+
| **Warning** | :warning: | Needs attention within hours | LCP > 2.5s, error rate > 2%, disk > 80%, SSL < 30 days |
|
|
9
|
+
| **Critical** | :rotating_light: | Immediate action required | Site down, LCP > 4s, error rate > 5%, disk > 95%, security vulnerability |
|
|
10
|
+
|
|
11
|
+
## Routing Rules
|
|
12
|
+
|
|
13
|
+
### Info Severity
|
|
14
|
+
|
|
15
|
+
- **Slack**: Post to general alerts channel (`#wp-alerts`)
|
|
16
|
+
- **Email**: None
|
|
17
|
+
- **Format**: Simple text message
|
|
18
|
+
- **Threading**: No thread — standalone message
|
|
19
|
+
- **Mention**: None
|
|
20
|
+
|
|
21
|
+
### Warning Severity
|
|
22
|
+
|
|
23
|
+
- **Slack**: Post to alerts channel + create thread with details
|
|
24
|
+
- **Email**: None (unless configured in escalation override)
|
|
25
|
+
- **Format**: Block Kit section with fields
|
|
26
|
+
- **Threading**: Main message + detail thread
|
|
27
|
+
- **Mention**: None (or `@here` if configured)
|
|
28
|
+
|
|
29
|
+
### Critical Severity
|
|
30
|
+
|
|
31
|
+
- **Slack**: Post to critical channel (`#wp-critical`) + thread with diagnostics
|
|
32
|
+
- **Email**: Send via SendGrid to configured alert recipients
|
|
33
|
+
- **Format**: Block Kit header + sections + action buttons
|
|
34
|
+
- **Threading**: Main message + detail thread + follow-up updates
|
|
35
|
+
- **Mention**: `<!channel>` in Slack, priority flag in email
|
|
36
|
+
|
|
37
|
+
## Cooldown Periods
|
|
38
|
+
|
|
39
|
+
Prevent alert fatigue by enforcing minimum intervals between repeat alerts:
|
|
40
|
+
|
|
41
|
+
| Severity | Cooldown | Notes |
|
|
42
|
+
|----------|----------|-------|
|
|
43
|
+
| Info | 60 minutes | Same alert type on same site |
|
|
44
|
+
| Warning | 30 minutes | Same metric on same site |
|
|
45
|
+
| Critical | 10 minutes | Same incident on same site |
|
|
46
|
+
|
|
47
|
+
### Cooldown Logic
|
|
48
|
+
|
|
49
|
+
1. Before sending an alert, check the last alert timestamp for the same `(site, metric, severity)` tuple.
|
|
50
|
+
2. If within cooldown window, skip the alert (log silently).
|
|
51
|
+
3. If the severity **escalates** (warning -> critical), send immediately regardless of cooldown.
|
|
52
|
+
4. Reset the cooldown timer on each sent alert.
|
|
53
|
+
|
|
54
|
+
## Deduplication Rules
|
|
55
|
+
|
|
56
|
+
| Rule | Description |
|
|
57
|
+
|------|-------------|
|
|
58
|
+
| Same metric + same site + same severity | Deduplicate within cooldown window |
|
|
59
|
+
| Severity escalation | Always send (warning->critical bypasses dedup) |
|
|
60
|
+
| Severity de-escalation | Send recovery notification (critical->warning->resolved) |
|
|
61
|
+
| Recovery after critical | Always send "resolved" message to close the incident |
|
|
62
|
+
|
|
63
|
+
### Dedup Key Format
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
{site_id}:{metric}:{severity}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Example: `mysite:lcp:warning`, `mysite:uptime:critical`
|
|
70
|
+
|
|
71
|
+
## Acknowledgment Tracking
|
|
72
|
+
|
|
73
|
+
For critical alerts, track acknowledgment status:
|
|
74
|
+
|
|
75
|
+
1. Critical alert sent with "Acknowledge" button (Slack Block Kit action).
|
|
76
|
+
2. If not acknowledged within **15 minutes**, re-send with escalation mention.
|
|
77
|
+
3. If not acknowledged within **30 minutes**, send email to backup contacts.
|
|
78
|
+
4. Mark incident as acknowledged when button clicked or manual response received.
|
|
79
|
+
|
|
80
|
+
## Recovery Notifications
|
|
81
|
+
|
|
82
|
+
When a metric returns to normal after an alert:
|
|
83
|
+
|
|
84
|
+
- **Info**: No recovery notification.
|
|
85
|
+
- **Warning**: Post recovery message to same channel (with reference to original alert).
|
|
86
|
+
- **Critical**: Post recovery message + reply in original thread + send recovery email.
|
|
87
|
+
|
|
88
|
+
Recovery message format:
|
|
89
|
+
```
|
|
90
|
+
:white_check_mark: RESOLVED: {metric} on {site} returned to normal.
|
|
91
|
+
Duration: {alert_duration}. Current value: {current_value}.
|
|
92
|
+
```
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# Report Scheduling
|
|
2
|
+
|
|
3
|
+
## Report Types
|
|
4
|
+
|
|
5
|
+
| Report | Frequency | Content | Delivery |
|
|
6
|
+
|--------|-----------|---------|----------|
|
|
7
|
+
| Daily Digest | Daily (09:00 UTC) | Key metrics, new alerts, resolved alerts | Slack |
|
|
8
|
+
| Weekly Performance Summary | Weekly (Monday 09:00 UTC) | CWV trends, traffic delta, uptime %, top errors | Slack |
|
|
9
|
+
| Monthly Analytics Report | Monthly (1st, 09:00 UTC) | Full analytics overview, MoM comparisons, recommendations | Slack + Email |
|
|
10
|
+
| On-Demand Report | Manual trigger | Any combination of metrics | Slack or Email |
|
|
11
|
+
|
|
12
|
+
## Daily Digest
|
|
13
|
+
|
|
14
|
+
### Content
|
|
15
|
+
|
|
16
|
+
- Site uptime percentage (last 24h)
|
|
17
|
+
- Average response time
|
|
18
|
+
- New alerts triggered (count by severity)
|
|
19
|
+
- Resolved alerts (count)
|
|
20
|
+
- CWV snapshot (LCP, CLS, INP averages)
|
|
21
|
+
- Plugin updates pending
|
|
22
|
+
|
|
23
|
+
### Slack Block Kit Template
|
|
24
|
+
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"blocks": [
|
|
28
|
+
{
|
|
29
|
+
"type": "header",
|
|
30
|
+
"text": { "type": "plain_text", "text": ":newspaper: Daily Digest — example.com" }
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"type": "section",
|
|
34
|
+
"fields": [
|
|
35
|
+
{ "type": "mrkdwn", "text": "*Uptime:*\n99.98%" },
|
|
36
|
+
{ "type": "mrkdwn", "text": "*Avg Response:*\n420ms" },
|
|
37
|
+
{ "type": "mrkdwn", "text": "*Alerts (new):*\n2 warning, 0 critical" },
|
|
38
|
+
{ "type": "mrkdwn", "text": "*Alerts (resolved):*\n1" }
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"type": "section",
|
|
43
|
+
"fields": [
|
|
44
|
+
{ "type": "mrkdwn", "text": "*LCP:*\n1.8s :white_check_mark:" },
|
|
45
|
+
{ "type": "mrkdwn", "text": "*CLS:*\n0.05 :white_check_mark:" },
|
|
46
|
+
{ "type": "mrkdwn", "text": "*INP:*\n150ms :white_check_mark:" },
|
|
47
|
+
{ "type": "mrkdwn", "text": "*Updates:*\n3 plugins pending" }
|
|
48
|
+
]
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"type": "context",
|
|
52
|
+
"elements": [
|
|
53
|
+
{ "type": "mrkdwn", "text": "Report period: last 24 hours | Generated by wp-monitoring-agent" }
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Weekly Performance Summary
|
|
61
|
+
|
|
62
|
+
### Content
|
|
63
|
+
|
|
64
|
+
- CWV trends (7-day averages vs previous week)
|
|
65
|
+
- Traffic summary (sessions, pageviews, bounce rate delta)
|
|
66
|
+
- Uptime percentage and incident count
|
|
67
|
+
- Top 5 errors by frequency
|
|
68
|
+
- Top 5 slowest pages
|
|
69
|
+
- Plugin/theme update status
|
|
70
|
+
|
|
71
|
+
### Slack Block Kit Template
|
|
72
|
+
|
|
73
|
+
```json
|
|
74
|
+
{
|
|
75
|
+
"blocks": [
|
|
76
|
+
{
|
|
77
|
+
"type": "header",
|
|
78
|
+
"text": { "type": "plain_text", "text": ":bar_chart: Weekly Summary — example.com" }
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"type": "section",
|
|
82
|
+
"text": { "type": "mrkdwn", "text": "*Core Web Vitals (7-day avg):*\nLCP: 1.9s (+0.1s) | CLS: 0.04 (-0.01) | INP: 160ms (+10ms)" }
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"type": "section",
|
|
86
|
+
"text": { "type": "mrkdwn", "text": "*Traffic:*\nSessions: 12,450 (+8%) | Pageviews: 34,200 (+5%) | Bounce: 42% (-2%)" }
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"type": "section",
|
|
90
|
+
"text": { "type": "mrkdwn", "text": "*Uptime:*\n99.95% | Incidents: 1 (resolved in 3 min)" }
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"type": "context",
|
|
94
|
+
"elements": [
|
|
95
|
+
{ "type": "mrkdwn", "text": "Report period: last 7 days | Generated by wp-monitoring-agent" }
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Monthly Analytics Report
|
|
103
|
+
|
|
104
|
+
### Content
|
|
105
|
+
|
|
106
|
+
- Complete CWV analysis with month-over-month comparison
|
|
107
|
+
- Traffic analytics (GA4 + Plausible combined)
|
|
108
|
+
- Top content by engagement and conversions
|
|
109
|
+
- SEO performance (Search Console data if available)
|
|
110
|
+
- Error and incident summary
|
|
111
|
+
- Resource usage trends (disk, database)
|
|
112
|
+
- Recommendations based on trends
|
|
113
|
+
|
|
114
|
+
### Delivery
|
|
115
|
+
|
|
116
|
+
- **Slack**: Summary Block Kit message with key highlights
|
|
117
|
+
- **Email (SendGrid)**: Full HTML report with charts and tables
|
|
118
|
+
|
|
119
|
+
## On-Demand Reports
|
|
120
|
+
|
|
121
|
+
Triggered manually via command. Supports parameters:
|
|
122
|
+
|
|
123
|
+
- `--period=7d|30d|90d` — report time range
|
|
124
|
+
- `--metrics=cwv,traffic,uptime,errors` — select metric groups
|
|
125
|
+
- `--format=slack|email|both` — delivery channel
|
|
126
|
+
- `--site=site_id` — target site (defaults to all)
|
|
127
|
+
|
|
128
|
+
## Scheduling Configuration
|
|
129
|
+
|
|
130
|
+
Reports are scheduled via `WP_SITES_CONFIG`:
|
|
131
|
+
|
|
132
|
+
```json
|
|
133
|
+
{
|
|
134
|
+
"report_schedule": {
|
|
135
|
+
"daily_digest": { "enabled": true, "time": "09:00", "timezone": "UTC", "channel": "#wp-reports" },
|
|
136
|
+
"weekly_summary": { "enabled": true, "day": "monday", "time": "09:00", "timezone": "UTC" },
|
|
137
|
+
"monthly_report": { "enabled": true, "day": 1, "time": "09:00", "email_recipients": ["team@example.com"] }
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Disable any report by setting `"enabled": false`. Adjust `time` and `timezone` as needed.
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Slack Integration for WordPress Alerting
|
|
2
|
+
|
|
3
|
+
## Incoming Webhook Setup
|
|
4
|
+
|
|
5
|
+
1. Go to [Slack API: Apps](https://api.slack.com/apps) and create a new app (or select existing).
|
|
6
|
+
2. Navigate to **Incoming Webhooks** and activate them.
|
|
7
|
+
3. Click **Add New Webhook to Workspace** and select the target channel.
|
|
8
|
+
4. Copy the webhook URL (format: `https://hooks.slack.com/services/T.../B.../xxx`).
|
|
9
|
+
5. Add to `WP_SITES_CONFIG`:
|
|
10
|
+
```json
|
|
11
|
+
{ "slack_webhook_url": "https://hooks.slack.com/services/T.../B.../xxx" }
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
### Webhook Payload Format
|
|
15
|
+
|
|
16
|
+
```json
|
|
17
|
+
{
|
|
18
|
+
"text": "Fallback text for notifications",
|
|
19
|
+
"blocks": [ ... ]
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Webhooks support a subset of Block Kit — use `text` for simple alerts, `blocks` for rich formatting.
|
|
24
|
+
|
|
25
|
+
## Bot Token Setup (Advanced)
|
|
26
|
+
|
|
27
|
+
1. In your Slack App, go to **OAuth & Permissions**.
|
|
28
|
+
2. Add the following **Bot Token Scopes**:
|
|
29
|
+
- `chat:write` — send messages to channels
|
|
30
|
+
- `channels:read` — list public channels for routing
|
|
31
|
+
- `channels:join` — (optional) auto-join channels
|
|
32
|
+
3. Install the app to workspace and copy the **Bot User OAuth Token** (`xoxb-...`).
|
|
33
|
+
4. Add to `WP_SITES_CONFIG`:
|
|
34
|
+
```json
|
|
35
|
+
{
|
|
36
|
+
"slack_bot_token": "xoxb-...",
|
|
37
|
+
"slack_channel": "#wp-alerts"
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Bot Token vs Webhook
|
|
42
|
+
|
|
43
|
+
| Feature | Webhook | Bot Token |
|
|
44
|
+
|---------|---------|-----------|
|
|
45
|
+
| Setup complexity | Low | Medium |
|
|
46
|
+
| Block Kit support | Partial | Full |
|
|
47
|
+
| Threaded replies | No | Yes |
|
|
48
|
+
| Channel switching | No (fixed) | Yes (dynamic) |
|
|
49
|
+
| Reactions/emoji | No | Yes |
|
|
50
|
+
| Rate limit | 1 req/sec | Tier 2+ |
|
|
51
|
+
|
|
52
|
+
## Block Kit Formatting for Alerts
|
|
53
|
+
|
|
54
|
+
### Critical Alert Template
|
|
55
|
+
|
|
56
|
+
```json
|
|
57
|
+
{
|
|
58
|
+
"blocks": [
|
|
59
|
+
{
|
|
60
|
+
"type": "header",
|
|
61
|
+
"text": { "type": "plain_text", "text": ":rotating_light: CRITICAL: Site Down", "emoji": true }
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"type": "section",
|
|
65
|
+
"fields": [
|
|
66
|
+
{ "type": "mrkdwn", "text": "*Site:*\nexample.com" },
|
|
67
|
+
{ "type": "mrkdwn", "text": "*Status:*\n503 Service Unavailable" },
|
|
68
|
+
{ "type": "mrkdwn", "text": "*Detected:*\n2026-03-01 14:30 UTC" },
|
|
69
|
+
{ "type": "mrkdwn", "text": "*Duration:*\n5 minutes" }
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"type": "actions",
|
|
74
|
+
"elements": [
|
|
75
|
+
{ "type": "button", "text": { "type": "plain_text", "text": "Acknowledge" }, "action_id": "ack_alert", "style": "danger" }
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Warning Alert Template
|
|
83
|
+
|
|
84
|
+
```json
|
|
85
|
+
{
|
|
86
|
+
"blocks": [
|
|
87
|
+
{
|
|
88
|
+
"type": "section",
|
|
89
|
+
"text": { "type": "mrkdwn", "text": ":warning: *LCP exceeded threshold*\nSite: example.com | LCP: 3.2s (threshold: 2.5s)" }
|
|
90
|
+
}
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Info Alert Template
|
|
96
|
+
|
|
97
|
+
```json
|
|
98
|
+
{
|
|
99
|
+
"text": ":information_source: Plugin updates available: 3 plugins on example.com"
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Best Practices
|
|
104
|
+
|
|
105
|
+
- **Channel naming**: Use dedicated channels (`#wp-alerts`, `#wp-critical`) to separate alert noise.
|
|
106
|
+
- **Mention patterns**: Use `<!channel>` for critical, `<@user_id>` for assigned responders.
|
|
107
|
+
- **Rate limiting**: Slack enforces 1 msg/sec for webhooks. Batch low-priority alerts.
|
|
108
|
+
- **Testing**: Always send a test message after setup to verify formatting.
|
|
109
|
+
- **Fallback text**: Always include `text` field — it appears in notifications and search.
|