> ## Documentation Index
> Fetch the complete documentation index at: https://cofounder.appeeky.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Slack

> Receive briefings in Slack and approve agent actions inline.

Slack is the recommended primary integration. The agent posts your daily briefing as a Slack thread and (optionally) sends approval buttons for proposed actions.

## Three setup options

| Option               | Use when                         | Setup time |
| -------------------- | -------------------------------- | ---------- |
| **OAuth** ⭐          | You're a SaaS user — one click   | 30 sec     |
| **Incoming Webhook** | One-way notifications, scripting | 2 min      |
| **Bot Token**        | Custom bot, approval buttons     | 5 min      |

> **OAuth is the recommended path** for end users. The bot token + Workspace info are captured automatically. See [OAuth (recommended)](./oauth) for the generic flow.

***

## Option A — OAuth (one click)

```
GET /v1/cofounder/oauth/slack/start?return_to=<your-page>
   →  { authorizeUrl, state }

User opens authorizeUrl → Slack consent → redirect back to your page with
?cofounder_oauth=success&provider=slack&account=<workspace-name>
```

Behind the scenes the agent stores the bot token, team id, and bot user id. Default scopes: `chat:write,chat:write.public,channels:read,groups:read`.

After OAuth completes, set the channel you want briefings in:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X PUT https://api.appeeky.com/v1/cofounder/integrations/slack \
  -H "X-API-Key: $APPEEKY_KEY" \
  -d '{ "integrationConfig": { "defaultChannel": "#app-cofounder" } }'
```

Then enable in preferences:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
PUT /v1/cofounder/preferences { "enabledIntegrations": ["slack"] }
```

Done.

***

***

## Option B — Incoming Webhook (simplest)

1. Go to [https://api.slack.com/apps](https://api.slack.com/apps) → *Create New App* → *From scratch*.
2. Pick a name and your workspace.
3. *Incoming Webhooks* → toggle ON → *Add New Webhook to Workspace* → pick the channel.
4. Copy the webhook URL.

Save it:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X PUT https://api.appeeky.com/v1/cofounder/integrations/slack \
  -H "X-API-Key: $APPEEKY_KEY" \
  -d '{
    "credentials": { "webhookUrl": "https://hooks.slack.com/services/..." }
  }'
```

Enable in preferences:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
PUT /v1/cofounder/preferences { "enabledIntegrations": ["slack"] }
```

You're done. The next run posts to the channel.

***

## Option C — Bot Token (manual)

1. Same Slack app setup as above.
2. *OAuth & Permissions* → *Bot Token Scopes*:
   * `chat:write`
   * `chat:write.public` (optional — to post in channels the bot isn't a member of)
3. Install to workspace, copy the **Bot User OAuth Token** (starts with `xoxb-`).
4. Find your channel ID (right-click channel → View channel details → bottom of the modal).

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X PUT https://api.appeeky.com/v1/cofounder/integrations/slack \
  -H "X-API-Key: $APPEEKY_KEY" \
  -d '{
    "credentials": {
      "botToken": "xoxb-...",
      "channelId": "C0123ABCD"
    },
    "integrationConfig": { "defaultChannel": "#app-cofounder" }
  }'
```

With a Bot Token, you also get:

* **Threading** — every day's run replies under one thread per app per day, keeping the channel clean.
* **Approval buttons** — proposed actions in `agentMode: "write"` show inline Approve / Reject buttons that hit `/v1/cofounder/actions/:id/review` directly.

***

## Conversational replies

Once the OAuth bot is installed and invited to your briefing channel, you can talk to the agent like a teammate.

**Two ways to start a conversation:**

1. **Reply in a briefing thread** — the agent recognizes the thread and continues the conversation about that app.
2. **`@App Co-founder` anywhere** — works in any channel the bot is in; defaults to your most recently active app.

**What the agent can do in chat**

In every conversation the agent has read tools available:

* `list_apps` — show connected apps
* `list_tracked_keywords` — current keyword watchlist for an app
* `get_keyword_rank` — rank + recent movement for a single keyword
* `get_competitor_snapshot` — current competitor list
* `list_recent_actions` — proposed / approved / executed actions

When `agentMode: "write"` (set in preferences), it also gets:

* `track_keyword` / `untrack_keyword` — manage the keyword watchlist
* `add_competitor` — add a competitor by App Store id
* `trigger_run` — kick off a fresh briefing right now
* `approve_action` / `reject_action` — review proposed actions
* `update_preferences` — change tone, mode, language, integrations

**Examples**

```
@App Co-founder track the keyword "ai resume builder" for AppName
→ Tracked. I'll include it in the next briefing.

@App Co-founder run a fresh briefing
→ Triggered. Run id: run_abc... — I'll post the report when it lands.

@App Co-founder what's pending review?
→ 2 proposed actions: <list>. Reply "approve <id>" to action.
```

Required Slack scopes (granted automatically by OAuth):
`channels:history`, `groups:history`, `im:history`, `app_mentions:read`, `reactions:write`.

If you started before these scopes were added, run the OAuth flow again to refresh the bot token.

***

## Memory shortcuts

In addition to natural-language Q\&A, the agent recognizes a handful of `!` prefix shortcuts inside the briefing thread or any `@mention`. They're a fast path for memory operations from your phone without opening the dashboard:

| Command                    | What it does                                                                                                                                  |
| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| `!memory <query>`          | Semantic search across your facts and past episodes for this app. Returns the top matches inline.                                             |
| `!remember <key>: <value>` | Save a high-confidence preference fact. The key is auto-snake\_cased, the source is set to `user`, and the agent picks it up on the next run. |
| `!pending`                 | List facts waiting for your approval (typically from imports).                                                                                |
| `!reflect`                 | Distill recent measured outcomes into stable facts right now (same as the **Reflect now** button in the vault).                               |
| `!help`                    | Show this list inside Slack.                                                                                                                  |

Examples:

```
@App Co-founder !memory tr localization
→ 📌 Facts:
  💜 brand_voice: minimal, premium, no exclamation marks
  • tr_localization_works: TR localization on similar apps consistently lifted non-US downloads ~22% in 14d.
  🕰 Past actions:
  • Localized metadata to TR → +28% downloads from TR in 14d

@App Co-founder !remember pricing locked: don't touch the $9.99 tier
→ ✅ Saved as `pricing_locked` for app 6479581124.

@App Co-founder !reflect
→ 🧠 Reflection done. Episodes read: 12 · new facts: 3 · refined: 1
```

`!` shortcuts are convenience-only — anything else is treated as a normal question and goes through the full reasoner with semantic memory in context.

***

## What gets posted

Every run when Slack is enabled, a single message is posted with:

* Header — `App Co-founder — <date>`
* Headline section
* Top 5 highlights (one bullet each, with impact emoji)
* Top 3 prioritized actions (with priority labels)

If the run produces approval-pending actions, those follow as separate threaded messages with buttons.

## Disable

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
PUT /v1/cofounder/preferences { "enabledIntegrations": [] }
```

(or remove `"slack"` from the array). The credentials remain stored — re-enable any time without re-setup.

## Delete credentials

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
DELETE /v1/cofounder/integrations/slack
```
