# News digest

Top headlines from an RSS feed, refreshed by a cloud job. Each row opens the story.

**Sizes:** small (3 headlines), medium (4), large (6 with sources)
**Freshness:** a job every 60 minutes

## Widget (a snapshot)

```json
{
  "slug": "news",
  "title": "News",
  "symbol": "newspaper.fill",
  "accent": "#FF453A",
  "blocks": [
    { "type": "list", "title": "Top stories", "items": [
      { "title": "Fed holds rates steady", "detail": "Reuters", "url": "https://www.reuters.com/" },
      { "title": "iOS 27.1 adds new widgets", "detail": "The Verge", "url": "https://www.theverge.com/" },
      { "title": "Record Q3 for Aramco", "detail": "Bloomberg", "url": "https://www.bloomberg.com/" },
      { "title": "Starship's fifth flight", "detail": "CNN", "url": "https://www.cnn.com/" },
      { "title": "Markets open higher", "detail": "FT", "url": "https://www.ft.com/" },
      { "title": "Rain expected tonight", "detail": "Weather", "url": "https://weather.com/" }
    ] }
  ],
  "lock": { "inline": "6 new stories" }
}
```

Item titles: about 41 characters show on medium. `detail` shows only on large.

## The job (BBC RSS)

```json
{
  "action": "schedule",
  "name": "news-bbc",
  "widget_slug": "news",
  "every_minutes": 60,
  "fetch": { "url": "https://feeds.bbci.co.uk/news/rss.xml" },
  "widget": {
    "title": "BBC News",
    "symbol": "newspaper.fill",
    "accent": "#FF453A",
    "blocks": [
      { "type": "list", "title": "Top stories", "items": "{{items}}" }
    ],
    "lock": { "inline": "BBC News" }
  }
}
```

- An RSS or Atom feed gives you `title` (the feed's name) and `items` (up to 20, each with `title` and `url` from the item's link) with no `values`. A list keeps the first 8; the phone shows up to 6.
- `"items": "{{items}}"` (the whole string, nothing else) puts the list itself there.
- List rows open only https links. A feed with `http://` links makes the run fail: pick another feed.
- Headlines over about 41 characters get cut on medium (the first run's `check` warns). A job can't shorten them; if that matters, have your agent write the widget instead.

## The job (a JSON API)

```json
{
  "action": "schedule",
  "name": "news-api",
  "widget_slug": "news",
  "every_minutes": 60,
  "fetch": { "url": "https://newsapi.org/v2/top-headlines?country=us&apiKey=YOUR_KEY" },
  "values": {
    "stories": { "path": "articles", "title": "title", "detail": "source.name", "url": "url" }
  },
  "widget": {
    "title": "Headlines",
    "symbol": "newspaper.fill",
    "blocks": [{ "type": "list", "items": "{{stories}}" }]
  }
}
```

`{"path", "title", "detail", "url"}` turns an array in the response into list rows (up to 8). A job can't send headers, so the key has to go in the URL; only use services where that's allowed, and keep in mind the URL is stored with the job.
