# Send a WhatsApp template

> Sends a template Meta approved, with its values and buttons. It can start a conversation at any time.

Source: https://docs.go-lumen.ai/de/reference/steps/whatsapp-send-template

## Auf einen Blick

| Eigenschaft | Wert |
| --- | --- |
| **Schrittname** | `whatsapp-send-template` |
| **Ressource** | ClusterStep (`lumen.ai/v1alpha1`) |
| **Palettengruppe, Kategorie** | notify, messages |
| **Credits** | **1** Credit bei jedem Erfolg |
| **Externe Wirkung** | ja: Er ändert etwas außerhalb von Lumen, deshalb fragt ein Wiederholungsversuch vorher nach, und ein Test zeigt, was er tun würde, statt es zu tun. |
| **Die Installation muss bereitstellen** | nichts |

## Eingaben

| Eigenschaft | Wert |
| --- | --- |
| **Braucht** | nichts |
| **Liefert** | `fields` |
| **Arbeitet auf** | item: einem Dokument nach dem anderen |

Braucht und Liefert sind Datentypen (file, text, fields, email). Der Editor bietet einen Schritt nur dort an, wo das, was er braucht, schon auf dem Pfad liegt. Siehe [Dokumente und Daten](https://docs.go-lumen.ai/de/concepts/how-flows-run.md#documents-and-data).

## Ausgaben

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

| Ausgabe | Typ |
| --- | --- |
| `whatsappMessageId` | string |
| `whatsappStatus` | string |

## Einstellungen

Wird unter `config:` im Knoten des Flows gesetzt. Texteinstellungen dürfen Platzhalter wie `{nodeId.field}` enthalten.

| Einstellung | Typ | Standardwert | Beschreibung |
| --- | --- | --- | --- |
| `connectorRef` | string |  | Send from (minLength 1) |
| `to` | string |  | To (maxLength 200) |
| `toMember` | string |  | Their email. They must have joined this number with their phone (Profile, WhatsApp). (maxLength 320) |
| `template` (erforderlich) | string |  | Template is the approved template's name, as Meta has it. (minLength 1; maxLength 512) |
| `language` (erforderlich) | string |  | Language is the template's language code, he or en\_US. (minLength 2; maxLength 15) |
| `params` | list of string |  | Params fill the template's {`{1}`}, {`{2}`}, ... in order; each may hold placeholders. (maxItems 20) |
| `buttonPayloads` | list of string |  | ButtonPayloads are what the template's quick reply buttons send back when tapped, by position; each may hold placeholders. (maxItems 10) |

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

## Beispiel

```yaml title="config"
buttonPayloads:
- approve:{number}
- reject:{number}
connectorRef: whatsapp-main
language: he
params:
- '{number}'
- '{amount}'
template: receipt_ready
to: '{phone}'
```

## Im Flow verwenden

Ein Knoten, der `whatsapp-send-template` ausführt, steht unter `spec.nodes` eines [Flow](https://docs.go-lumen.ai/de/concepts/how-flows-run.md#the-flow-as-yaml). Geben Sie ihm eine beliebige id und nennen Sie in next die ids der nächsten Knoten.

```yaml title="flow.yaml (spec.nodes)"
- id: whatsapp-send-template
  stepRef: {name: whatsapp-send-template}
  config:
    buttonPayloads:
    - approve:{number}
    - reject:{number}
    connectorRef: whatsapp-main
    language: he
    params:
    - '{number}'
    - '{amount}'
    template: receipt_ready
    to: '{phone}'
```
