---
title: "Action return_to_chatroom"
description: "Returns the user to a previously active (not closed) operator chat room."
---

# Action `return_to_chatroom`

> **System ID:** `action_return_to_chatroom`

## Description

Returns the user to the chat room from the `chat_room_id_to_return` constant: checks that the room exists, belongs to the bot, and is not closed, restores Operator Panel state, and connects to the chat. Closed rooms cannot be reopened.

## Events (scenario branches)

| Event | When it occurs |
|-------|----------------|
| *(success without a named branch)* | State restored, user is back in the chat |
| **error** | No `chat_room_id_to_return`, room not found, closed, or has no participants |

## Parameters

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `alias_return_scenario` | string | no | `null` | Scenario alias for returning from the chat (placeholders); stored in a constant |

**Required state constant:** `chat_room_id_to_return` — room ID to return to (set before calling the action).

## Configuration example

```json
{
  "alias_return_scenario": "main_menu"
}
```

Typical chain: `my_chatrooms_list` → user selection → write `chat_room_id_to_return` → `return_to_chatroom`.

## Related docs

- [Actions reference](/en/actionjail/reference/actions-reference.md)
