# A chat message arrives

> Starts when someone writes in the chat. The flow's reply is what they read back.

Source: https://docs.go-lumen.ai/es/reference/triggers/chat-message

## De un vistazo

| Propiedad | Valor |
| --- | --- |
| **Trigger name** | `chat-message` |
| **Resource** | ClusterTrigger (`lumen.ai/v1alpha1`) |
| **Source** | event |
| **Needs a connection** | no |
| **Produces** | `text`, `fields` |
| **Emits** | item |
| **Installation must provide** | nothing |

The trigger goes under `spec.triggers` of a Flow. Its outputs are referenced as `<triggerId>.<field>`. A trigger can also carry a `when` condition ("Start only when") and `disabled: true`.

## Salidas

Un nodo posterior se refiere a una salida como `{nodeId.field}` en un texto, o `nodeId.field` en una condición.

| Salida | Tipo |
| --- | --- |
| `sessionId` | string |
| `message` | string |

## Ajustes

Se definen bajo `config:` en el disparador del flujo.

| Ajuste | Tipo | Valor por defecto | Descripción |
| --- | --- | --- | --- |
| `greeting` | string |  | Greeting is what a chat window shows before the first message. (maxLength 500) |

El JSON Schema completo de estos ajustes: [chat-message.schema.json](https://docs.go-lumen.ai/schemas/triggers/chat-message.schema.json).

## Úsalo en un flujo

```yaml title="flow.yaml"
apiVersion: lumen.ai/v1alpha1
kind: Flow
metadata:
  name: chat-message-example
  namespace: tenant-acme
spec:
  displayName: "A chat message arrives"
  triggers:
    - id: start
      ref: {name: chat-message}
      next: [notify-in-app]
  nodes:
    - id: notify-in-app
      stepRef: {name: notify-in-app}
      config:
        body: 'Total: {total}'
        title: New invoice from {supplier}
        to: admins
```
