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

# Reply Detection

> Configure when your bot should respond to messages

Reply detection controls when your bot responds to incoming messages. This is especially important in group chats and channels where the bot should only reply when explicitly addressed.

## Overview

Reply detection determines whether a bot should generate a response for a given message. Without proper detection, bots might:

* Respond to every message in a busy group chat
* Interrupt conversations not meant for them
* Miss messages they should respond to

![Behavior settings](https://mintcdn.com/chatbotplatform/IwOyuSig9ydzaHpG/images/screenshots/05-behavior/01_behavior_settings.png?fit=max\&auto=format\&n=IwOyuSig9ydzaHpG\&q=85\&s=013b426daf117b70d56694e42398225c)

Reply detection settings

## Detection Strategies

### Direct Messages

In private 1:1 chats, detection is simple:

```
User: "Hello"
Bot: Should Respond = YES (it's a DM)
```

The bot responds to every message in direct conversations.

### Group Chats

In groups, detection uses multiple signals:

**Explicit Mentions**:

```
User: "@SupportBot what's my order status?"
Bot: Should Respond = YES (bot was mentioned)
```

**Replies to Bot Messages**:

```
Bot: "Your order #123 shipped yesterday"
User: "When will it arrive?"
Bot: Should Respond = YES (user replied to bot's message)
```

**General Messages**:

```
User: "Has anyone seen the report?"
Bot: Should Respond = NO (not addressed to bot)
```

## Configuration

### bot\_should\_reply Setting

The `bot_should_reply` setting determines detection behavior:

| Value | Behavior | Use Case |
| - | - | - |
| `always` | Respond to every message | Private DMs, dedicated support channels |
| `mentioned` | Respond only when @mentioned | Busy group chats |
| `replied` | Respond when mentioned or replied to | Balanced group behavior |
| `detect_addressed` | Use AI to detect if message is for bot | Advanced detection |

**1. Navigate to Bot Behaviors**

Go to your bot settings and click **Behaviors**.

**2. Find Reply Detection**

Look for the **Should Respond** or **Reply Detection** setting.

**3. Choose Strategy**

Select the appropriate detection strategy for your use case.

**4. Save**

Click **Save** to apply changes.

## detect\_addressed: AI-Powered Detection

For advanced use cases, enable `detect_addressed` to use AI to determine if a message is directed at the bot:

```
User: "Can someone help me with my account?"
AI Detection: "This appears to be a request for assistance" → YES

User: "The weather is nice today"
AI Detection: "Casual conversation, not a request" → NO
```

### When to Use detect\_addressed

**Good fits**:

* Natural language support channels
* Conversational bots that should "understand" when they're needed
* Reducing false positives in group chats

**Less useful**:

* Simple command-based bots
* Channels where explicit @mentions are preferred
* High-volume groups (adds latency)

AI detection adds a small delay to message processing as the system analyzes the message content.

## Platform-Specific Behavior

### Telegram

**Private Chats**:

* Bot responds to all messages
* No detection needed

**Groups**:

* Responds to @mentions
* Responds to replies to bot messages
* Optionally responds to commands (/start, /help)
* Privacy mode setting affects visibility

**Channels**:

* Bot can only respond if admin
* All messages visible

### Slack

**Direct Messages**:

* Bot responds to all messages
* Simple 1:1 context

**Channels**:

* Responds to @mentions
* Responds in threads when mentioned
* Can be configured to respond to all channel messages

**Threads**:

* Each thread is separate context
* Bot responds within threads when addressed
* Thread replies maintain conversation context

### Discord

**Direct Messages**:

* Bot responds to all DMs
* No detection needed

**Servers**:

* Responds to @mentions
* Responds to replies to bot messages
* Optionally responds to slash commands
* Role-based permissions can control visibility

## Testing Reply Detection

**1. Test Direct Messages**

Send a DM to your bot. It should always respond.

**2. Test Group Mentions**

In a group, @mention your bot. It should respond.

**3. Test Group Without Mention**

Send a message in a group without mentioning the bot. It should NOT respond (unless configured otherwise).

**4. Test Replies**

Reply to a bot message in a group. Bot should respond even without @mention.

## Common Patterns

### Support Bot in Shared Channel

```
Configuration:
  bot_should_reply: "replied"

Behavior:
  - User @mentions bot → Responds
  - User replies to bot → Responds
  - General conversation → Does not respond
```

### Always-On Assistant

```
Configuration:
  bot_should_reply: "always"

Behavior:
  - Responds to every message
  - Suitable for dedicated bot channels
  - Not recommended for shared channels
```

### Smart Detection

```
Configuration:
  bot_should_reply: "detect_addressed"

Behavior:
  - Uses AI to determine if message is for bot
  - "Can you help me?" → Responds
  - "The meeting is at 3pm" → Does not respond
```

## Advanced Configuration

### Per-Channel Detection

Configure different detection strategies per channel:

```
Telegram Group: bot_should_reply = "mentioned"
Slack DMs: bot_should_reply = "always"
Discord Server: bot_should_reply = "replied"
```

This allows appropriate behavior for each platform.

### Custom Detection Logic

For advanced use cases, implement custom detection in your integration webhook:

```json theme={null}
{
  "messages": [...],
  "should_respond": true,
  "detection_reason": "user_mentioned_bot",
  "metadata": {
    "is_group": true,
    "has_mention": true,
    "is_reply": false
  }
}
```

Your integration can use this metadata to make custom decisions.

## Troubleshooting

### Bot Not Responding in Groups

**Check**:

* Reply detection is not set to "never"
* Bot is properly mentioned with @
* Platform privacy settings allow bot to see messages
* Bot has permissions to respond in the channel

### Bot Responding Too Often

**Possible causes**:

* Detection set to "always" in a shared channel
* AI detection being too aggressive
* Multiple bots responding to same messages

**Solution**:

* Change to "mentioned" or "replied" detection
* Adjust AI detection sensitivity
* Review bot configuration

### Bot Missing Messages

**Check**:

* User is properly mentioning bot
* Reply detection is not set too restrictively
* Bot has permissions to read messages
* Platform webhooks are properly configured

## Best Practices

> [card] Match Context
>
> Use "always" for DMs, "replied" for groups

> [card] Test Thoroughly
>
> Test all detection scenarios before deploying

> [card] Be Predictable
>
> Users should understand when bot will respond

> [card] Monitor Behavior
>
> Review logs to ensure detection works as expected

Start with "replied" detection in groups - it provides a good balance between responsiveness and not being intrusive.

## API Configuration

Configure reply detection programmatically.

> [accordion] Update bot reply detection
>
> > [tab] cURL
> >
> > ```bash theme={null}
> > curl -X PATCH https://api.chatbotplatform.io/v1/bots/bot_123 \
> >   -H "Authorization: Bearer YOUR_API_KEY" \
> >   -H "Content-Type: application/json" \
> >   -d '{
> >     "bot_should_reply": "replied",
> >     "detect_addressed": false
> >   }'
> > ```
>
> > [tab] JavaScript
> >
> > ```javascript theme={null}
> > const response = await fetch('https://api.chatbotplatform.io/v1/bots/bot_123', {
> >   method: 'PATCH',
> >   headers: {
> >     'Authorization': 'Bearer YOUR_API_KEY',
> >     'Content-Type': 'application/json'
> >   },
> >   body: JSON.stringify({
> >     bot_should_reply: 'replied',
> >     detect_addressed: false
> >   })
> > });
> > ```
>
> > [tab] PHP
> >
> > ```php theme={null}
> > $response = Http::withToken('YOUR_API_KEY')
> >     ->patch('https://api.chatbotplatform.io/v1/bots/bot_123', [
> >         'bot_should_reply' => 'replied',
> >         'detect_addressed' => false
> >     ]);
> > ```
>
> > [tab] Python
> >
> > ```python theme={null}
> > response = requests.patch(
> >     'https://api.chatbotplatform.io/v1/bots/bot_123',
> >     headers={'Authorization': 'Bearer YOUR_API_KEY'},
> >     json={
> >         'bot_should_reply': 'replied',
> >         'detect_addressed': False
> >     }
> > )
> > ```

> [card] [Complete API Reference](https://app.chatbotplatform.io/openapi)
>
> View the full API specification with all endpoints, parameters, and response schemas.

## Next Steps

> [card] [Typing Indicators](https://docs.chatbotplatform.io/bots/behaviors/typing-indicators.md)
>
> Configure visual feedback

> [card] [Response Timing](https://docs.chatbotplatform.io/bots/behaviors/response-timing)
>
> Control response delays


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.