Library / Security & Compliance
Security & Compliance
Decrypt and Parse Incoming Webhook Payloads
When a webhook arrives, it decrypts the payload, extracts the data fields, converts files to base64 and returns the response.
What it does
## Try it out ### 🔗 1. Webhook Entry & Initial Decryption Block Nodes involved: * Webhook1 * move to base64 * [partially visible node for decryption using RSA + AES] Description: The workflow begins with the Webhook1 node, which listens for incoming HTTP POST requests. These requests typically contain encrypted data that needs to be decoded to proceed with processing. Once received, the move to base64 node reformats the incoming encrypted components (encrypted_flow_data, encrypted_aes_key, and initial_vector) into binary buffers. These are required inputs for decryption. Then, the custom JavaScript code (cut off in your snippet) uses a private RSA key to decrypt the AES key, which in turn is used to decrypt the actual data payload (likely using AES-GCM). This is a secure hybrid encryption method—RSA for key exchange, AES for data encryption. --- ### 🧠 2. Payload Parsing & Preprocessing Block Node involved: * Json Parser Description: Here, we take the decrypted JSON payload from Whatsapp Flows and parse key elements from it. This helps standardize and clean the input before deciding what kind of logic or response should follow based on user interaction. --- ### 🔀 3. Flow Decision Block Node involved: * Switch Description: This decision-making node routes the workflow depending on the screen context extracted earlier. E.g., If the screen where the user is exchanging information is appointment date: * "APPOINTMENT" → follow the logic that handles scheduling data. This allows dynamic routing within the workflow, making it adaptable to different user journey steps or screens. --- ### 📆 4. Appointment Data Handling Block Nodes involved: * Data Extraction Code * Respond to Webhook1 Description: When the screen is "APPOINTMENT", the Data Extraction Code node processes appointment data—typically grouping appointment slots by date. This is useful for summarizing available times, perhaps to show a user a calendar view of options. The results are then sent back as a plain text response using Respond to Webhook1, which finalizes the API call and ensures a secure end-to-end interaction using Whatsapp Flows. ### 🧩 Summary This n8n workflow handles encrypted user interactions and adapts dynamically based on the screen or step the user is currently in. Here's the general pattern: 1. Webhook receives encrypted data 2. Data is decrypted using hybrid RSA-A
The steps
- Webhook1
- Json Parser
- Switch
- Respond to Webhook1
- Data Extraction Code
- Respond to Webhook2
- Data Extraction Code1
- move to base64
- Decryption Code
- Encrypt Return
- Encrypt Return1
- Error Handler
- Stopanderror 1
- Stopanderror 2
39 steps in total.
Similar automations
Security & ComplianceGenerate and Validate Test Payloads with OpenAI8 stepsSecurity & ComplianceEncrypt and Decrypt Workflow Data with XOR and Base644 stepsSecurity & ComplianceParse DMARC Reports into MySQL and Alert Slack15 stepsSecurity & ComplianceParse DMARC Email Reports into MySQL with Slack Alerts35 steps