<!-- Copyright (c) 2026 defconxt. All rights reserved. -->
<!-- Licensed under AGPL-3.0 — see LICENSE file for details. -->

# API Reference — Building Security Newsletter Automation

## Agent Script

### Commands

| Command | Description |
|---|---|
| `node agent.js generate --template monthly --feeds threats.json` | Generate newsletter from threat feeds |
| `node agent.js curate --sources rss,blogs,advisories --period week` | Curate content from security sources |
| `node agent.js schedule --frequency monthly --audience all-staff` | Schedule newsletter distribution |
| `node agent.js analytics --newsletter-id NL-2026-03 --metrics opens,clicks` | Analyze newsletter engagement |

### Examples

```bash
# Primary workflow
node agent.js generate --template monthly --feeds threats.json

# Secondary analysis
node agent.js curate --sources rss,blogs,advisories --period week

# Generate deliverable
node agent.js schedule --frequency monthly --audience all-staff

# Measure and report
node agent.js analytics --newsletter-id NL-2026-03 --metrics opens,clicks
```

## External Tools

| Tool | Command | Purpose |
|---|---|---|
| SendGrid | `sendgrid --send --template newsletter.html` | Email delivery |
| Jinja2 | `python3 -c 'from jinja2 import Template'` | Template rendering |
| feedparser | `python3 -c 'import feedparser'` | RSS feed parsing |

## Newsletter Content Sources

| Source | Type | Update Frequency |
|---|---|---|
| CISA Advisories | Threat alerts | As published |
| SANS NewsBites | Curated news | Bi-weekly |
| Internal metrics | Program data | Monthly |
| Policy updates | Compliance | As needed |
| Vendor advisories | Patch alerts | As published |
