Как с помощью n8n и GPT-4 настроить автоматический трекер упоминаний бренда

Автоматизация мониторинга упоминаний бренда помогает компаниям экономить время, снижать нагрузку на сотрудников и получать всегда актуальные данные о репутации. Один из удобных инструментов для таких задач — n8n, мощный конструктор автоматизаций с визуальным интерфейсом. С его помощью вы можете собрать workflow, который ежедневно проверяет упоминания вашего бренда и конкурентов в ChatGPT, сохраняет результаты в Google Sheets и формирует HTML-отчет на email.

Если вы ещё не установили n8n, рекомендуем сначала ознакомиться с нашим руководством: Как установить n8n Community Edition на VPS.

1. Общая схема workflow

Узлы n8n

Логические блоки workflow:

  • Scheduled Trigger — ежедневный запуск.
  • Query Preparation — формирование запросов для AI.
  • AI Interaction — отправка запросов в GPT-4o.
  • Response Processing — анализ ответов и определение упоминаний.
  • Data Storage — сохранение результатов в Google Sheets.
  • Reporting — генерация HTML-отчета и отправка на email.

2. Блоки workflow с картинками

2.1 Scheduled Trigger

Описание: Узел автоматически запускает workflow ежедневно.

Настройки узла:

  • Тип: Schedule Trigger
  • Интервал: ежедневно
  • Выход: соединение с Setup Queries

Скриншот интерфейса n8n узла Scheduled Trigger

Совет: выбирайте время запуска, удобное для вашего бизнеса.

2.2 Query Preparation

Описание: Создает массив запросов для AI на основе вашего бренда.

Настройки узла:

  • Тип: Code (JavaScript)
  • Вход: Daily Trigger
  • Выход: Query ChatGPT (HTTP)
  • JS пример:
    
    // Configuration - Update these values
    const brandName = "ATLEX"; // TODO: Replace with your actual brand name
    
    // TODO: Replace these example queries with ones relevant to YOUR brand and industry.
    // Aim for a mix of query types to get comprehensive insights.
    const queries = [
      // --- General Brand Awareness & Perception ---
      "What is [YourBrandName]?",
      "Tell me about [YourBrandName]'s main products/services.",
      "What are the benefits of using [YourBrandName]?",
      "How does [YourBrandName] compare to other solutions in the [YourIndustry] market?",
      "What do people say about [YourBrandName]?",
    
      // --- Problem/Solution Fit (User trying to solve a problem YourBrandName addresses) ---
      "How can I solve [Problem YourBrandName Solves]?",
      "What are the best tools for [Task YourBrandName Helps With]?",
      "I'm looking for a way to [Achieve Goal YourBrandName Facilitates], any suggestions?",
    
      // --- Feature-Specific or Use-Case Queries ---
      "Does [YourBrandName] offer [Specific Feature]?",
      "How can I use [YourBrandName] for [Specific Use Case]?",
    
      // --- Competitor Comparison (Direct & Indirect) ---
      // Replace [Competitor A/B/C] with actual competitor names relevant to you.
      "What are alternatives to [Competitor A]?",
      "Compare [YourBrandName] and [Competitor B].",
      "Is [YourBrandName] better than [Competitor C] for [Specific Need]?",
    
      // --- Industry or Category Questions (Where YourBrandName should ideally be mentioned) ---
      "What are the leading companies in the [YourIndustry] sector?",
      "Recommend a good [Product/Service Category YourBrandName Belongs To].",
    
      // --- Negative or Challenging Queries (To see how AI handles them) ---
      "What are some downsides of using [YourBrandName]?",
      "Are there any common complaints about [YourBrandName]?",
    
      // --- Buying Intent / Recommendation Seeking ---
      "Should I choose [YourBrandName] for [Specific Purpose]?",
      "What's the best [Product/Service Category] for someone who needs [Specific Requirement]?",
    
      // --- Add more queries specific to your brand, product features, target audience pain points, and competitive landscape ---
      // Example: "How does [YourBrandName] handle [Unique Selling Proposition]?"
      // Example: "What are the pricing options for [YourBrandName]?"
    ];
    
    // Create output items
    const items = []
    for (let i = 0; i < queries.length; i++) {
      items.push({
        json: {
          brandName: brandName,
          query: queries[i],
          queryIndex: i + 1,
          timestamp: new Date().toISOString(),
          date: new Date().toISOString().split(&apos;T&apos;)[0]
        }
      });
    }
    
    return items;
    

Скриншот узла Code

Совет: измените brandName и массив queries под ваш бренд.

2.3 AI Interaction

Описание: Отправляет запросы в GPT-4o и получает ответы.

Настройки узла:

  • Тип: HTTP Request
  • Метод: POST
  • URL: https://api.openai.com/v1/chat/completions или https://api.vsegpt.ru/v1/chat/completions
  • Заголовки: Content-Type: application/json
  • Тело запроса:
    {
    	"model": "chatgpt-4o-latest",
    	"messages": [{"role": "user", "content": "={{ $json.query }}"}],
    	"max_tokens": 1000,
    	"temperature": 0.7
    }

Query ChatGPT Node

2.4 Response Processing

Описание: Проверяет ответы AI на наличие упоминаний бренда и обрабатывает ошибки.

Настройки узла:

  • Тип: Code (JavaScript)
  • Вход: Query ChatGPT
  • Выход: Save to Google Sheets

// Process the response and check for brand mentions
const httpResponse = $json; // This is the HTTP response
const originalQueries = $('Setup Queries').all(); // Get all original queries

// Find the matching original query for this response
// Since we're processing items one by one, we need to match by index
const currentIndex = $itemIndex; // Current item index
const originalData = originalQueries[currentIndex]?.json;

// Get brand name from original data
const brandName = originalData?.brandName?.toLowerCase() || 'unknown';

let response = '';
let brandMentioned = 'No';
let error = null;

// Check if there was an error
if (httpResponse.statusCode && httpResponse.statusCode !== 200) {
  response = `HTTP Error: ${httpResponse.statusCode} - ${httpResponse.statusMessage || 'Request failed'}`;
  brandMentioned = 'Error';
  error = `HTTP ${httpResponse.statusCode}`;
} else if (httpResponse.body && httpResponse.body.choices && httpResponse.body.choices[0]) {
  response = httpResponse.body.choices[0].message.content;
  // Check for brand mention (case insensitive)
  if (brandName && brandName !== 'unknown' && response.toLowerCase().includes(brandName)) {
    brandMentioned = 'Yes';
  }
} else if (httpResponse.body && httpResponse.body.error) {
  response = `API Error: ${httpResponse.body.error.message}`;
  brandMentioned = 'Error';
  error = httpResponse.body.error.message;
} else {
  response = 'No valid response received';
  brandMentioned = 'Error';
  error = 'Invalid response structure';
}

// Return combined data
return {
  json: {
    timestamp: originalData?.timestamp || new Date().toISOString(),
    date: originalData?.date || new Date().toISOString().split('T')[0],
    query: originalData?.query || 'Unknown query',
    queryIndex: originalData?.queryIndex || currentIndex + 1,
    brandName: originalData?.brandName || 'Unknown brand',
    response: response.substring(0, 500), // Limit response length
    brandMentioned: brandMentioned,
    error: error
  }
};

Process Response Node

2.5 Data Storage

Описание: Сохраняет результаты в Google Sheets.

Настройки узла:

  • Тип: Google Sheets
  • Операция: Append Rows
  • Документ: ваш Google Sheet
  • Лист: Sheet1
  • Креденшал: Google OAuth2

Save to Google Sheets Node

2.6 Reporting

Описание: Формирует HTML-отчет и отправляет его по email.

Настройки узлов:

  • Generate Email ReportCode node, создаёт HTML-таблицу с подсветкой упоминаний.
  • Send Email — Email node, отправляет письма через SMTP.

Generate Email Report Node

Send Email Node

3. Полезные ссылки

Теперь ваш workflow полностью автоматизирован:

  • отслеживает упоминания бренда,
  • ведет учет запросов и ошибок,
  • формирует наглядный HTML-отчет.

Скачать готовый workflow: Автоматический трекер упоминаний бренда с GPT-4, Google Sheets и Email

Наша компания предоставляет:

VPS и выделенные серверы в России и Европе, высокую скорость работы, круглосуточную поддержку.

Начните автоматизацию прямо сейчас — закажите VPS в Европе и создайте свой первый умный workflow с n8n и OpenAI!

Для реализации основных услуг и функций нашего сайта, а также для сбора данных о том, как посетители взаимодействуют с нашими сайтом, продуктами и услугами, мы применяем различные инструменты, включая файлы cookie. Нажимая «Принимаю», вы соглашаетесь с текущими правилами и условиями использования сайта и даете разрешение на использование этих данных. В противном случае, пожалуйста, покиньте сайт.

Сообщить об опечатке

Текст, который будет отправлен нашим редакторам: