# SB_CHAT_LISTEN

Starts/stops listening to the group chat. Messages will come to you with [`SB_CHAT_MESSAGE`](/doc/sb_chat_message-lAFyaTFRj5) event.


:::info
Requires group chat monitoring to be enabled on your group

:::

## Command usage

```csharp
llMessageLinked(LINK_SET, SB_CHAT_LISTEN, string str, key id);
```

## API parameters

`llMessageLinked` function accepts `str` and `id` parameters. Their meaning for `SB_CHAT_LISTEN` is explained below:

| Variable | Required | Description |
|----------|----------|-------------|
| str      | yes      | 1to start listening<br>0 to stop |
| id       | yes      | \--         |

## Comments

This command instructs AdminBot to start listening on the group chat.  
The group chat messages will be passed to your script using the [`SB_CHAT_MESSAGE`](/doc/sb_chat_message-lAFyaTFRj5) event.

### Successful connection

After connecting to the group chat, the script will receive the [`SB_CHAT_SUCCESS`](/doc/sb_chat_success-vY11JNPIFL) event.

### Possible Errors

There are several conditions which may prevent AdminBot from connecting to the group chat.

In case of an error, your script will receive [`SB_COMMAND_FAILED`](/doc/sb_command_failed-c1bjVeADs7) with the following data:

```
event SB_COMMAND_FAILED, status code = SERVICE_UNAVAILABLE

Reason: Your SmartBots subscription does not include Group Chat Control

Solution: Enable the Group Chat Control service for the group.
```

```
event SB_COMMAND_FAILED, status code = CHAT_LISTEN_FAILED

Reason: SL can't provide the HTTP listener for the script

Solution: This can happen for extremely crowded and overloaded sims. The only solution is to move to another sim.
```

## Example

See [this example](/doc/group-chat-listener-xzV6Q7TtT5) for a simple chat relay.