---
title: "Action create_message"
description: "Creates a text or file message in an Operator Panel chat room."
---

# Action `create_message`

> **System ID:** `action_create_message`

## Description

Adds a message to an operator chat room from the client or from a user (operator). Supports text and files; if the request contains an image (`text_image`), the type automatically becomes `file`.

For client messages, constants must include `client.op_client_id`. For operator messages, `user_id` is required.

## Events (scenario branches)

| Event | When it occurs |
|-------|----------------|
| **success** | Message created |
| **error** | Validation error, participant missing, or save failed |

## Parameters

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `id` | string | Yes | — | Chat room ID. Supports placeholders |
| `message` | string | Yes | — | Message text or file link. Supports placeholders |
| `message_type` | string | No | `"text"` | `text` or `file` |
| `user_id` | string / number | No | `null` | If set — message from the operator (`user`); otherwise — from the client |

## Configuration example

```json
{
  "id": "{{chat_room_id}}",
  "message": "Hello, I need help with my order",
  "message_type": "text",
  "user_id": null
}
```

## Related docs

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