AutomationFlowsAI & RAG › Research Assistant for Whatsapp Using Twilio, Perplexity and Claude

Research Assistant for Whatsapp Using Twilio, Perplexity and Claude

ByHarsh Maniya @harshmaniya1 on n8n.io

Ever wished you could get a deep, multi-source research report on any topic, delivered directly to your WhatsApp chat in seconds? This workflow transforms your WhatsApp into a powerful, on-demand research assistant, perfect for students, professionals, and curious minds.

Webhook trigger★★★☆☆ complexityAI-powered10 nodesPerplexityChain LlmTwilioAnthropic Chat
AI & RAG Trigger: Webhook Nodes: 10 Complexity: ★★★☆☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #6926 — we link there as the canonical source.

This workflow follows the Chainllm → Anthropic Chat recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "KxLD27K9btIxsRZo",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Whatsapp Deep research",
  "tags": [],
  "nodes": [
    {
      "id": "f3a0dc1a-f64b-4f2e-945a-2cfdfe607e45",
      "name": "Fetch Whatsapp Request",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -528,
        0
      ],
      "parameters": {
        "path": "fetch-whatsapp-request",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 2
    },
    {
      "id": "51fc09d1-55e2-4198-977b-79066559d246",
      "name": "Perform Deep Research",
      "type": "n8n-nodes-base.perplexity",
      "position": [
        -224,
        0
      ],
      "parameters": {
        "model": "sonar-pro",
        "options": {},
        "messages": {
          "message": [
            {
              "content": "=You are a specialized AI Research Analyst. Your task is to perform a deep, comprehensive, and objective research analysis on the user-provided topic using your advanced sonar search capabilities. The final output must be a well-structured report formatted in Markdown, suitable for delivery via an API.\n\n**User Query:**\n\"{{ $json.body.Body }}\"\n\n**Required Output Structure:**\n\n1.  **Title:** A clear and concise title for the research report.\n2.  **Overview (1-2 paragraphs):** A high-level executive summary of the topic. This should give the user the most important information at a glance.\n3.  **Key Points (Bulleted List):** A list of 3-5 of the most critical facts, findings, or aspects of the topic.\n4.  **Detailed Analysis:** A more in-depth exploration of the topic. Break this section down with subheadings (using bold text) as needed. Cover background, current status, different perspectives, and relevant data.\n5.  **Conclusion:** A brief concluding paragraph that summarizes the main takeaways or future outlook.\n6.  **Sources:** A numbered list of the primary sources used for this analysis.\n\n**Guidelines:**\n-   **Tone:** Maintain a neutral, objective, and factual tone.\n-   **Accuracy:** Prioritize information from reputable sources. Synthesize findings from multiple sources to provide a balanced view.\n-   **Formatting:** Strictly adhere to the Markdown structure specified above. Use `*bold*` for headings and bullet points (`-` or `*`) for lists.\n-   **Clarity:** Write in clear, concise language. Avoid overly technical jargon where possible, or explain it if necessary.\n-   **Completeness:** The generated report should be a self-contained document based solely on the provided user query. Do not ask follow-up questions."
            }
          ]
        },
        "simplify": true,
        "requestOptions": {}
      },
      "credentials": {
        "perplexityApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "783daa3b-db9e-4a8c-b0e1-60679ee293cf",
      "name": "Refine Generated Output for Whatsapp",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        112,
        0
      ],
      "parameters": {
        "text": "=You are an expert content editor who transforms raw text into perfectly formatted summaries for WhatsApp. Your task is to take the provided research report and polish it into a message that is readable, engaging, and renders correctly on WhatsApp.\n\n**Raw Research Report:**\n{{ $json.message }}\n\n**Your Instructions:**\n\n1.  **Preserve Core Content:** Do not change the facts, data, or the meaning of the original text. Your job is to edit for style and formatting only.\n\n2.  **Add Emojis:**\n    * Add a single, relevant emoji at the beginning of the Title.\n    * Add relevant emojis to the main section headers and to each bullet point in the \"Key Points\" list.\n\n3.  **Strict Formatting Rules for WhatsApp:**\n    * **Bolding:** Apply bold formatting by enclosing headers in **single asterisks**. For example: `*Overview:*`. Do NOT use double asterisks.\n    * **Bullet Points:** Use a standard hyphen (`-`) followed by a single space for each bullet point.\n    * **Spacing:** Ensure there is a **double line break** (press Enter twice) between each major section to create clean visual separation.\n    * **Citations:** Preserve the numerical inline citations like `[1]`, `[2]`, etc., exactly as they are.\n\n4.  **Character Limit:** The entire final output MUST be less than 1600 characters to comply with WhatsApp's message limit. Be concise.\n\n5.  **No Preamble:** Your output must begin *directly* with the report's title. Do not include any introductory phrases like \"Here is the polished version:\".\n\n**Example of Desired Final Output Format:**\n\n*Example:*\n\ud83e\udd16 *Title:* Example Report\n\ud83d\udcdc *Overview:*\nThis is a summary of the topic. It is clear and concise.\n\n\ud83c\udfaf *Key Points:*\n- \u2705 This is the first key point.\n- \u2699\ufe0f This is the second key point.\n\n---\n\nProduce the final, polished WhatsApp-ready report now, strictly following all the rules and the format shown in the example.\n\n**Remember whatsapp allows only 1600 characters to send via message so your output must be less than or equal to that.**",
        "batching": {},
        "promptType": "define"
      },
      "typeVersion": 1.7
    },
    {
      "id": "e613cdb5-7ba4-4519-b15e-a0174fdb55d6",
      "name": "Send Output in Whatsapp",
      "type": "n8n-nodes-base.twilio",
      "position": [
        640,
        0
      ],
      "parameters": {
        "to": "={{ $('Fetch Whatsapp Request').item.json.body.From.replace('whatsapp:', '') }}",
        "from": "={{ $('Fetch Whatsapp Request').item.json.body.To.replace('whatsapp:', '') }}",
        "message": "={{ $json.text }}",
        "options": {},
        "toWhatsapp": true
      },
      "credentials": {
        "twilioApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "ede2a3ae-6dc9-486e-999f-dcb9737fd79b",
      "name": "Claude Sonnet 4",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "position": [
        112,
        208
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "claude-sonnet-4-20250514",
          "cachedResultName": "Claude 4 Sonnet"
        },
        "options": {}
      },
      "credentials": {
        "anthropicApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "3c93f1c8-e00e-4791-b10f-02f9c0d82630",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -624,
        -224
      ],
      "parameters": {
        "width": 288,
        "height": 560,
        "content": "### \ud83d\udcf2 WhatsApp Gateway\n\n**Function:** This is the front door. It catches incoming messages from a user via the Twilio webhook.\n\n**Trigger:** Receives a POST request from Twilio.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n**Output:** Passes the user's message (`body.Body`), their phone number (`body.From`), and the bot's number (`body.To`) to the next nodes.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "198ba40c-5f71-4cef-a69e-fb621829281d",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -320,
        -224
      ],
      "parameters": {
        "color": 7,
        "width": 288,
        "height": 560,
        "content": "### \ud83e\udde0 The AI Research Engine\n\n**Function:** This node is the core researcher. It takes the user's simple question and performs a deep, multi-source dive using Perplexity's powerful `Sonar Pro` model.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n* **Input:** The raw text query from the user.\n* **Output:** A detailed, structured report in raw Markdown, complete with citations and sources. This is the \"first draft\"."
      },
      "typeVersion": 1
    },
    {
      "id": "eada649f-b85c-4696-a670-eeafb6ac2773",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -16,
        -224
      ],
      "parameters": {
        "color": 3,
        "width": 528,
        "height": 560,
        "content": "### \ud83c\udfa8 The Content Stylist\n\n**Function:** This node acts as an expert editor. It takes the raw research from Perplexity and polishes it into a perfect WhatsApp message.\n\n**Key Actions:** Adds emojis, enforces correct formatting (`bold`), shortens the text to fit the character limit, and removes all conversational filler.\n* **Input:** The raw Markdown report.\n* **Output:** A single, polished, and user-ready text string.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "097b9242-ce57-48a2-9be5-f3e59298b634",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        528,
        -224
      ],
      "parameters": {
        "color": 6,
        "width": 320,
        "height": 560,
        "content": "### \ud83d\ude80 WhatsApp Dispatch\n\n**Function:** This is the final step. It sends the beautifully formatted research summary back to the user who asked for it.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n* **Clever Logic:** It automatically swaps the `From` and `To` numbers from the first node to ensure the reply always goes to the right person.\n* **Action:** Sends the final text from the \"Content Stylist\" node via the Twilio API. Mission complete!"
      },
      "typeVersion": 1
    },
    {
      "id": "c5462997-d89d-4ae6-9d62-d5bca26bd02f",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1008,
        -224
      ],
      "parameters": {
        "color": 5,
        "width": 368,
        "height": 560,
        "content": "## \u2b50 Workflow Summary\n\n> ### \ud83e\udd16 WhatsApp AI Research Assistant\n>\n> This workflow powers a fully automated, on-demand research assistant that operates directly within WhatsApp. It's designed to take any user query received via **Twilio**, understand its core topic, and deliver a comprehensive yet beautifully formatted summary directly back to the user's chat.\n>\n> The process is a seamless four-step data journey:\n> 1.  **Catch (\ud83d\udcf2):** The workflow activates when a user's message is received by the webhook.\n> 2.  **Research (\ud83e\udde0):** The raw query is immediately sent to **Perplexity Sonar** to perform a deep, multi-source web search, generating a fact-based, structured report.\n> 3.  **Polish (\ud83c\udfa8):** That raw report is then passed to a **Claude** model, which acts as an expert content editor. It shortens the text, adds engaging emojis, and formats it perfectly for a mobile screen.\n> 4.  **Reply (\ud83d\udcac):** The final, polished answer is instantly dispatched back to the original user through **Twilio**, completing the entire request in seconds."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "ffca0cbc-b83b-4419-910d-4c05e17be6bf",
  "connections": {
    "Claude Sonnet 4": {
      "ai_languageModel": [
        [
          {
            "node": "Refine Generated Output for Whatsapp",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Perform Deep Research": {
      "main": [
        [
          {
            "node": "Refine Generated Output for Whatsapp",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Whatsapp Request": {
      "main": [
        [
          {
            "node": "Perform Deep Research",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Refine Generated Output for Whatsapp": {
      "main": [
        [
          {
            "node": "Send Output in Whatsapp",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Ever wished you could get a deep, multi-source research report on any topic, delivered directly to your WhatsApp chat in seconds? This workflow transforms your WhatsApp into a powerful, on-demand research assistant, perfect for students, professionals, and curious minds.

Source: https://n8n.io/workflows/6926/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

This template uses the Apify LinkedIn Profile Scraper, which is a community node only available in self-hosted n8n installations. The LinkedIn scraping step is optional and can be removed for n8n Clou

HTTP Request, Perplexity, Slack +8
AI & RAG

Automatically reads every reply to your cold email campaigns in Instantly.ai, uses Claude AI to understand the intent, and takes the right action . No need ofmanual inbox checking needed. A lead repli

Chain Llm, Anthropic Chat, Slack +3
AI & RAG

Requirements: GitHub API token ( scope), Anthropic API key (Claude Sonnet 4.5), Slack Bot Token (optional)

Form Trigger, HTTP Request, Chain Llm +2
AI & RAG

Automatically score product usage signals from Amplitude cohorts and route hot leads to sales with enriched context.

HTTP Request, Perplexity, Agent +4
AI & RAG

This workflow is a powerful, fully automated web query and semantic reranking system that allows users to perform precise, detailed searches, intelligently rank search results and provide high-quality

Output Parser Autofixing, Output Parser Structured, Chain Llm +4