WhatsApp Send
Summary
Send a WhatsApp message.
A common use-case is to send a response to a message sent from a user, e.g.:
Ports
When an event is received on the in
port a WhatsApp message is attempted to be sent.
If the message is successfully sent, an event is routed to the success
port. Otherwise, i.e. if an error occurs, an event is routed to the error
port.
Input/Output Format
Input
The received event is assumed to be an object with the following properties present:
to
,text
, andpreview_url
.
The properties are expected to have the following types:
Property | Type | Comment |
---|---|---|
to | string | A string containing a WhatsApp ID or phone number. |
text | string | A string containing the body of the message. |
preview_url | boolean | undefined | Render a preview if message contains link. |
(Please see this documentation on messages for more information.)
Output
An event routed to success
generally conforms to the following format:
{
"messaging_product": "whatsapp",
"contacts": [{
"input": "PHONE_NUMBER",
"wa_id": "WHATSAPP_ID",
}]
"messages": [{
"id": "wamid.ID",
}]
}
Please refer to the META documentation for more information.
An event routed to the error
port may be of any format. The event does describe the error that occured.
Events
This functions does not listen for, nor emits any events.
Other
Correctly configured META App and META Buisness are required to utilise this functions. We have posted a guide on our blog describing how to configure both the LoLo and META side.
META enforces restrictions on sending messages to prevent spam. Please refer to their documentation for more details.
Updated almost 2 years ago