WAHA n8n Workflow Templates

repository·main·Indexed 41 days ago

https://github.com/devlikeapro/waha-n8n-templates

A collection of n8n workflow templates for automating WhatsApp interactions using the WAHA (WhatsApp HTTP API) and the @devlikeapro/n8n-nodes-waha node. Includes templates for building WhatsApp bots, integrating with Chatwoot and Typebot, forwarding messages to email, processing images, and managing server restarts.

Tokens
4.6K
Snippets
14
Records
27
Agent score
50%

What's inside WAHA n8n Templates

  1. Integrate ChatWoot with WhatsApp via WAHA and n8n

    main

    This integration allows you to use ChatWoot as a customer support interface for WhatsApp messages. The communication flow is managed by n8n workflows acting as a bridge:

    1. ChatWoot to WhatsApp: n8n receives messages from ChatWoot and forwards them to WhatsApp via the WAHA API.
    2. WhatsApp to ChatWoot: n8n receives messages from WhatsApp via WAHA and forwards them to ChatWoot.

    To implement this, you must set up a database for tracking, configure the bidirectional message workflows, and optionally sync contacts.

  2. Available WAHA n8n Workflow Templates

    main

    This repository provides several pre-built n8n workflows for automating WhatsApp via the WAHA API. Available templates include:

    • WhatsApp Bot: A simple bot that responds to 'ping' with 'pong' and 'image' with an image.
    • WhatsApp Typebot Integration: Connects Typebot to WhatsApp via WAHA and n8n.
    • WhatsApp Chatwoot Integration: Integrates WAHA with Chatwoot for receiving and sending messages.
    • Send WhatsApp QR code for authorization to Email: Automatically emails the QR code when a session enters the SCAN_QR_CODE status.
    • Send Bulk Messages API: (Note: The README description for this section appears to overlap with the email forwarding template; check the specific template directory for details).
    • Forward WhatsApp text messages to email: Forwards all incoming WhatsApp text messages to an email address.
    • Fetch image, Rotate and Send it back: Demonstrates image processing (rotation) and sending it back via WhatsApp.
    • Send custom HTTP request to WAHA API: Demonstrates how to trigger custom WAHA API calls (e.g., sending a video when the text 'video' is received).
    • Restart server at midnight: A maintenance workflow to restart the server at a scheduled time.
    • WAHA Trigger Explanation: A guide/template explaining how the WAHA Trigger node works.
  3. Understand the WAHA Trigger node in n8n

    main
    The WAHA Trigger node in n8n is a specialized trigger designed to react to events from the WAHA (WhatsApp HTTP API) server. While the node appears as a single entity in a workflow, it functions by listening for incoming webhooks sent by the WAHA instance. When WAHA receives a WhatsApp event (such as a new message, a status update, or a connection change), it sends an HTTP POST request to the n8n webhook URL associated with this trigger, which then initiates the workflow execution.
  4. Use the Fetch image, Rotate and Send it back workflow template

    main

    This n8n workflow template automates a response pattern when an image is received via a WhatsApp session. When an image is detected, the workflow automatically marks the message as 'seen', fetches the image file, rotates it by 180 degrees, and sends the rotated version back to the sender.

    To use this template, you need an instance of WAHA (WhatsApp HTTP API) and an n8n instance.

    // The workflow configuration can be found in the template.json file within this directory.
    // To install: Copy the content of template.json and paste (Ctrl+V) directly into your n8n canvas.
  5. Set up the WhatsApp Bot Template in n8n

    main

    To deploy the WhatsApp Bot Template, follow these steps:

    1. Import the Workflow: Copy the contents of template.json and paste it directly into your n8n canvas (Ctrl+V), or use the Import From URL feature in n8n.
    2. Configure WAHA API: Set up your WAHA API credentials within the workflow and ensure they are selected in all WAHA-related nodes.
    3. Configure Webhook:
      • Open the WAHA Trigger node in n8n to find your Webhook URL (use the production URL for live use).
      • In your WAHA configuration, set up your session to send webhooks of type message to this specific Webhook URL.
    4. Activate: Set the workflow to Active in n8n.
    5. Test: Send ping or image from a different WhatsApp account to the account managed by your WAHA session to verify the automation.
  6. Set up WAHA to ChatWoot (Incoming Messages)

    main

    This workflow enables receiving messages from WhatsApp and displaying them in ChatWoot.

    1. Collect the following from your ChatWoot settings:
      • Account ID
      • Inbox ID
      • Inbox Identifier
      • ChatWoot URL
    2. Import WhatsApp___ChatWoot__WAHA____ChatWoot_Messages.json into n8n.
    3. Configure the workflow with your ChatWoot settings and credentials.
    4. Configure all Postgres nodes with your Postgres credentials.
    5. Activate the workflow in n8n.
    6. Copy the Production URL from the Webhook node.
    7. In your WAHA session webhook settings, paste the URL and configure it to listen for message events.
    8. Test by sending a WhatsApp message.
    Template file: WhatsApp___ChatWoot__WAHA____ChatWoot_Messages.json
  7. Set up WhatsApp Typebot Integration

    main

    To integrate Typebot with a self-hosted WhatsApp API (WAHA) using n8n, follow these steps:

    1. Import Typebot Configuration: Import typebot.json into your Typebot instance.
    2. Import n8n Workflow: Copy template.json and paste it into n8n (Ctrl+V) or import it via URL.
    3. Configure WAHA API: Set up your WAHA API credentials and ensure they are selected in all WAHA nodes within the workflow.
    4. Configure Typebot Node: Provide your typebot.url and typebot.bot.id in the Typebot node.
    5. Configure Database: Set up your Postgres credentials in the Postgres nodes.
    6. Run Migrations: Execute the Migration block in n8n to create the required database tables.
    7. Configure Webhooks:
      • Retrieve the production Webhook URL from the WAHA Trigger node.
      • Configure your WAHA session to send webhooks of type message to this URL.
    8. Activate Workflow: Set the n8n workflow to Active.
    # Required files for setup
    - Typebot config: `typebot.json`
    - n8n workflow: `template.json`
  8. Set up ChatWoot to WAHA (Outgoing Messages)

    main

    This workflow enables sending messages from ChatWoot to WhatsApp.

    1. Import WhatsApp___ChatWoot__ChatWoot____WAHA_Messages.json into n8n.
    2. Configure WAHA settings with your specific session.
    3. Provide credentials for all WAHA nodes.
    4. Activate the workflow in n8n.
    5. Copy the Production URL from the Webhook node.
    6. In ChatWoot, create a new API Inbox and paste the n8n Webhook URL into the Webhook URL field.
    7. Test by sending a message from ChatWoot.
    Template file: WhatsApp___ChatWoot__ChatWoot____WAHA_Messages.json
  9. Use the WhatsApp Bot Template

    main

    The WhatsApp Bot Template is a simple n8n workflow that automates responses to specific WhatsApp messages. It uses a WAHA (WhatsApp HTTP API) trigger to listen for incoming messages and responds based on the content:

    • If the message is ping, the bot replies with pong.
    • If the message is image, the bot sends an image back.
    • The workflow is configured to always send a 'seen' status for every new message received on the WAHA session.

    The template is provided as a template.json file which can be imported directly into n8n.

    // Refer to template.json for the workflow structure