WhatsApp Evolution API to Chatwoot Automation with Media Support - n8n Workflow

Use this robust n8n workflow to automatically forward WhatsApp messages, including text and media, from the Evolution API gateway into Chatwoot, ensuring no leads are missed.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Customer support teams needing reliable WhatsApp integration with their CRM/Helpdesk system (Chatwoot).
Developers looking for specialized n8n templates for managing high-volume communication flows.
System administrators requiring an n8n solution for de-duplication and media file handling.
Businesses using the Evolution API as their WhatsApp gateway and Chatwoot for agent management.

Overview

Integrating real-time messaging platforms like WhatsApp with CRM systems can be challenging, especially when dealing with file attachments and message duplication. This specialized n8n workflow solves these problems by providing a complete, fault-tolerant forwarding solution. It starts by carefully extracting message parameters and validating the input data. Before processing, a Redis n8n node is used to check the message ID, preventing duplicate entries in Chatwoot—a common issue with webhook systems. Furthermore, this n8n automation handles complex operations like base64-to-binary conversion for media files, enabling seamless forwarding of images, videos, and documents to the Chatwoot conversation. This powerful n8n workflow ensures a smooth flow of customer interactions into your support pipeline.

How it Works

This custom n8n workflow operates through several distinct phases to ensure reliability and accurate data forwarding.


  1. Trigger and Initialization: The process begins with the 'When Executed by Another Workflow' n8n trigger, indicating it's integrated into a larger system (likely triggered by a webhook from Evolution API). The 'PARAMETERS' n8n node then extracts essential variables like account ID, inbox ID, and the unique Evolution message ID.

  2. Message Parsing and Validation: A custom 'CODE - MESSAGE OBJECT' n8n node performs deep parsing of the WhatsApp message payload, extracting message text, handling quoted replies, and identifying contact sharing (VCARD) and media file metadata. Subsequent 'If' n8n nodes ('TIPO MENSAGEM VÁLIDO?' and 'IS THE PHONE NUMBER VALID?') ensure the message type and phone number format are acceptable.

  3. De-duplication Check: The n8n workflow uses Redis (via the 'REDIS - EVOLUTION MSG - GET' n8n node) to check if the message ID was already processed. If not, the ID is immediately set in Redis ('REDIS - EVOLUTION MSG - SET') to prevent future duplicates.

  4. Contact Management: The flow searches Chatwoot for an existing contact using the phone number ('LOAD CONTACT'). If the contact is new, the 'CREATE CONTACT' n8n node registers them, ensuring every incoming message has an associated Chatwoot contact ID.

  5. Conversation Flow: The n8n workflow then queries a PostgreSQL database to find any open conversations for that contact and inbox. If an open conversation exists, it continues; otherwise, the 'CREATE CONVERSATION' n8n node initiates a new chat session in Chatwoot.

  6. Text Message Forwarding: The workflow checks if the message is incoming (customer to agent) or outgoing (agent via Evolution API) and uses the dedicated Chatwoot n8n node ('SEND INCOMING MESSAGE' or 'SEND OUTGOING MESSAGE') to submit the text content.

  7. Media Handling (If applicable): If the message includes media, the 'EVOLUTION - GET FILE' n8n node fetches the base64 content. The flow checks for unauthorized extensions ('CHECK FILE TYPE' n8n node) and, if clean, converts the base64 data to a binary file using the 'Convert to File' n8n node. Finally, the binary file is uploaded to Chatwoot via a complex 'SEND CHATWOOT FILE' HTTP Request n8n node, completing this comprehensive n8n workflow execution.

Installation Guide

To utilize this sophisticated n8n template, follow these steps:


  1. Import the n8n workflow: Copy the provided JSON and import it into your self-hosted or cloud n8n instance.

  2. Credential Setup: You must configure credentials for all required services:

Evolution API: Set up credentials for the 'Evolution account' (used for fetching base64 media data).
Chatwoot API: Set up credentials for the 'ChatWoot account' (used for Contact, Conversation, and Message operations).
Redis: Configure the 'Redis account' credential used for message de-duplication.
PostgreSQL: Configure the 'Postgres VectorDocs' credential used for checking existing conversations.

  1. Configure Parameters: Review the 'PARAMETERS' n8n node. Ensure that placeholders for cdaccount and cdinboxchatwoot are correctly mapped from the invoking webhook/n8n trigger context. You may need to customize the Chatwoot URL in the 'SEND CHATWOOT FILE' n8n node if it differs from the default.

  2. Integration: Ensure your master n8n workflow (receiving webhooks from Evolution API) is set up to execute this child n8n workflow and pass the required parameters (cdaccount, cdinboxchatwoot, ds_msg).

Node Details

This n8n workflow leverages several specialized n8n nodes for its advanced functionality:

When Executed by Another Workflow (n8n trigger): This is the entry point, receiving structured data (account, inbox, message object) from an upstream n8n workflow.
CODE - MESSAGE OBJECT (n8n node): A custom JavaScript n8n node essential for parsing the complex, nested JSON payload from Evolution API, standardizing fields, handling message types (like VCARDs), and extracting media metadata.
Redis n8n node: Used for the GET and SET operations to store and check the Evolution Message ID, providing necessary de-duplication logic for the n8n workflow.
Chatwoot n8n node (from devlikeapro): Used extensively for Contact Search, Contact Create, New Conversation, and Create A New Message In A Conversation operations, simplifying integration with the Chatwoot CRM.
Postgres n8n node: Executes a SELECT query against the conversations table to quickly identify existing open Chatwoot conversations.
Evolution API n8n node: Performs the critical get-media-base64 operation to retrieve the actual file content based on the message ID.
Convert to File n8n node: Takes the raw base64 data retrieved from the Evolution API and converts it into a storable binary format, ready for upload.
HTTP Request n8n node ('SEND CHATWOOT FILE'): Configured specifically to use multipart-form-data to successfully send the converted binary file along with message metadata to the Chatwoot API.

Related n8n Workflows

Free

Nodes: 13 Nodes
Updated: December 26 2025
View all
Created by
Thiago Vazzoler Loureiro
Thiago Vazzoler Loureiro

Building Custom Automations with n8n | Node.js Developer | Integration Specialist | Open Source Contributor If you need help with n8n workflows, API integrations, or custom nodes, feel free to connect on LinkedIn: http://linkedin.com/in/thiago-vazzoler-loureiro-24056227

Featured*