WhatsApp Trigger Consecutive Messages

Hey everyone!

I’ve seen several people struggling with the consecutive messages issue on WhatsApp message triggers (myself included). I built a solution that works perfectly for my use case and hopefully it helps you too.

Here’s the scenario:

Prep
Create a Datastore using the WhatsApp ID as the key and the following items:

  • Message: Whatsapp message
  • Last Execution ID: {{executionId}}

Workflow (top path = message is type text):

  1. WhatsApp Trigger
  2. Datastore: Get a Record - Checks if record already exists using the key
  3. Datastore: Add/Update Record - Gets the record and updates the Message item by appending the newest message to the previous one splitting by “. If there is no previous record, then it creates one with the user’s message.
    • Formula: {{if(2.messages; 2.messages + "|||" + 1.message_body; 1.message_body)}}
  4. Sleep 10 seconds - To give some room in case user sends more consecutive messages
  5. Datastore: Get a Record - Re-reads the record after the wait to check the current state.
  6. Filter: Condition: 5.last_trigger_id equals {{executionId}}. If false, execution stops, preventing the rest of the workflow to run on every trigger. If true, then the workflow continues with the all the messages from the record merged as one.

**Notes
***After your final step, add another Datastore module to delete the record so you can start fresh.

Hope this helps! :rocket: