# מגיעה הודעה בצ'אט

> מתחיל כשמישהו כותב בצ'אט. התשובה של האוטומציה היא מה שיקראו בחזרה.

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

## במבט אחד

| מאפיין | ערך |
| --- | --- |
| **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`.

## פלט

צומת מאוחר יותר מפנה לפלט כ-`{nodeId.field}` בטקסט, או כ-`nodeId.field` בתנאי.

| פלט | סוג |
| --- | --- |
| `sessionId` | string |
| `message` | string |

## הגדרות

Set under `config:` on the flow trigger.

| הגדרה | סוג | ברירת מחדל | תיאור |
| --- | --- | --- | --- |
| `greeting` | string |  | Greeting is what a chat window shows before the first message. (maxLength 500) |

ה-JSON Schema המלא של ההגדרות: [chat-message.schema.json](https://docs.go-lumen.ai/schemas/triggers/chat-message.schema.json).

## שימוש בתהליך

```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
```
