# לשאול עם כפתורים בוואטסאפ

> שולח שאלה עם עד שלושה כפתורים. הלחיצה של האדם מתחילה שוב את התהליך עם התשובה. עובד עד 24 שעות מההודעה האחרונה שלו.

Source: https://docs.go-lumen.ai/he/reference/steps/whatsapp-send-buttons

## במבט אחד

| מאפיין | ערך |
| --- | --- |
| **שם השלב** | `whatsapp-send-buttons` |
| **משאב** | ClusterStep (`lumen.ai/v1alpha1`) |
| **קבוצה וקטגוריה** | notify, messages |
| **קרדיטים** | **1** קרדיט בכל פעם שהוא מצליח |
| **השפעה חיצונית** | כן: הוא משנה משהו מחוץ ל-Lumen, ולכן ניסיון חוזר שואל קודם, ובדיקה מראה מה הוא היה עושה במקום לעשות את זה. |
| **ההתקנה צריכה לספק** | כלום |

## קלט

| מאפיין | ערך |
| --- | --- |
| **צריך** | כלום |
| **מפיק** | `fields` |
| **עובד על** | item: מסמך אחד בכל פעם |

״צריך״ ו״מפיק״ הם סוגי נתונים (file, text, fields, email). העורך מציע שלב רק במקום שבו מה שהוא צריך כבר נמצא במסלול. ראו [מסמכים ונתונים](https://docs.go-lumen.ai/he/concepts/how-flows-run.md#documents-and-data).

## פלט

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

| פלט | סוג |
| --- | --- |
| `whatsappMessageId` | string |
| `whatsappStatus` | string |

## הגדרות

מגדירים תחת `config:` בצומת של התהליך. הגדרות טקסט יכולות להכיל מצייני מקום כמו `{nodeId.field}`.

| הגדרה | סוג | ברירת מחדל | תיאור |
| --- | --- | --- | --- |
| `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) |
| `text` (חובה) | string |  | Message (minLength 1; maxLength 1024) |
| `buttons` (חובה) | list of object |  | Buttons (minItems 1; maxItems 3) |
| `buttons[].id` (חובה) | string |  | ID is what comes back in the run the tap starts (its buttonId). (minLength 1; maxLength 256) |
| `buttons[].title` (חובה) | string |  | Button (minLength 1; maxLength 20) |

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

## דוגמה

```yaml title="config"
buttons:
- id: approve
  title: לאשר
- id: reject
  title: לדחות
text: להפיק קבלה על {amount}?
```

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

צומת שמריץ את `whatsapp-send-buttons` נכנס תחת `spec.nodes` של [Flow](https://docs.go-lumen.ai/he/concepts/how-flows-run.md#the-flow-as-yaml). תנו לו כל מזהה, ורשמו ב-next את מזהי הצמתים הבאים.

```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-send-buttons-example
  namespace: tenant-acme
spec:
  displayName: "Ask with buttons on WhatsApp"
  triggers:
    - id: start
      ref: {name: whatsapp-message-received}
      connectorRef: {name: my-whatsapp-cloud}
      next: [whatsapp-send-buttons]
  nodes:
    - id: whatsapp-send-buttons
      stepRef: {name: whatsapp-send-buttons}
      config:
        buttons:
        - id: approve
          title: לאשר
        - id: reject
          title: לדחות
        text: להפיק קבלה על {amount}?
```
