---
name: emit
description: Programmable RSS feeds via emit (rssemit.com). Use when the user wants to send an RSS feed as an email newsletter, build a filtered feed from a plain-language interest (a `watcher` in the API), get a feed for a page that has none, or push a feed's items to Slack/Discord/Teams/Telegram/Google Chat/webhooks — all via the emit API.
---

# Set up emit on this project

Emit (rssemit.com) is a programmable RSS feeds platform: anything in (feeds, pages,
prompts), anything out (newsletter, Slack/Discord/Teams/Telegram/Google Chat, webhooks, plain RSS). Drive it
through its REST API (`https://api.rssemit.com`, OpenAPI at `/openapi.json`) or the
emit MCP server if registered.

## Steps

1. **Find the feed.** Look in the repo for an RSS/Atom URL (e.g. `/rss.xml`,
   `/feed.xml`, `CLAUDE.md`, the site config). Confirm it with the user.

2. **Create an account** (skip if they already have a key):
   `POST /v1/accounts {"name","email"}` → store the returned `api_key` as
   `EMIT_API_KEY` (shown once). All later calls use `Authorization: Bearer $EMIT_KEY`.

3. **Verify the sending domain:** `POST /v1/domains {"domain"}` → add the returned
   DNS records (ownership TXT, SPF, DMARC, and SES DKIM CNAMEs) at the user's DNS
   provider, then `POST /v1/domains/{id}/verify`.

4. **Connect the feed:** `POST /v1/feeds {"url","from_email","schedule"}`
   (`on_publish` | `daily` | `weekly`).

5. **Subscribers:** add the embed snippet from `GET /v1/snippets` to the site, and/or
   import an existing list with `POST /v1/subscribers/import`.

6. **Top up:** `POST /v1/billing/topup {"amount_usd"}` → open the Stripe Checkout URL.

7. **Done.** New posts now email subscribers automatically. Confirm the balance and
   subscriber count with `GET /v1/account` and `GET /v1/account/analytics`.

## Smart feeds (watchers), page→feed, and broadcasts

- **Anything → feed:** `POST /v1/watchers {"prompt"}` discovers sources and returns
  durable `atom_url`/`json_url` endpoints (the API calls these feeds `watchers`).
  Filter feeds the user already has with
  `{"prompt", "sources": [urls], "discover": false}`; omit `prompt` for a pure
  merge. Pages without feeds are accepted as sources and watched by link diffing.
- **Need a source URL?** `https://rssemit.com/feed-catalog.html` lists eight
  upstream-owned developer feeds (releases, security advisories, engineering news)
  with copyable URLs and provenance; use one as a `sources` entry or a sink's
  `feed_url`. The catalog does not provision feeds; first checks stay a silent baseline.
  Each card’s **Use this feed** link opens `/app.html?source=<encoded-url>` as an editable
  draft preserved through sign-in. Check is optional and free; confirmation creates the feed.
  Humans can open `https://rssemit.com/app.html?recipe=runtime-releases` to prefill the
  dashboard composer with the CPython and Node.js feeds; agents should just POST those two
  URLs as `sources`.
- **Broadcast by email:** `POST /v1/watchers/{id}/pipe {"from_email","schedule"}`.
- **Replace a leaked feed URL:** `POST /v1/watchers/{id}/rotate-feed-token`
  returns fresh `atom_url`/`json_url` and keeps sources, items and Reader
  history. The old URLs 404 immediately and nothing downstream is rewritten —
  readers and `/pipe` newsletters must be moved to the new URL, so confirm
  with the user before rotating.
- **Audit the filter:** `GET /v1/watchers/{id}/items?include_suppressed=true`
  shows every item with its relevance score and reason.
- **Chat / webhook sink:**
  `POST /v1/sinks {"kind": "slack"|"discord"|"teams"|"telegram"|"google_chat"|"webhook", "url", "feed_url"}`
  pushes any feed's new items to chat (Telegram uses the Bot API URL and Google Chat the space webhook URL, both described below;
  for `teams`, a Workflows
  "When a Teams webhook request is received" URL; posted as an Adaptive Card). `kind: "webhook"` POSTs
  `application/json` to any endpoint instead, with an `X-Emit-Event` header of
  `sink.item` or `sink.digest` and a body of
  `{"event","sink_id","name","item"|"items"}`; it takes no template. Preview it
  with `POST /v1/sinks/{id}/test` — no body posts the feed's newest item through
  the sink's template; pass `{"title","url","summary"}` to preview unpublished
  copy. The response returns exactly what was posted.
- Filtering meters credits (1 per 5 judged items; summaries 1 per item); polling
  and feeds out are free.

## Notes

- New accounts get 625 free starter credits (~$1) once the owner verifies their email;
  beyond that they must top up before anything metered runs.
- Sink deliveries (Slack/Discord/Teams/Telegram/JSON webhook): 250 free per account per
  calendar month (UTC), then 1 credit each; a digest counts once, test sends are free.
  Out of allowance and credits, deliveries pause and items are held until a top-up.
- Subscribers are double-opt-in: they're `pending` until they click the confirm link. A wrongly bounced subscriber can be re-invited with `reinstate_subscriber` (fresh confirmation, 1 credit); complained and unsubscribed ones cannot.
- Never print or commit the API key; store it in the environment.

Telegram: `kind: "telegram"` uses `https://api.telegram.org/bot<token>/sendMessage?chat_id=<id>` (numeric group/chat ID or `@channel`). Add the bot with posting permission. Treat the URL as secret. Posts are plain text, link previews disabled, capped at the shared 1,900-character limit; baseline, templates, digests and retries match other chat sinks.
Google Chat: `kind: "google_chat"` uses the space's incoming-webhook URL, `https://chat.googleapis.com/v1/spaces/<space>/messages?key=<key>&token=<token>` (create it in Chat under Apps & integrations → Webhooks; the key and token query parameters are required, and the URL is rejected otherwise). Treat the URL as secret: key and token are redacted from stored errors and logs. Posts are plain text (`{"text": ...}`) capped at the shared 1,900-character limit; baseline, templates, digests and retries match other chat sinks.

- **Recover signed account events (separate from unsigned JSON sinks):** inspect
  `GET /v1/webhook-endpoints/{endpoint_id}/deliveries`, then call
  `POST /v1/webhook-endpoints/{endpoint_id}/deliveries/{delivery_id}/retry`
  (MCP `retry_event_delivery`) after restoring the receiver. Only failed rows can
  be re-queued; pending/delivered return 409. The worker resends the original body
  and signature with a fresh six-attempt budget.

Before creating a monitored feed, use authenticated `POST /v1/watchers/sample`
with `{"url":"https://example.com/feed.xml"}` (MCP: `sample_source`). It returns
resolved feed/page kind, URL, title and up to ten parsed items without persistence,
baseline or credits. Direct fetching only; ten calls/account/minute; unsafe or
unreachable URLs return 422. This differs from previewing stored feed candidates.
