Back to n8n Workflows

Rally Custom Quote Extraction

Mike Taylor Mike Taylor
Message and Claims Testing

Transform any question into compelling quote collections using Rally's AI persona network and GPT-4 analysis. Perfect for researchers and content creators who need diverse expert perspectives and insightful quotes on any topic.

Rally Custom Quote Extraction n8n workflow diagram

Click to expand

Overview

This workflow transforms user questions into comprehensive quote collections by leveraging Rally's AI persona network to gather diverse perspectives, then using GPT-4 to extract the most insightful and quotable responses. Perfect for researchers, content creators, and analysts who need varied viewpoints and compelling quotes on any topic from simulated expert personas.

🎯 Pro Tips & Secret Sauce

The magic happens in the two-stage AI processing pipeline that first collects diverse human-like perspectives, then intelligently curates them:

  1. Persona Diversity Mining - Rally's AI personas provide varied perspectives based on different backgrounds, expertise, and viewpoints, simulating real human diversity
  2. Thought Extraction & Merging - Custom code isolates the 'thoughts' from each persona response and combines them into a comprehensive knowledge base
  3. AI-Powered Quote Curation - GPT-4.1-Mini analyzes the merged thoughts to extract only the most insightful, quotable, and valuable statements
  4. Context Preservation - The original question context is maintained throughout the process to ensure extracted quotes remain relevant and meaningful
  5. Interactive Chat Interface - Real-time processing through n8n's chat trigger makes it feel like having a conversation with a research assistant

This creates a powerful research tool that combines the diversity of human perspectives with the precision of AI curation, perfect for finding compelling quotes and insights on any topic.

πŸ“ Step-by-Step Instructions

  1. Chat Message Received - User submits a question or topic through the interactive chat interface
  2. Rally API Query - Sends the user's question to Rally's AI persona network to gather diverse perspectives and responses
  3. Response Processing - Custom code processes Rally's API response to extract the 'thoughts' field from each persona's response
  4. Thought Aggregation - Merges all individual persona thoughts into a single comprehensive text with clear separators between responses
  5. Quote Extraction - OpenAI GPT-4.1-Mini analyzes the merged thoughts to identify and extract the most insightful, quotable statements
  6. Output Formatting - Final formatting of extracted quotes and insights for easy consumption and use

πŸ“‹ Requirements

Required Integrations

  • Rally API - AI persona audience simulation service for gathering diverse perspectives
  • OpenAI - GPT-4.1-Mini for intelligent quote extraction and analysis
  • Chat Trigger - Interactive chat interface for user input

Required Credentials

  • Rally API Bearer token with access to persona audiences
  • OpenAI API key with GPT-4 access

Setup Prerequisites

  • Active Rally account with configured audience personas (default: rb842b547c27640)
  • n8n instance with chat trigger capability enabled
  • Bearer authentication configured for Rally API access

πŸš€ n8n Workflow Template

{
  "active": false,
  "connections": {
    "Code": {
      "main": [
        [
          {
            "index": 0,
            "node": "OpenAI",
            "type": "main"
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "index": 0,
            "node": "Code",
            "type": "main"
          }
        ]
      ]
    },
    "OpenAI": {
      "main": [
        [
          {
            "index": 0,
            "node": "Edit Fields",
            "type": "main"
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "index": 0,
            "node": "HTTP Request",
            "type": "main"
          }
        ]
      ]
    }
  },
  "id": "5xmU7ZOJERJbqnsO",
  "meta": {
    "instanceId": "7aa2e96d57ff40383569724f8ecb13d674a87bf09d39aa5d8fa5ba31f7a8407a",
    "templateCredsSetupCompleted": true
  },
  "name": "Rally Custom Quote Extraction",
  "nodes": [
    {
      "credentials": {
        "httpBearerAuth": {
          "id": "HeUQ9K9oUtQ5TyHr",
          "name": "Bearer Auth account"
        }
      },
      "id": "158cf600-8a55-445b-af1e-892e31eab688",
      "name": "HTTP Request",
      "parameters": {
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "smart",
              "value": "false"
            },
            {
              "name": "provider",
              "value": "openai"
            },
            {
              "name": "query",
              "value": "={{ $json.chatInput }}"
            },
            {
              "name": "audience_id",
              "value": "rb842b547c27640"
            }
          ]
        },
        "genericAuthType": "httpBearerAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            },
            {
              "name": "accept",
              "value": "application/json"
            }
          ]
        },
        "method": "POST",
        "options": {},
        "sendBody": true,
        "sendHeaders": true,
        "url": ""
      },
      "position": [
        500,
        60
      ],
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2
    },
    {
      "id": "d3542988-6a9f-44db-9176-ed9278bf1eb3",
      "name": "When chat message received",
      "parameters": {
        "options": {}
      },
      "position": [
        280,
        60
      ],
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.1,
      "webhookId": "56f7f814-8a26-4db2-a2d2-b868959cd1a3"
    },
    {
      "credentials": {
        "openAiApi": {
          "id": "gnl8aokybFe5U5a8",
          "name": "OpenAi account"
        }
      },
      "id": "43895a9e-3336-4fa8-a13f-9b6bed381660",
      "name": "OpenAI",
      "parameters": {
        "messages": {
          "values": [
            {
              "content": "=Extract insightful quotes from these responses to the question:  {{ $(\u0027When chat message received\u0027).item.json.chatInput }}.\n\n## Thoughts\n{{ $json.mergedThoughts }}"
            }
          ]
        },
        "modelId": {
          "__rl": true,
          "cachedResultName": "GPT-4.1-MINI",
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "position": [
        940,
        60
      ],
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.8
    },
    {
      "id": "9b772ae7-90ae-4241-9e65-b9c3e3078fdf",
      "name": "Code",
      "parameters": {
        "jsCode": "// Get all input items\nconst items = $input.all();\n\n// Extract all thoughts from all responses across all items\nlet allThoughts = [];\n\nitems.forEach(item =\u003e {\n  if (item.json.responses \u0026\u0026 Array.isArray(item.json.responses)) {\n    item.json.responses.forEach(response =\u003e {\n      if (response.thoughts) {\n        allThoughts.push(response.thoughts);\n      }\n    });\n  }\n});\n\n// Return a single item with merged thoughts\nreturn [{\n  json: {\n    session_id: items[0].json.session_id,\n    title: items[0].json.title,\n    mergedThoughts: allThoughts.join(\u0027\\n\\n--- Next Response ---\\n\\n\u0027),\n    thoughtsArray: allThoughts, // Also keep as separate array if needed\n    totalResponses: allThoughts.length\n  }\n}];"
      },
      "position": [
        720,
        60
      ],
      "type": "n8n-nodes-base.code",
      "typeVersion": 2
    },
    {
      "id": "6727c189-7dae-4f5d-83bd-3d96be46f694",
      "name": "Edit Fields",
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "a68e50ac-ba69-4dea-9699-0a71187b50d3",
              "name": "output",
              "type": "string",
              "value": "={{ $json.message.content }}"
            }
          ]
        },
        "options": {}
      },
      "position": [
        1300,
        60
      ],
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4
    }
  ],
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "tags": [],
  "versionId": "5b8ddf4e-a259-4255-9eee-cd06fd270461"
}

About the Author

Mike Taylor

Mike Taylor

Mike Taylor is the CEO & Co-Founder of Rally. He previously co-founded a 50-person growth marketing agency called Ladder, created marketing & AI courses on LinkedIn, Vexpower, and Udemy taken by over 450,000 people, and published a book with O’Reilly on prompt engineering.