A WhatsApp message arrives
whatsapp-message-receivedStarts 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.
De un vistazo
| Propiedad | Valor |
|---|---|
| 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.
Salidas
Un nodo posterior se refiere a una salida como {nodeId.field} en un texto, o nodeId.field en una condición.
| Salida | Tipo |
|---|---|
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 |
Ajustes
Se definen bajo config: en el disparador del flujo.
| Ajuste | Tipo | Valor por defecto | Descripción |
|---|---|---|---|
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. |
El JSON Schema completo de estos ajustes: whatsapp-message-received.schema.json.
Úsalo en un flujo
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