- type: ask
  param: input
  message: Send me a link, email, or start searching for data within a current webpage.
  options:
    - label: ✅ USE WEBPAGE
      value: start
    - $custom
  default: ''
  vision:
    enabled: false
    mode: area
    hint: ''
    send: true
  optionsInvalid: false
- type: group
  steps:
    - type: js
      args: input
      code: |-
        function extractDomain(input) {
            let domain;
            
            // Check if the input is a valid URL
            try {
                const url = new URL(input);
                domain = url.hostname; // Extract domain from URL
            } catch (e) {
                // If input is not a URL, assume it's an email
                const emailParts = input.split('@');
                if (emailParts.length > 1) {
                    domain = emailParts[1]; // Extract domain from email
                } else {
                    domain = null; // Not a valid URL or email
                }
            }
            
            return domain;
        }
        return extractDomain(input);
      param: link
      timeout: 15000
      onFailure: ''
      silent: true
    - type: navigate
      url: '{{link}}'
      waitForIdle: false
      silent: false
      onFailure: ''
    - type: wait
      for: 2s
      silent: true
  label: EXTRACT DOMAIN
  condition: '{{input}} != start'
- prompt: >-
    You are a Data Research AI Agent.
    Your task is to extract data from a web page and respond with JSON as
    requested.
    Follow these instructions:
    - Analyze the web page and all the information needed to fill the requested
    JSON fields:
    ```
    {
      "website": "{{url}}",
      "name": "official business name",
      "description": "Detailed description of the products or services offered by the business.",
      "industry": "Brief 1-2 word description of company industry, using common abbreviations, for example, 'SaaS', 'SEO', 'B2B Web Development', and others. Don't use the word 'industry' or 'agency.",
      "location": "Company address or any known location details, e.g.: country",
      "phone": "Phone number if found on the page", 
      "extraEmail": "Email address if found on the page, or 'Contact Form' if a contact form is present"
    }
    ```
    - If I haven't described criteria for determining the information for
    corresponding fields, decide this independently based on your judgment.
    - Respond in {{language}}.
    - Be concise and to the point.
    - Respond with a JSON, write nothing more.
    - Wrap your JSON response in a code block.
    Webpage URL: {{url}}
    Webpage Data: {{page}}
    Webpage Description: {{description}}
    JSON response:
  type: gpt
  param: json
  isolated: true
- type: calc
  func: extract-json
  to: json
  param: json
  index: ''
- message: |-
    The result is saved in the "**json**" parameter:
    {{json}}
  type: say
  interpolate: true
All rights reserved © HARPA AI TECHNOLOGIES LLC, 2021 — 2025
Designed and engineered in Finland 🇫🇮