# Slack App

Query Twig agents from Slack channels and DMs.

## Overview

**Features**:

* Mention @TwigBot in channels to query
* DM TwigBot for private queries
* Slash command `/twig ask [question]`
* Thread-based conversations (context maintained)
* Citation links to source docs

**Plan requirement**: Pro or Enterprise\
**Slack requirement**: Workspace admin to install app

## Installation

### Install from Slack App Directory

1. Go to [slack.com/apps](https://slack.com/apps) → search "Twig AI"
2. Click **Add to Slack**
3. Select workspace
4. Review permissions:
   * `chat:write` (send messages)
   * `channels:history` (read channel messages)
   * `commands` (slash commands)
5. Click **Allow**
6. Configure in opened browser tab:
   * **Twig API Key**: From Settings → API Keys
   * **Default Agent**: Select from dropdown
7. Click **Complete Setup**

**Expected result**: @TwigBot appears in Apps list

**Installation time**: \~3 minutes

## Usage

### Mention in Channel

```
@TwigBot what is the API rate limit?
```

**Expected response** (\~2-5s):

```
The API rate limit is 100 req/min for Pro accounts.

Sources:
• API Documentation > Rate Limits
```

### Direct Message

1. Click TwigBot in Apps
2. Send message: "How do I reset my password?"
3. Receive response with citations

### Slash Command

```
/twig ask what are the pricing tiers?
```

**Response**: Same as mention, visible only to you (ephemeral)

## Configuration

**Location**: Slack Workspace Settings → Apps → Twig AI → Configure

**Settings**:

* **Default Agent**: Which agent to use (dropdown)
* **Allowed Channels**: All or specific channels (multi-select)
* **Response Style**: Concise, Standard, Detailed
* **Show Citations**: Toggle
* **Notifications**: DM when mentioned

## Troubleshooting

### Bot Not Responding

**Symptom**: @TwigBot mentioned but no response

**Diagnostic**:

1. Check bot in channel members (if not, add: `/invite @TwigBot`)
2. Verify app installed (Slack Settings → Apps → check "Twig AI" listed)
3. Check API key valid (reconfigure if expired)

**Fix**: Add bot to channel or reinstall app

***

### "Agent not found" Error

**Cause**: Agent ID invalid or deleted in Twig

**Fix**: Slack Settings → Apps → Twig AI → Configure → select different agent

***

### Slow Responses (>30s)

**Cause**: Agent using Cypress strategy or complex query

**Fix**: Switch agent to Cedar or Redwood for faster responses

## Constraints

* **Rate limit**: 50 messages/min per workspace (Slack imposed)
* **Response length**: Max 3,000 chars (Slack message limit, truncates if longer)
* **File uploads**: Not supported in Slack app (use web UI)
* **Thread depth**: Max 10 turns per thread (context window limit)

## When This Doesn't Apply

**Enterprise Grid**: Multi-workspace Slack requires Enterprise plan configuration. Contact <support@twig.so>.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.twig.so/product/plugins/slack-app.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
