Skip to main content
This example demonstrates how to implement a basic automated reply workflow using n8n, a large language model and a YCloud node:
When the YCloud platform receives an inbound message, it triggers an n8n workflow via a webhook. The workflow calls upon the large language model to generate a reply, and then sends the message back to the user via the YCloud node.
YCloud AI Agent has built a comprehensive AI workflow for you, offering an end-to-end, easy-to-understand AI knowledge base, corpora and automated processes. Click here for more details.

Overall Process

YCloud product screenshot

Webhook Event

  1. Create a Webhook endpoint
    1. Use the n8n Webhook Node to create a new listener
    2. Select POST as the HTTP method
    3. In the Options, set the Response Code to 200 and ensure that ‘Immediately’ is selected
YCloud product screenshot Add your endpoint details to the YCloud platform and select the Webhook events you wish to monitor
YCloud webhook event selector with Search event highlighted.

Use Search event to find the webhook events your n8n workflow needs before confirming.

Parse the return value and verify the signature

Parse the return value

Parsing the headers in the webhook response using N8N’s built-in ‘code’ node YCloud product screenshot Select JavaScript for parsing
The return values of this node are:
  • The original value,
  • The timestamp,
  • The received signature, the payload, the signed payload, and the signature information in the request header

Encrypted data

In the previous step, the data was fully partitioned. In this node, we will use SignedPayload and Secret. We will use the Crypto node to encrypt the data. YCloud product screenshot Ge Secret from YCloud platform. YCloud product screenshot

Compare signatures

Use an if statement to verify the signature information; if it matches, the verification is considered successful. YCloud product screenshot

Reply to messages using AI

Once you have subscribed to the whatsapp.inbound_message.received and whatsapp.message.updated events, you will receive a push notification when a message is received, or a follow-up status update after a message has been sent.
  1. Use the switch node to configure multiple webhook notification types.
YCloud product screenshot
  1. When an inbound_message_received event is received, a reply can be generated by calling the AI API
YCloud product screenshot
  1. Use the merge node to retain the collection of webhook push data from the preceding section
YCloud product screenshot
  1. Sending messages using YCloud nodes
YCloud product screenshot Fill in the relevant details, place the AI-generated text in the Body field, and send.
Please note that the sender and recipient are reversed here; this is a reply message.
With that, the complete n8n workflow—Webhook → Large Language Model → Automated Reply—is now configured.

Save to a data table (optional)

YCloud product screenshot

Monitor subsequent updates to the message sent (optional)

Once step 5 is complete, the data will be pushed via the whatsapp.message.update event. Upon receiving this push, you can use the datatable - update rows node to update the data table, thereby tracking the entire message delivery process. YCloud product screenshot YCloud product screenshot