Zum Hauptinhalt springen

A WhatsApp message arrives

Auslöserwhatsapp-message-received

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.

Auf einen Blick​

EigenschaftWert
Trigger namewhatsapp-message-received
ResourceClusterTrigger (lumen.ai/v1alpha1)
Sourceevent
Needs a connectionyes, one that provides whatsapp
Producestext, fields, file
Emitsitem
Installation must providenothing

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.

AusgabeTyp
fromstring
namestring
messagestring
kindstring
buttonIdstring
mediaTypestring
mediaCountnumber
mediaErrorstring
conversationIdstring
sessionIdstring
messageIdstring
connectionstring
receivedAtstring

Einstellungen​

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

EinstellungTypStandardwertBeschreibung
onlystring"all"Only limits which messages start the flow: every message, only text, or only a tapped button.one of all, text, buttons
fromlist of string-From limits the senders, by phone number with country code; empty is anyone.maxItems 50
showTypingbooleantrueMarks 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.

Im Flow verwenden​

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