# A WhatsApp message arrives

> Starts when someone writes to your WhatsApp number or taps a button you sent, with what they wrote, who they are, and any picture or file they attached.

Source: https://docs.go-lumen.ai/de/reference/triggers/whatsapp-message-received

## Auf einen Blick

| Eigenschaft | Wert |
| --- | --- |
| **Trigger name** | `whatsapp-message-received` |
| **Resource** | ClusterTrigger (`lumen.ai/v1alpha1`) |
| **Source** | event |
| **Needs a connection** | yes, one that provides `whatsapp` |
| **Produces** | `text`, `fields`, `file` |
| **Emits** | item |
| **Installation must provide** | nothing |

A flow using this trigger names a Connector in `connectorRef`. Connection types that provide `whatsapp`: \[WhatsApp (Meta Cloud API)\](/reference/connections/whatsapp-cloud), \[WhatsApp (app's shared number)\](/reference/connections/whatsapp-shared).

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

## Ausgaben

Ein späterer Knoten verweist auf eine Ausgabe als `{nodeId.field}` in einem Text oder als `nodeId.field` in einer Bedingung.

| Ausgabe | Typ |
| --- | --- |
| `from` | string |
| `name` | string |
| `message` | string |
| `kind` | string |
| `buttonId` | string |
| `mediaType` | string |
| `mediaCount` | number |
| `mediaError` | string |
| `conversationId` | string |
| `sessionId` | string |
| `messageId` | string |
| `connection` | string |
| `receivedAt` | string |

## Einstellungen

Wird unter `config:` im Auslöser des Flows gesetzt.

| Einstellung | Typ | Standardwert | Beschreibung |
| --- | --- | --- | --- |
| `only` | string | `"all"` | Only limits which messages start the flow: every message, only text, or only a tapped button. (one of all, text, buttons) |
| `from` | list of string |  | From limits the senders, by phone number with country code; empty is anyone. (maxItems 50) |
| `showTyping` | boolean | `true` | Marks their message read (blue ticks) and shows typing until the flow's first WhatsApp answer, for up to about a minute and a half. |

Das vollständige JSON Schema dieser Einstellungen: [whatsapp-message-received.schema.json](https://docs.go-lumen.ai/schemas/triggers/whatsapp-message-received.schema.json).

## Im Flow verwenden

```yaml title="flow.yaml"
apiVersion: lumen.ai/v1alpha1
kind: Connector
metadata:
  name: my-whatsapp-cloud
  namespace: tenant-acme
spec:
  classRef: {name: whatsapp-cloud}
  config: {}
---
apiVersion: lumen.ai/v1alpha1
kind: Flow
metadata:
  name: whatsapp-message-received-example
  namespace: tenant-acme
spec:
  displayName: "A WhatsApp message arrives"
  triggers:
    - id: start
      ref: {name: whatsapp-message-received}
      connectorRef: {name: my-whatsapp-cloud}
      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
```
