# Tavily, Notion, and Slack

All three are optional. A setup with only X credentials and an LLM still fetches, builds a persona, and generates drafts.

## Tavily

Key: `TAVILY_API_KEY` from [tavily.com](https://tavily.com).

| Command | What it calls |
|---|---|
| `tf search` | Tavily Search. `--news` switches the topic to news. |
| `tf enrich` | Tavily Extract for ordinary URLs. X-hosted articles use the X API instead. |
| `tf generate --timely` | One news search, last 7 days, 5 results, folded into the prompt. |
| `tf cron` | Calls enrich. Without the key, cron errors after the fetch. Use `tf refresh` instead. |

Search defaults: general topic, 5 results, basic depth, an answer summary included. News searches default to 7 days.

> **Human required.** Creating the Tavily account and pasting the key.
>
> **Verify.** `tf search "tweet-factory" --max 1` prints a result list.

## Notion

Key: `NOTION_API_KEY`, an internal integration secret from [notion.so/my-integrations](https://www.notion.so/my-integrations).

> **Human required.** Create the integration, copy the secret, and share each page or database with the integration. Unshared pages are invisible. `tf notion search` only returns what that share allows.

Commands are `search`, `tag`, `untag`, `list`, and `sync`. See [Commands](commands.md#tf-notion). The onboarding TUI can search and tag too (`n` on the forge screen).

Tagged pages are stored in `tweets.db` with your label and an optional note. `tf generate` includes them as reference material (roughly 1,500 characters per page, 6,000 overall) and is told to use the tag as a hint — voice, product facts, or idea seeds — rather than quoting the page. `tf cron` syncs pages whose last-edited time changed.

> **Verify.** `tf notion search` lists at least the pages you shared. `tf notion tag <id> --tag voice` then `tf notion list` shows that tag.

## Slack

Key: `SLACK_WEBHOOK_URL`, an [incoming webhook](https://api.slack.com/messaging/webhooks).

| Path | Behavior |
|---|---|
| `tf notify <file> [header]` | Posts the file, split around 3,500 characters, as webhook text. |
| `tf generate --post-to-slack` | Writes the drafts file, then notifies. |
| `tf cron` | If the pending count is above zero, posts a one-line ping telling you to run `tf generate`. It does not attach drafts. |

No webhook: `tf notify` logs a skip and returns. Cron stays quiet.

> **Human required.** Create the webhook in Slack and paste the URL.
>
> **Verify.** `printf 'hello from tf\n' > /tmp/tf-slack.txt && tf notify /tmp/tf-slack.txt "tf setup check"` posts that one line. Delete the Slack message if the channel is shared.
