Skip to main content

Create secure interactive applications with WhatsApp flows end-to-end encryption

Workflow preview

Workflow preview
100%
Create secure interactive applications with WhatsApp flows end-to-end encryption preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

WhatsApp Flows Encrypted Data Exchange Workflow Summary This workflow enables secure end to end encrypted data exchange with WhatsApp Flows for interactive applications inside Whatsapp. It implemen...

Best for

  • Support Chatbot automation workflows
  • intermediate n8n builders looking for reusable templates

Tools used

n8n-nodes-base.webhook, n8n-nodes-base.code, n8n-nodes-base.switch, n8n-nodes-base.respondtowebhook, n8n-nodes-base.stickynote

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Flavio Angeleu.

Original n8n.io source

1.1 Workflow description

Title
Create secure interactive applications with WhatsApp flows end-to-end encryption
Workflow name
Create secure interactive applications with WhatsApp flows end-to-end encryption

WhatsApp Flows Encrypted Data Exchange Workflow

Summary

This workflow enables secure end-to-end encrypted data exchange with WhatsApp Flows for interactive applications inside Whatsapp. It implements the WhatsApp Business Encryption protocol using RSA for key exchange and AES-GCM for payload encryption, providing a secure channel for sensitive data transmission while interfacing with WhatsApp's Business API. This follows the official WhatsApp Business Encryption specifications to establish an encrypted GraphQL-powered data exchange channel between your business and the WhatsApp consumer client.

How It Works

Encryption Flow

  1. Webhook Reception: Receives encrypted data from WhatsApp containing:

    • encrypted_flow_data: The AES-encrypted payload
    • encrypted_aes_key: The RSA-encrypted AES key
    • initial_vector: Initialization vector for AES decryption
  2. Decryption Process:

    • The workflow decrypts the AES key using an RSA private key
    • Then uses this AES key to decrypt the payload data
    • The inverted IV is used for response encryption
  3. Data Processing:

    • The workflow parses the decrypted JSON data
    • Routes requests based on the screen parameter.
  4. Response Generation:

    • Generates appropriate response data based on the request type
    • Encrypts the response using the same AES key and inverted IV
    • Returns the base64-encoded encrypted response

Key Components

  • Webhook Endpoint: Entry point for encrypted WhatsApp requests
  • Decryption Pipeline: RSA and AES decryption components
  • Business Logic Router: Screen-based routing for different functionality
  • Encryption Pipeline: Secure response encryption

How to Use

  1. Deploy the Workflow:

    • Import the workflow JSON into your n8n instance
  2. Set Up WhatsApp Integration:

    • Configure your WhatsApp Business API to send requests to your n8n webhook URL
    • Ensure your WhatsApp integration is set up to encrypt data using the public key pair of the private key used in this workflow
  3. Test the Flow:

    • Send an encrypted test message from WhatsApp to verify connectivity
    • Check if appointment data is being retrieved correctly
    • Validate that seat selection is functioning as expected
  4. Production Use:

    • Monitor the workflow performance in production
    • Set up error notification if needed

Requirements

Authentication Keys

RSA Private Key: Required for decrypting the AES key (included in the workflow) WhatsApp Business Public Key: Must be registered with the WhatsApp Business API PostgreSQL Credentials: For accessing appointment data from the database

WhatsApp Business Encryption Setup As specified in the WhatsApp Business Encryption documentation:

Generate a 2048-bit RSA Key Pair:

The private key remains with your business (used in this workflow) The public key is shared with WhatsApp

Register the Public Key with WhatsApp:

Use the WhatsApp Cloud API to register your public key Set up the public key using the /v17.0/{WhatsApp-Business-Account-ID}/whatsapp_business_encryption endpoint

Key Registration API Call: POST /v17.0/{WhatsApp-Business-Account-ID}/whatsapp_business_encryption { "business_public_key": "YOUR_PUBLIC_KEY" }

Verification:

Verify your public key is registered using a GET request to the same endpoint Ensure the key status is "active"

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Webhook1

Type / Role
n8n-nodes-base.webhook - webhook
Config choices
Version 2

Block 2 - Json Parser

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 3 - Switch

Type / Role
n8n-nodes-base.switch - switch
Config choices
Version 3.2

Block 4 - Respond to Webhook1

Type / Role
n8n-nodes-base.respondToWebhook - respondToWebhook
Config choices
Version 1.1

Block 5 - Data Extraction Code

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 6 - Respond to Webhook2

Type / Role
n8n-nodes-base.respondToWebhook - respondToWebhook
Config choices
Version 1.1

Block 7 - Data Extraction Code1

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 8 - move to base64

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 9 - Decryption Code

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 10 - Encrypt Return

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 11 - Encrypt Return1

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 12 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow Create secure interactive applications with WhatsApp flows end-to-end encryption
Complexity intermediate
Nodes 12
Categories Support Chatbot
Author Flavio Angeleu
Published 10 May 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/3973/3973.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Create secure interactive applications with WhatsApp flows end-to-end encryption do?

WhatsApp Flows Encrypted Data Exchange Workflow Summary This workflow enables secure end to end encrypted data exchange with WhatsApp Flows for interactive applications inside Whatsapp. It implemen...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Support Chatbot use case.