# Niche Directory Builder: SAM.gov Contracts + Google News (`mosaicked_sponge/niche-directory-builder`) Actor

Build a deduplicated directory for any niche or keyword from SAM.gov federal contract opportunities and Google News. Each entry has a name, description, source link, date and category, ready for a website, spreadsheet or market research.

- **URL**: https://apify.com/mosaicked_sponge/niche-directory-builder.md
- **Developed by:** [Jason](https://apify.com/mosaicked_sponge) (community)
- **Categories:** Lead generation, News, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.10 / 1,000 directory entries

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## Niche Directory Builder: SAM.gov federal contracts + Google News in one directory

Type a niche (for example **cybersecurity**, **drones**, **solar energy** or **janitorial**) and get a clean, **deduplicated directory** that combines **U.S. federal contract notices from SAM.gov** with **recent Google News coverage**. Every entry has a **name, description, link, date and category**, plus useful extras such as the **agency, NAICS code, set-aside, response deadline, award amount, awardee, location and publisher**.

You get the directory three ways: a sortable **table** grouped by category, a **CSV** for spreadsheets, and a ready-to-share **HTML directory page** with a table of contents.

- ✅ **Two sources, one list.** SAM.gov's official public daily extract (no API key, no login) plus Google News search, run in parallel.
- ✅ **Real deduplication.** Identical links, identical titles and near-identical titles (syndicated stories, AP/Reuters copies, a news story about the same notice) become one entry. The merged copies stay visible in `alsoFoundIn`.
- ✅ **One entry per solicitation.** A presolicitation, the solicitation, its amendments and the award share one entry (the newest), with the rest listed in `relatedNotices`.
- ✅ **Useful categories.** Group by entry type (*Open Contract Opportunities, Contract Awards, Market Research (RFI & Sources Sought), Funding & Deals, Incidents & Risks, Policy & Regulation...*), by topic (*Cybersecurity, IT & Software, Construction & Facilities, Healthcare & Medical...*), or by your own categories.
- ✅ **Real publisher links** instead of Google News redirect links, with the article's summary, author and image.
- ✅ **Privacy-safe.** Contracting-officer names, e-mails and phone numbers are never output, and e-mails and phone numbers are scrubbed from descriptions.
- ✅ **Fast.** A typical run takes under a minute.

### Who it's for

- **Niche site and newsletter builders** who want a fresh "contracts + news" directory for their industry.
- **Government contractors and BD teams** who want opportunities and the market news around them in one place.
- **Analysts, journalists and researchers** tracking where federal money and media attention meet in a niche.
- **Lead-gen and market-research agencies** who need structured, categorized lists for a client's niche.

### How to use

1. Enter one or more **Niche keywords** (one per line).
2. Optional: narrow SAM.gov by **NAICS codes, set-asides, notice types, states or agencies**, and set the **News time window**.
3. Choose **Group entries by** (entry type or topic), or add **Custom categories**.
4. Click **Start**. Open the **Directory (by category)** view, download CSV/Excel/JSON, or open the **HTML directory page** from the Output tab.
5. Schedule it weekly or daily to keep your directory fresh, and send the results to Google Sheets, Slack, Zapier or Make.

### Input example

```json
{
  "keywords": ["drone", "counter-uas"],
  "maxEntries": 200,
  "samNaicsCodes": ["3364", "5417"],
  "newsTimeWindow": "30d",
  "customCategories": {"Counter-drone": ["counter-uas", "c-uas", "anti-drone"]}
}
```

### Output example

```json
{
  "category": "Market Research (RFI & Sources Sought)",
  "name": "DISA Cybersecurity Service Provider (CSSP) / J34 External Vulnerability Scans (EVS) and Web Vulnerability Scans (WVS)",
  "description": "Please see attached Sources Sought and PWS for DISA Cybersecurity Service Provider (CSSP) / J34 External Vulnerability Scans (EVS) and Web Vulnerability Scans (WVS).",
  "date": "2026-10-14T13:37:20",
  "source": "sam.gov",
  "sourceUrl": "https://sam.gov/opp/d6e90c863acc46a1a6105f080fe13efc/view",
  "entryType": "Market Research (RFI & Sources Sought)",
  "topic": "Cybersecurity",
  "agency": "DEPT OF DEFENSE > DEFENSE INFORMATION SYSTEMS AGENCY (DISA) > IT CONTRACTING DIVISION - PL83",
  "naicsCode": "541511",
  "naicsSector": "Professional, Scientific, and Technical Services",
  "noticeType": "Sources Sought",
  "solicitationNumber": "832775912",
  "responseDeadline": "2026-10-30T16:00:00-04:00",
  "location": "SCOTT AFB, IL, USA",
  "matchedKeywords": [
    "cybersecurity"
  ],
  "relatedNotices": [],
  "alsoFoundIn": [],
  "duplicatesMerged": 0,
  "entryId": "42eba2e44dacb70d"
}
```

News entries carry `publisher`, `publisherDomain`, `author`, `imageUrl` and `googleNewsUrl` instead of the SAM.gov fields.

| Field | What it is |
|---|---|
| `category` | Group used by the directory (entry type, topic, or your custom category) |
| `name`, `description`, `date`, `sourceUrl` | The directory basics |
| `source` | `sam.gov` or `news` |
| `entryType`, `topic` | Both classifications, whichever you group by |
| `agency`, `naicsCode`, `naicsSector`, `pscCode`, `noticeType`, `setAside`, `solicitationNumber`, `responseDeadline`, `awardAmount`, `awardee`, `location` | SAM.gov extras |
| `publisher`, `publisherDomain`, `author`, `imageUrl` | News extras |
| `matchedKeywords` | Which of your keywords found it |
| `alsoFoundIn`, `duplicatesMerged` | Copies merged into this entry |
| `relatedNotices` | Other notices of the same solicitation |

The run also saves **DIRECTORY_HTML** (browsable page), **DIRECTORY_CSV** and **OUTPUT** (counts per source and category, duplicates merged, warnings) in the key-value store.

### Pricing

Pay per event, no subscription:

- **$0.0075 per run** that builds a directory (runs with no results don't pay it).
- **$2.60 per 1,000 directory entries** ($2.40 on Scale, $2.10 on Business plans). On Apify's **Free plan** entries cost **$1.50 per 1,000**, so the free monthly credit builds about 3,000 entries.

A 100-entry directory costs about **$0.27**. Duplicates merged away are never charged. Set **Max cost per run** to cap any run: the Actor stops at your limit (and skips the run fee if the limit is too small for it).

### Tips

- **Single niche?** Keep *Group entries by: Entry type*. **Broad keyword?** Use *Topic*.
- **Too few SAM.gov entries?** Switch *Match keywords in* to *Title and description*, raise *Posted within (days)*, or untick *Skip expired opportunities*.
- **Too many?** Add NAICS codes or set-asides, or lower *Max SAM.gov entries*.
- SAM.gov keywords support `AND`, `OR`, `NOT`, `"exact phrases"` and `prefix*`, e.g. `drone* NOT training`.
- Odd characters and broken queries are handled: unusable keywords are skipped with a warning instead of failing the run.

### FAQ

**Is this data official?** SAM.gov entries come from SAM.gov's own public *Contract Opportunities* daily extract, refreshed nightly. News entries come from Google News search results and link to the original publishers.

**Is it legal?** It reads public data only: a file SAM.gov publishes for data sharing, and public news feeds. Contact details of contracting officers are dropped. Respect each publisher's terms when you republish their content; the directory stores headlines, short summaries and links.

**Does it remember earlier runs?** No. Each run builds a fresh directory from today's data, so you can rerun it any time with new keywords.

**Something not right?** Open an issue on the Issues tab. We usually reply within a day.

# Actor input Schema

## `keywords` (type: `array`):

One niche, keyword or phrase per line, e.g. cybersecurity, drone, solar energy, janitorial. Each keyword is searched in SAM.gov notice titles (or titles + descriptions) and on Google News. SAM.gov understands AND, OR, NOT, "exact phrases" and prefix\*.

## `sources` (type: `array`):

Where to pull records from. Both by default.

## `maxEntries` (type: `integer`):

Upper limit on entries saved (and charged) per run, after duplicates are merged. The newest entries are kept.

## `categoryMode` (type: `string`):

Entry type (Open Contract Opportunities, Contract Awards, Funding & Deals, Incidents & Risks...) works best for a single niche. Topic (Cybersecurity, IT & Software, Construction & Facilities...) works best for broad keywords. Both are always included as the entryType and topic fields.

## `customCategories` (type: `object`):

Your own categories: category name -> keywords. They win whenever an entry's title or description matches, e.g. {"Counter-drone": \["counter-uas", "anti-drone"], "Delivery": \["delivery"]}. A trailing \* matches a word prefix.

## `sortBy` (type: `string`):

Category (A-Z), newest first inside each category; or newest first overall.

## `directoryTitle` (type: `string`):

Heading of the HTML directory page. Defaults to the keywords.

## `maxSamEntries` (type: `integer`):

Newest matching SAM.gov solicitations to include (0 = none).

## `samKeywordScope` (type: `string`):

Title only gives the most relevant entries; title and description finds many more.

## `samPostedWithinDays` (type: `integer`):

Only notices posted in the last N days (0 = any date in the extract).

## `samActiveOnly` (type: `boolean`):

Leave out notices whose response deadline has passed.

## `groupSolicitationNotices` (type: `boolean`):

Merge the presolicitation, solicitation, amendments and award of the same solicitation number into one entry (the newest notice; the others are listed in relatedNotices).

## `samNaicsCodes` (type: `array`):

Optional. Codes or prefixes, e.g. 541512 or 5415.

## `samSetAsideCodes` (type: `array`):

Optional, e.g. SBA, 8A, HZC, SDVOSBC, WOSB, NONE.

## `samNoticeTypes` (type: `array`):

Optional, e.g. Solicitation, Combined Synopsis/Solicitation, Presolicitation, Sources Sought, Award Notice.

## `samStates` (type: `array`):

Optional 2-letter place-of-performance states (office state when none is given), e.g. TX, VA.

## `samAgencies` (type: `array`):

Optional. Any part of the agency path, e.g. veterans affairs, navy.

## `newsTimeWindow` (type: `string`):

How far back to look on Google News.

## `maxNewsPerKeyword` (type: `integer`):

Newest articles per keyword (Google returns up to about 100).

## `newsLanguage` (type: `string`):

Language code, e.g. en, de, es-419.

## `newsCountry` (type: `string`):

2-letter country edition, e.g. US, GB, DE.

## `resolvePublisherUrls` (type: `boolean`):

Turn Google News links into the publisher's own article URL.

## `fetchArticleDetails` (type: `boolean`):

Read each article's summary, author and image from the publisher page.

## `excludeNewsSources` (type: `array`):

Optional publisher names or domains to skip, e.g. example.com.

## `fuzzyDedupe` (type: `boolean`):

Besides identical links and titles, merge near-identical titles (syndicated stories, a news story about the same SAM.gov notice). Merged copies are listed in alsoFoundIn.

## `fuzzyThreshold` (type: `number`):

0.6 to 1.0. Higher merges only very close titles.

## Actor input object example

```json
{
  "keywords": [
    "cybersecurity"
  ],
  "sources": [
    "sam.gov",
    "news"
  ],
  "maxEntries": 100,
  "categoryMode": "type",
  "sortBy": "category",
  "maxSamEntries": 25,
  "samKeywordScope": "title",
  "samPostedWithinDays": 90,
  "samActiveOnly": true,
  "groupSolicitationNotices": true,
  "newsTimeWindow": "30d",
  "maxNewsPerKeyword": 25,
  "newsLanguage": "en",
  "newsCountry": "US",
  "resolvePublisherUrls": true,
  "fetchArticleDetails": true,
  "fuzzyDedupe": true,
  "fuzzyThreshold": 0.88
}
```

# Actor output Schema

## `directory` (type: `string`):

One row per deduplicated directory entry, grouped by category.

## `htmlDirectory` (type: `string`):

Browsable page grouped by category, ready to share or embed.

## `csv` (type: `string`):

Spreadsheet-ready export of the directory.

## `summary` (type: `string`):

OUTPUT record: counts per source and category, duplicates merged, warnings.

# 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 = {
    "keywords": [
        "cybersecurity"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("mosaicked_sponge/niche-directory-builder").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 = { "keywords": ["cybersecurity"] }

# Run the Actor and wait for it to finish
run = client.actor("mosaicked_sponge/niche-directory-builder").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 '{
  "keywords": [
    "cybersecurity"
  ]
}' |
apify call mosaicked_sponge/niche-directory-builder --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,mosaicked_sponge/niche-directory-builder"
        }
    }
}
```

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/hlDGqnyvB94ievHmC/builds/V1kULiUthw4WBcSHj/openapi.json
