# National Weather Service Alerts Feed (`your_friendly_developer/nws-weather-alerts-feed`) Actor

- **URL**: https://apify.com/your_friendly_developer/nws-weather-alerts-feed.md
- **Developed by:** [Jason Ramirez](https://apify.com/your_friendly_developer) (community)
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $20.00 / 1,000 alert rows

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## National Weather Service Alerts Feed

An Apify SDK v3 Actor that retrieves a snapshot of active US weather alerts from `https://api.weather.gov/alerts/active`. Intended users include construction and roofing schedulers, logistics and event operators, and insurance teams watching severe weather in their territories.

Provide exactly one location selector: `states`, `point`, or `zones`. A nationwide query is rejected. Provide a real contact email in `userAgentContact`; it is sent as `NWS Alerts Feed {contact}`. Addresses at example.com are rejected.

### Input examples

Replace the contact below with your own address before running:

```json
{
  "states": ["CA", "OR"],
  "userAgentContact": "operations@your-company.org",
  "minSeverity": "Moderate",
  "eventKeyword": "wind",
  "limit": 100
}
```

Alternative location selectors, each used in place of states:

```json
{ "point": { "lat": 34.05, "lon": -118.25 }, "userAgentContact": "operations@your-company.org" }
```

```json
{ "zones": ["CAZ041"], "userAgentContact": "operations@your-company.org" }
```

`limit` defaults to 100 and accepts integers from 1 to 2000. `minSeverity` accepts Extreme, Severe, Moderate, or Minor. Ranking is Extreme > Severe > Moderate > Minor > Unknown. Without a severity filter, Unknown alerts remain eligible. `eventKeyword` is a case-insensitive substring of the event name. `includeTest: true` explicitly adds test status to the default actual status. Message types are alert and update. Requests use pages of up to 500 and follow `pagination.next`.

### Dataset output

Each matching alert produces one normalized item. Repeated alert IDs are suppressed within a run.

| Field | Value |
| --- | --- |
| alertId | properties.id, falling back to feature.id |
| event | Alert event name or null |
| severity | API severity or Unknown |
| certainty | API certainty or null |
| urgency | API urgency or null |
| headline | Headline or null |
| description | Description or null |
| instruction | Instructions or null |
| effective | Effective timestamp or null |
| onset | Onset timestamp or null |
| expires | Expiration timestamp or null |
| senderName | Sender name or null |
| areas | areaDesc string, default empty string |
| ugcCodes | geocode.UGC array, default empty array |
| retrievedAt | Run snapshot timestamp in ISO format |
| source | National Weather Service |

`LAST_RUN_SUMMARY` in the default key-value store contains `runAt`, `filtersUsed`, `totalReportedByApi`, `emitted`, `complete`, and `notes`. The reported total is read from `totalFeatures` or `numberMatched` if supplied; otherwise it is null. It is never inferred from a page's array length.

An empty complete run says no alerts matched at query time. A fetch failure after a successful page retains gathered rows, records a note and `complete: false`. A first-page failure records an incomplete summary and fails the run. A limit that prevents further scanning also marks the run incomplete. Dataset write failures fail the run.

### Honest limits

Alerts are the Weather Service's own and change minute to minute. This is a snapshot at query time. Pagination is not an atomic snapshot, and changes between pages can affect results. Calm weather can yield an empty dataset. This code has offline fixture coverage; live API compatibility and the deployed Apify runtime have not been verified here. The API response shape is an assumption supplied in BRIEF.md. No pricing or demand claim is made.

The intended publication model is pay per event per emitted row. Store publication, pricing, billing event configuration, and any runtime billing integration remain owner work; this source does not charge events.

### Local run

Use Node.js 22 or the supplied Dockerfile. From this directory:

```sh
npm install
mkdir -p storage/key_value_stores/default
```

Save a real input as `storage/key_value_stores/default/INPUT.json`, then run:

```sh
npm start
```

Run the fixture suite with `npm test`. Tests use injected fetch and storage sinks, never the network, and do not require installing the SDK. Production startup imports `apify`. Dependency installation and Docker execution were not performed in this build lane.

# Actor input Schema

## `states` (type: `array`):

US state codes to fetch active alerts for, for example CA or TX. Leave empty to use point or zones instead.

## `point` (type: `object`):

Latitude,longitude point to fetch alerts for instead of states, for example 38.5,-121.4.

## `zones` (type: `array`):

NWS forecast or county zone IDs to fetch alerts for.

## `minSeverity` (type: `string`):

Only return alerts at or above this severity: minor, moderate, severe, or extreme.

## `eventKeyword` (type: `string`):

Only return alerts whose event name contains this text.

## `includeTest` (type: `boolean`):

Include test and exercise alerts. Off by default.

## `userAgentContact` (type: `string`):

Contact email sent in the User-Agent, which the National Weather Service requests from API users.

## `limit` (type: `integer`):

Maximum number of alerts to return.

## Actor input object example

```json
{
  "includeTest": false,
  "limit": 100
}
```

# Actor output Schema

## `dataset` (type: `string`):

Dataset containing all normalized alerts

## `keyValueStore` (type: `string`):

Default key-value store holding the LAST_RUN_SUMMARY record

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("your_friendly_developer/nws-weather-alerts-feed").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("your_friendly_developer/nws-weather-alerts-feed").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call your_friendly_developer/nws-weather-alerts-feed --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,your_friendly_developer/nws-weather-alerts-feed"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/tKAPRfUNOQsNET6ep/builds/bwytX7jn7txP3GGIv/openapi.json
