Skip to main content

A WhatsApp message arrives

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

At a glance​

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

Outputs​

A later node references an output as {nodeId.field} in text, or nodeId.field in a condition.

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

Settings​

Set under config: on the flow trigger.

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

The full JSON Schema of these settings: whatsapp-message-received.schema.json.

Use it in a flow​

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