### Example: Google Search with User Input Source: https://harpa.ai/chatml/steps-navigate This example shows how to use the ASK step to get user input for a search query and then use the NAVIGATE step to perform a Google search with that query. ```ChatML meta: title: Google Search description: '' category: User name: dhzk0aMdzfog3M-Jg_FI4 steps: - type: ask message: What would you like me to Google for you? param: p1 default: '' - type: navigate url: google.com/search?q={{p1}} waitForIdle: true version: 1 ``` -------------------------------- ### Example: Summarize Washington Post Articles Source: https://harpa.ai/chatml/steps-navigate An example of using the NAVIGATE step to go to a specific URL and then using the GPT step to summarize the content, extracting the three most recent articles. ```ChatML meta: title: WP:Technology summary description: '' category: User name: wp-technology-summary steps: - type: navigate url: https://www.washingtonpost.com/business/technology/ waitForIdle: true - type: gpt prompt: >- Please ignore all previous instructions. The output should be in {{language}}. Please analyze the data from the page and select the three most recent articles for me. Provide their brief summaries and links to them. Output format: ### Article Title with built-in link Brief summary in two sentences The Washington Post webpage: {{page}} version: 1 ``` -------------------------------- ### JUMP Step Examples Source: https://harpa.ai/chatml/steps-group-loop-jump Shows different ways to implement the JUMP step to transfer execution to a labeled step. Includes both full and short syntax. ```ChatML # full version - type: jump to: label-a # short version - jump: label-a ``` -------------------------------- ### Common ChatGPT Troubleshooting Guides Source: https://harpa.ai/chatml/troubleshooting Provides links to external guides addressing frequent issues encountered with ChatGPT, such as response limits, capacity errors, server errors, error codes, plugin issues, and SMS verification problems for both ChatGPT and ClaudeAI. ```APIDOC ChatGPT Troubleshooting Guides: - Title: How to Fix ChatGPT Too Many Responses in 1 Hour Link: https://harpa.ai/blog/how-to-fix-chatgpt-too-many-requests-error - Title: How to Fix ChatGPT is at Capacity Right Now Link: https://harpa.ai/blog/how-to-fix-chatgpt-is-at-capacity-error - Title: How to Fix ChatGPT Internal Server Error Link: https://harpa.ai/blog/how-to-fix-chatgpt-internal-server-error - Title: How to Fix ChatGPT Error 1020 Link: https://harpa.ai/blog/how-to-fix-chatgpt-error-1020 - Title: How to Fix ChatGPT Plugins Not Showing Up Link: https://harpa.ai/blog/how-to-fix-chatgpt-plugins-not-showing-up - Title: ChatGPT SMS verification Link: https://harpa.ai/blog/how-to-bypass-chatgpt-sms-verification - Title: ClaudeAI SMS verification Link: https://harpa.ai/blog/how-to-bypass-claude-ai-sms-verification ``` -------------------------------- ### Example Fruit Data Array Source: https://harpa.ai/chatml/steps-group-loop-jump An example of a JSON array where each item represents a fruit with its name. This demonstrates another structure for list parameters in LOOP steps. ```json [ {"fruit": "Mango"}, {"fruit": "Pomegranate"}, {"fruit": "Lychee"}, {"fruit": "Kiwi"}, {"fruit": "Durian"}, {"fruit": "Feijoa"}, {"fruit": "Guava"}, {"fruit": "Papaya"}, {"fruit": "Carambola"}, {"fruit": "Longan"} ] ``` -------------------------------- ### Example YouTube Data Array Source: https://harpa.ai/chatml/steps-group-loop-jump An example of a JSON array containing YouTube video data, including URL, title, views, and publication time. This format is used with LOOP steps. ```json [{"url":"https://www.youtube.com/watch?v=B-8Is-2ocv0","title":"The 'Most Creative' Place In The World","views":470,"publishedTimeAgo":"2 weeks"},{"url":"https://www.youtube.com/watch?v=TAgLw1KKE34","title":"The Science of Storytelling","views":1221,"publishedTimeAgo":"3 months"},{"url":"https://www.youtube.com/watch?v=WRMncYn2bRg","title":"$695 Travel Credit Card: Worth the hype?","views":614,"publishedTimeAgo":"4 months"},{"url":"https://www.youtube.com/watch?v=uFuMzP9HE_E","title":"9/11 Survivor describes her escape from the 95th floor","views":2083495,"publishedTimeAgo":"5 months"},{"url":"https://www.youtube.com/watch?v=tbbo1pjA5j0","title":"I Bought A Billboard On Times Square","views":1334,"publishedTimeAgo":"6 months"},{"url":"https://www.youtube.com/watch?v=vrcQRq676Jg","title":"8h In United's Polaris Business Class (B777)","views":2352,"publishedTimeAgo":"7 months"}] ``` -------------------------------- ### Custom and Global Parameters Source: https://harpa.ai/chatml/parameters Demonstrates how to define and use custom parameters (e.g., {{p1}}, {{name}}) and global parameters (e.g., {{g.p1}}, {{g.email}}) for command customization and cross-command persistence. Includes examples of setting parameters via ASK or CALC steps and verifying them with SAY. ```ChatML CALC Set Parameter p1 = "custom_value" SAY {{p1}} CALC Set Parameter g.email = "user@example.com" SAY {{g.email}} ``` -------------------------------- ### Basic LOOP step setup Source: https://harpa.ai/chatml/steps-group-loop-jump Illustrates the basic setup of a LOOP step in Harpa AI ChatML. It shows how to add a LOOP step and set its 'list' parameter, with a default value of '{{list}}'. It also mentions editing child steps within the LOOP. ```harpa Add LOOP step to your custom command and set the list parameter value. By default, it will be _{{list}}_. Then, click **EDIT STEPS** button and drill down into the LOOP to edit child steps, which operate on the list item. ``` -------------------------------- ### ChatML File Export Example Source: https://harpa.ai/chatml/overview This snippet demonstrates how HARPA AI commands are exported and shared, typically as .YAML files, which contain the ChatML structure defining the automation flow. ```YAML # Example of a HARPA AI command in ChatML format command: name: "ExampleCommand" description: "An example of a HARPA AI command." steps: - step: SAY message: "Hello, world!" - step: ASK variable: "userName" prompt: "What is your name?" - step: SAY message: "Nice to meet you, {{userName}}!" ``` -------------------------------- ### GROUP Step Example Source: https://harpa.ai/chatml/steps-group-loop-jump Demonstrates how to use the GROUP step to combine multiple AI command steps. This is useful for organizing complex commands or creating iterative processes. ```ChatML - condition: '{{change}} = refine' type: group steps: - type: ask param: instructions message: >- What changes would you like me to make? - type: gpt prompt: >- Please rewrite your answer, taking into account my additional instructions. Provide a rewritten response. [Additional instructions]: {{instructions}} Rewritten response: ``` -------------------------------- ### Summing Values with JS Source: https://harpa.ai/chatml/steps-run-js This example demonstrates how to use the Run JS step to sum two user-provided numerical values. It prompts the user for two numbers, performs the addition using JavaScript, and displays the result. ```ChatML meta: title: Sum values description: '' category: User name: cmd-sum-values steps: - type: ask message: 'Please provide p1:' param: p1 default: '' - type: ask message: 'Please provide p2:' param: p2 default: '' - type: js code: return Number(args.p1) + Number(args.p2) args: p1, p2 param: sum - type: say message: The sum is {{sum}} version: 1 ``` -------------------------------- ### SAY Step in ChatML Source: https://harpa.ai/chatml/steps-say-ask-gpt The SAY step is used to display messages in the chat interface. It supports markdown syntax for rich text formatting. Examples show both full and short versions of the declaration. ```ChatML # full version - type: say message: Hello world! # short version - say: Hello world! ``` -------------------------------- ### HARPA AI Command Creation Source: https://harpa.ai/chatml/creating-custom-commands This section details the steps to create a custom AI command using HARPA.AI. It involves installing the Chrome extension, connecting to AI models like ChatGPT, Gemini, or Claude, and using the HARPA AI interface to build multi-step automations. ```APIDOC HARPA AI Command Creation: 1. Install HARPA AI Chrome Extension. 2. Connect to ChatGPT, Gemini, or Claude AI. 3. Open HARPA AI by clicking its icon or pressing Alt+A (Windows) / ^+A (Mac). 4. Access the AI chat interface, type '/', and click 'CREATE +'. 5. Customize the command by adding steps using the 'ADD STEP' button. 6. Save the command by clicking 'SAVE'. Key Concepts: - Commands: Custom multi-step AI-powered automations. - Automation Steps: Building blocks for commands (e.g., SAY, ASK, GPT, NAVIGATE, CLICK, EXTRACT, RUN JS). - Parameters: Custom inputs for commands. - AI Element Selectors: For targeting specific elements on a webpage. ``` -------------------------------- ### Extracting Data from Page with JS Source: https://harpa.ai/chatml/steps-run-js This example demonstrates extracting specific data, such as prices, from a web page using Harpa's parser API. It filters the parsed data to find items of type 'price' and returns their values and metrics. ```ChatML meta: title: Find prices description: '' category: User name: cmd-find-prices steps: - type: js code: |- const items = await $harpa.parser .parse(null, { extract: true }) return items .filter(i => i.type === 'price') .map(p => ({ value: p.value, metric: p.metric, })) param: prices - type: say message: 'Prices are: ```{{prices}}```' version: 1 ``` -------------------------------- ### Using LOOP step with item properties Source: https://harpa.ai/chatml/steps-group-loop-jump Demonstrates how to use the LOOP step to iterate over a list and access properties of each item using dot notation. The example shows a SAY step displaying the current item's 'fruit' property. ```harpa LOOP step list: _{{list}}_ steps: SAY: "🔄 LOOP: {{item.fruit}}" ``` -------------------------------- ### HARPA AI ChatML Scroll with JavaScript Source: https://harpa.ai/chatml/steps-click-paste-scroll Demonstrates how to use JavaScript within the RUN JS step in HARPA AI ChatML to perform various scrolling actions on a webpage. These examples are provided as alternatives until the native SCROLL step is implemented. ```javascript return $harpa.page.scroll() ``` ```javascript return $harpa.page.scroll('bottom') ``` ```javascript return $harpa.page.scroll('top') ``` ```javascript return $harpa.page.scroll({ y: 1000 }) ``` -------------------------------- ### Custom Command: Grammar Check with Conditions and Jumps Source: https://harpa.ai/chatml/conditions-and-jumps This example demonstrates creating a HARPA AI ChatML custom command. It includes a GPT step for grammar correction, a condition to check for selected text, a STOP step for empty selections, and ASK/GPT steps for text manipulation (expand/shorten) with jump logic for looping. ```APIDOC LABEL: START GPT: prompt: | Please ignore all previous instructions. I want you to only respond in {{language}}. Act as a professional editor, specializing in grammar and syntax correction. Your task is to examine the given text and fix any grammatical or syntactical errors without altering the original style and tone. Change as little as possible to make it correct, and ensure it's well written. [TEXT TO CORRECT]: {{selection}} Corrected Text: condition: "{{selection}} is not empty" STOP: condition: "{{selection}} is empty" label: "⛔️ STOP" value: "stop" ASK: label: "Choose an action:" options: - label: "⛔️ STOP" value: "stop" - label: "⬆️ EXPAND" value: "expand" - label: "⬇️ SHORTEN" value: "shorten" - label: "♻️ NEW TEXT" value: "new" GPT: prompt: "{{selection}}" condition: "{{option}} = expand" GPT: prompt: "{{selection}}" condition: "{{option}} = shorten" JUMP: condition: "{{option}} = expand or {{option}} = new" target_label: "START" ``` -------------------------------- ### Extract YouTube Video Links with RUN JS Source: https://harpa.ai/chatml/steps-run-js This example demonstrates a RUN JS step that extracts YouTube video links, titles, view counts, and publication times from a web page. It parses anchor tags with '/watch' in their href attribute and extracts relevant information from the 'aria-label' and 'title' attributes. ```javascript - type: js code: |- return Array .from(document.querySelectorAll('a[href*="/watch"]')) .map(a => { const ariaLabel = a.getAttribute('aria-label') || '' const viewsMatch = ariaLabel.match(/(\d[\d,]*) views/) const timeAgoMatch = ariaLabel.match(/views (.+) ago/) const url = new URL(a.href) return { url: 'https://www.youtube.com' + url.pathname + '?v=' + url.searchParams.get('v'), title: a.getAttribute('title') || a.innerText.trim(), views: viewsMatch ? parseInt(viewsMatch[1].replace(/,/g, '')) : null, publishedTimeAgo: timeAgoMatch ? timeAgoMatch[1].trim() : null } }) .filter(item => item.url.includes('/watch?v=') && item.views !== null && item.publishedTimeAgo !== null ) param: videos silent: true ``` -------------------------------- ### Conditional Stop and Group Execution Source: https://harpa.ai/chatml/steps-clear-stop This example demonstrates conditional logic using STOP and GROUP steps. It allows users to choose between finishing a task, translating to a default language, or translating to a custom language, with the STOP step ensuring proper termination after each path. ```ChatML - type: ask label: ask-for-change param: change options: - { label: '✅ DONE', value: 'no' } - { label: '🇫🇷 TRANSLATE TO FRENCH', value: 'french' } - { label: '🛠️ CUSTOM TRANSLATE', value: 'custom'} - condition: '{{change}} = no' type: stop - condition: '{{change}} = french' type: gpt prompt: >- Translate this text to French. Translated text: - condition: '{{change}} = french' type: jump to: ask-for-change - condition: '{{change}} = custom' type: group steps: - type: ask param: translate message: > Please specify target language: - type: gpt prompt: >- Please translate the answer you have written into the language I will specify below. Do not change the wording of the text; I only need the translation. [LANGUAGE]: {{translate}} Translated text: - type: stop ``` -------------------------------- ### Harpa AI ChatML Automation Steps Overview Source: https://harpa.ai/chatml/automation-steps Provides a comprehensive list and brief description of all available automation steps in Harpa AI ChatML. Each step is designed for a specific function within custom commands. ```APIDOC SAY, ASK, GPT: - Used to send messages to chat, ask for parameter values, and send AI requests. NAVIGATE: - Navigates the opened tab to a specific URL. WAIT: - Pauses command execution until the page stops updating, text or an element appears on the page, a JavaScript function returns true, or a timeout is reached. REQUEST: - Sends data to a Webhook, calls a remote API, or fetches web page HTML. CLICK, PASTE, SCROLL: - Interact with page elements: click elements, insert text into forms and inputs, and scroll. EXTRACT: - Retrieves content of web elements on the page. GROUP, LOOP, JUMP: - Control command flow: group steps, loop over data items, and jump to labeled steps. RUN JS: - Executes JavaScript code within the scope of the opened web page. COMMAND: - Calls other commands, enabling the creation of higher-order commands. CLEAR, STOP: - Manage chat history and terminate the current command. CALC: - Manipulate parameter values: set, modify, merge lists, and extract data. ``` -------------------------------- ### Importing AI Commands Source: https://harpa.ai/chatml/importing-custom-commands This section details the steps to import AI commands into HARPA AI. It involves opening the HARPA AI interface, typing '/', clicking the 'Import' button, and then dragging and dropping command files into the provided window. ```APIDOC Import AI Commands: 1. Open HARPA AI (Alt+A on Windows, ^+A on Mac). 2. Type '/' in the HARPA AI chat. 3. Click the 'Import' button. 4. Drag & drop command files into the window. 5. Click the 'Import' button to upload. ``` -------------------------------- ### ChatML Automation Steps Overview Source: https://harpa.ai/chatml/overview This section outlines the various automation steps available in ChatML for creating HARPA AI commands. These steps cover a wide range of actions from user interaction and AI requests to web navigation and data manipulation. ```APIDOC SAY, ASK, GPT: - SAY: Prints messages to the chat interface. - ASK: Prompts the user for input. - GPT: Sends AI requests to a language model. NAVIGATE: - NAVIGATE: Navigates the browser to a specified URL. CLICK, PASTE, SCROLL: - CLICK: Clicks on a specified element on the web page. - PASTE: Inserts text into a form field. - SCROLL: Scrolls the web page. REQUEST: - REQUEST: Fetches web page HTML content or calls remote APIs. EXTRACT: - EXTRACT: Scrapes and extracts structured data from web pages. GROUP, LOOP, JUMP: - GROUP: Groups a sequence of steps. - LOOP: Iterates over a dataset. - JUMP: Transfers control to another step or section. RUN JS: - RUN JS: Executes JavaScript code within the browser context. COMMAND: - COMMAND: Executes a predefined HARPA AI command. CLEAR, STOP: - CLEAR: Clears the chat or resets the command state. - STOP: Halts the execution of the current command. CALC: - CALC: Performs mathematical calculations. Conditions and Jumps: - Conditional logic for controlling the flow of automation steps. ``` -------------------------------- ### Add List Item Source: https://harpa.ai/chatml/steps-calc Appends a given value to the end of a list. Supports specifying the position (start, end, or specific index) for adding the item. ```ChatML # Add list item - type: calc func: list-add index: last list: list item: param ``` -------------------------------- ### Navigate Step Declaration Source: https://harpa.ai/chatml/steps-navigate Demonstrates the different ways to declare the NAVIGATE step in ChatML, including full and short versions, handling missing protocols, relative paths, and reloading the current page. ```ChatML # full version - type: navigate url: 'https://google.com' # short version - navigate: 'https://google.com' # missing protocol, https is assumed - navigate: 'google.com' # relative path - navigate: '/search' # reload opened page - navigate: '' ``` -------------------------------- ### Domain Name Generator ChatML Command Source: https://harpa.ai/chatml/steps-say-ask-gpt This ChatML command defines a custom workflow to generate domain name ideas. It first prompts the user for a topic or description using the 'ask' step and then uses the 'gpt' step to generate 20 domain name suggestions based on the input, focusing on search volume and availability. The 'language' parameter in the GPT prompt is dynamically set. ```chatml meta: title: Domain name generator description: '' category: User name: hdruHBqvUDI3t2ymTDqU4 steps: - type: ask param: p1 message: >- Enter your niche, product/service/business description, or leave empty to parse from page default: '{{page}}' - type: gpt prompt: >- Please ignore all previous instructions. I want you to respond only in {{language}}. Generate 20 domain name ideas for the given topic, niche or product/business/service description which have some search volume. Try to come up with domain names that are available and not already used by other companies. [TOPIC / NICE / PRODUCT / BUSINESS / SERVICE DESCRIPTION]: {{pi}] [DOMAIN NAMES LIST]: version: 1 ``` -------------------------------- ### ASK Step in ChatML Source: https://harpa.ai/chatml/steps-say-ask-gpt The ASK step allows for user interaction by prompting for input and storing it in a parameter. It supports default values, predefined options, and custom options. Parameter values can be referenced using {{param_name}}. ```ChatML # full version - type: ask param: p1 # short version - ask: p1 # default fallback value - ask: p1 default: '{{page}}' # choice of options - ask: option options: ['a', 'b', 'c'] # choice of options, with a custom one - ask: option options: ['a', 'b', 'c', '$custom'] # choice of options with labels and values - ask: option options: - { label: 'MAKE LONGER', value: 'make text longer' } - { label: 'MAKE SHORTER', value: 'make text shorter' } ``` -------------------------------- ### Filter List Items Source: https://harpa.ai/chatml/steps-calc Filters items within a list based on specified criteria, allowing either retention or exclusion of matched values. For example, retaining only rows where 'Name = John'. ```ChatML # Filter list items - type: calc func: list-filter list: list item: param match: '{ "name": John }' matched: retain ``` -------------------------------- ### Single Element Selection with $size Source: https://harpa.ai/chatml/ai-element-selectors This example demonstrates how to use the $size selector to ensure that exactly one element matching the CSS selector is found. If more or fewer than one element is found, the selector will return no elements. ```ChatML - $css: h1 - $size: 1 ``` -------------------------------- ### Range Selection with $size Source: https://harpa.ai/chatml/ai-element-selectors This example shows how to use the $size selector with both 'min' and 'max' parameters to specify a range for the number of elements found. The selector will only return elements if the count falls within this specified range (inclusive). ```ChatML - $css: a - $size: min: 1 max: 5 ``` -------------------------------- ### Hiding Elements by Text with JS Source: https://harpa.ai/chatml/steps-run-js This example shows how to hide HTML elements on a page that contain specific text. It prompts the user for text to hide, finds the corresponding elements using Harpa's query API, and removes them from the DOM. ```ChatML meta: title: Hide elements by text description: '' category: User name: cmd-hide-elements-by-text steps: - type: ask message: What to hide? param: text default: '' - type: js code: |- const elements = $harpa.query.run( { $text: args.text }, { mult: true }) elements.forEach(e => e.remove()) args: text version: 1 ``` -------------------------------- ### Set and Clone Parameters with Calc Step Source: https://harpa.ai/chatml/steps-calc Demonstrates how to set a parameter to a captured value (like URL) and clone existing parameters (like GPT responses or lists) using the 'set' and 'clone' functions within the Calc step. ```ChatML # Set parameter - type: calc func: set param: saved.url format: auto value: '{{url}}' # Clone parameter - type: calc func: clone from: gpt to: cloned.gpt ``` -------------------------------- ### GPT Step in ChatML Source: https://harpa.ai/chatml/steps-say-ask-gpt The GPT step sends a prompt to a Large Language Model and stores the response in a parameter. Prompts support parameter interpolation using double curly braces, e.g., {{parameter_name}}. ```ChatML # full version - type: gpt prompt: > Please ignore all previous instructions. Please provide 5 not so well known / surprising facts about {{p1}}. Format every fact: - [relevant fact emoji] [fact] Facts: param: gpt # short version - gpt: > Please ignore all previous instructions. Please provide 5 not so well known / surprising facts about {{p1}}. Format every fact: - [relevant fact emoji] [fact] Facts: ``` -------------------------------- ### HARPA AI ChatML Parameters Source: https://harpa.ai/chatml/parameters This section outlines the various parameters that can be injected into prompts within HARPA AI's ChatML. These parameters allow for dynamic content inclusion from web pages, user selections, and other sources to enhance AI interactions. ```APIDOC Page Parameters: {{page}}: Web page text content. Truncated for long pages. {{page url}}: Retrieves content from a specified URL. Blocks on LinkedIn.com and X.com. Supports JavaScript. {{page query}}: Scans page content for text semantically similar to a query. {{page limit=N}}: Specifies a limit in tokens or percentage of context window (e.g., 10%). Content Parameters: {{selection}}: Selected text on the web page. {{title}}: Web page title. {{desc}}: Web page meta description. {{url}}: Web page URL. {{domain}}: Web page domain. {{language}}: Language defined in app settings. {{transcript}}: YouTube video transcript with timestamps. {{transcriptPlain}}: YouTube video transcript without timestamps. Contextual Parameters: {{message x}}: Previous chat message (e.g., {{message 0}}, {{message -1}}). {{serp term}}: Queries the web for a term and returns top links. Supports search operators (e.g., {{serp running weight loss site:ncbi.nlm.nih.gov}}). {{gpt}}: Last GPT response. {{email}}: Parses email content from supported providers (Gmail, Outlook, Protonmail, Fastmail) into a JSON object with fields: user, sendTime, from, to, subject, content. {{thread}}: Parses messages/comments from threads (WhatsApp, Telegram, Discord, Reddit, Facebook, YouTube, X). {{view}}: Includes a screenshot of the opened page (requires Vision capabilities). {{cost}}: Cost of GPT requests in AI tokens. {{cost last}} for the last request. Grab Parameter for HTML Element Extraction: {{grab}}: Extracts values from HTML elements. Usage: {{grab}}: Extracts website body text. {{grab h1}}: Extracts text from h1 elements using CSS selector. {{grab //h1}}: Extracts text from h1 elements using XPath. {{grab Bring AI to your browser}}: Extracts text matching the provided string. Attribute Extraction (take=value): {{grab h1 take=innerText}}: Takes the innerText of h1. {{grab h1 take=textContent}}: Takes the textContent of h1. {{grab h1 take=id}}: Takes the id attribute of h1. {{grab h1 take=className}}: Takes the className attribute of h1. {{grab h1 take=class}}: Takes the class attribute of h1. {{grab h1 take=nodeName}}: Takes the nodeName of h1. {{grab h1 take=nodeType}}: Takes the nodeType of h1. {{grab h1 take=attributes}}: Takes all attributes of h1. {{grab h1 take=[class]}}: Takes the value of the 'class' attribute of h1. {{grab h1 take=styles}}: Takes the styles of h1. {{grab h1 take=(color)}}: Takes the value of the 'color' style of h1. {{grab h1 take=innerHTML}}: Takes the innerHTML of h1. {{grab h1 take=outerHTML}}: Takes the outerHTML of h1. {{grab a take=href}}: Takes the href attribute of anchor tags. {{grab input take=value}}: Takes the value attribute of input elements. Position Specification (at=value): {{grab a take=href at=first}}: Takes the href of the first anchor tag. {{grab a take=href at=last}}: Takes the href of the last anchor tag. {{grab a take=href at=0}}: Takes the href of the anchor tag at index 0. {{grab a take=href at=1}}: Takes the href of the anchor tag at index 1. {{grab h2 at=all}}: Takes all h2 elements. Parameter Phrasing Note: 'take' specifies an argument's value. Example: {{grab YouTube video transcript take=innerText}} extracts the text value of the entire element. Example 1: Search for 'GPT', get the text value of the first element. Example 2: Ask for all elements, receive an array. ``` -------------------------------- ### ChatML Structure and Parameters Source: https://harpa.ai/chatml/overview This documentation describes the fundamental structure of ChatML, a markup language for HARPA AI commands, and the role of parameters in managing data flow between automation steps. ```APIDOC ChatML: - A human-readable format for declaring chat dialog flows and automations. - Stored in .YAML files. - Facilitates adoption of page-aware OpenAI GPT dialogs and personalized web automations. Parameters: - Used to store data and pass it between automation steps. - Can store user input, AI responses, extracted data, etc. - Most steps read from and write to parameters. ``` -------------------------------- ### Page Context Parameter Usage Source: https://harpa.ai/chatml/parameters Details how the {{page}} parameter can be used to manage web page content within GPT's token limits. It explains automatic truncation and how to specify keywords to extract relevant portions of the page. ```ChatML GPT {{page Adobe Photoshop}} ``` -------------------------------- ### ProtonMail Login Automation Source: https://harpa.ai/chatml/steps-click-paste-scroll This ChatML script automates the ProtonMail login process. It includes navigating to the login URL, pasting the email and password into the respective fields using AI-based selectors, and then clicking the submit button. The `onFailure: skip` setting ensures that if an element is not found, the script continues to the next step. ```ChatML meta: title: ProtonMail Login description: '' category: User name: pqiqyO9Tl7blDTycH14sM steps: - type: navigate url: https://account.proton.me/login waitForIdle: true - type: paste text: harpa.ai@protonmail.com selectorType: ai selector: - $matches: - $tag: INPUT - $id: username - $class: input-element - $class: w100 - $attribute: autocomplete=username - $attribute: autocapitalize=off - $attribute: autocorrect=off - $attribute: spellcheck=false - $attribute: aria-invalid=false - $attribute: aria-describedby=id-3 - $attribute: value - $attribute: data-last-active-input - $testId: input-input-element - $style: '"Inter var":14px:400:normal' - $role: form traverse: '2:1:0:0:0' - $class: sign-layout-main-content traverse: '0:2:1:0:0:0' - $class: ui-standard traverse: '1:0:2:1:0:0:0' - $class: sign-layout traverse: '1:0:2:1:0:0:0' - $class: shadow-color-primary traverse: '1:0:2:1:0:0:0' - $anchor: Email or username shift: '17:36' - $text: Email or username traverse: '-2:1:0:0:0' - $anchor: Password shift: 17:-61 - $text: Password traverse: '-3:2:1:0:0:0' - $anchor: Enter your Proton Account details. shift: '17:80' - $text: Enter your Proton Account details. traverse: '-2:1:0:2:1:0:0:0' min: 11 - $size: 1 item: type: element container: __$ht: element id: 1 value: Element showMore: false onFailure: skip waitForIdle: false - type: paste text: YouWontGuessThisOne selectorType: ai selector: - $matches: - $tag: INPUT - $role: textbox - $id: password - $class: input-element - $class: w100 - $attribute: autocomplete=current-password - $attribute: autocapitalize=off - $attribute: autocorrect=off - $attribute: spellcheck=false - $attribute: aria-invalid=false - $attribute: aria-describedby=id-4 - $attribute: type=text - $attribute: value - $attribute: data-last-active-input - $testId: input-input-element - $style: '"Inter var":14px:400:normal' - $role: form traverse: '3:1:0:0:0' - $class: sign-layout-main-content traverse: '0:3:1:0:0:0' - $class: ui-standard traverse: '1:0:3:1:0:0:0' - $class: sign-layout traverse: '1:0:3:1:0:0:0' - $class: shadow-color-primary traverse: '1:0:3:1:0:0:0' - $anchor: Password shift: '17:36' - $text: Password traverse: '-2:1:0:0:0' - $anchor: Keep me signed in shift: '-11:-60' - $text: Keep me signed in traverse: '-4:3:1:0:0:0' - $anchor: >- Not your device? Use a private browsing window to sign in and close it when done. Learn more shift: '-11:-80' - $text: >- Not your device? Use a private browsing window to sign in and close it when done. Learn more traverse: '-3:3:1:0:0:0' min: 11 - $size: 1 item: type: element container: __$ht: element id: 2 value: Element showMore: false onFailure: skip waitForIdle: false - type: click selectorType: ai selector: - $matches: - $tag: BUTTON - $role: button - $class: button - $class: w100 - $class: button-large - $class: button-solid-norm - $class: mt-6 - $attribute: aria-busy=false - $attribute: type=submit - $style: '"Inter var":16px:400:normal' - $content: Sign in - $role: form traverse: '5' - $class: sign-layout-main-content traverse: '0:5' - $class: ui-standard traverse: '1:0:5' - $class: sign-layout traverse: '1:0:5' - $class: shadow-color-primary traverse: '1:0:5' ``` -------------------------------- ### Harpa AI CLICK Step Source: https://harpa.ai/chatml/steps-click-paste-scroll The CLICK step simulates a mouse button press on a specified interface element. It utilizes AI Element Selectors to locate the target element, which can be done via the 'Grab' button or manual YAML configuration. The step includes options for failure handling and waiting for element readiness. ```ChatML - type: click selectorType: ai selector: null item: null showMore: false onFailure: skip waitForIdle: true ``` ```ChatML - type: click selectorType: ai selector: - $matches: - $tag: A - $role: link - $class: Button - $class: GetPluginButton - $attribute: href=https://get.harpa.ai - $attribute: target=_blank - $attribute: type=button - $style: Poppins:24px:500:normal - $content: ADD TO BROWSER - $class: LandingHero__buttonContainer traverse: '0' - $class: LandingHero__content traverse: '0:1:0' - $class: LandingHero traverse: '0:0:1:0' - $class: LandingContent traverse: '0:2:0:0:1:0' - $class: Page__content traverse: '0:0:2:0:0:1:0' - $anchor: > Bring AI to your browser. Chat with websites, PDFs, videos, write emails, SEO articles, tweets, automate workflows, monitor prices & data. Bing AI & Notion AI alternative. shift: '-12:-106' - $text: > Bring AI to your browser. Chat with websites, PDFs, videos, write emails, SEO articles, tweets, automate workflows, monitor prices & data. Bing AI & Notion AI alternative. traverse: '-1:1:0' - $anchor: '#1' shift: '18:250' - $text: '#1' traverse: '-2:1:0' - $anchor: AI AUTOMATION AGENT FOR CHROME shift: '-40:250' - $text: AI AUTOMATION AGENT FOR CHROME traverse: '-2:1:0' min: 9 - $size: 1 showMore: false onFailure: skip waitForIdle: true ``` -------------------------------- ### JUMP Step with Label for Loop Source: https://harpa.ai/chatml/steps-group-loop-jump Demonstrates how to create a potential infinite loop using the JUMP step by referencing a label that points back to itself. ```ChatML - say: Hello world! label: infinite - jump: infinite ``` -------------------------------- ### HARPA AI JavaScript API Source: https://harpa.ai/chatml/steps-run-js This section outlines the available JavaScript API provided by HARPA AI within the RUN JS step. It includes methods for interacting with the web page, such as clicking elements, scrolling, parsing data, querying elements, fetching resources, and waiting for page idle states. ```APIDOC $harpa.page.click: Clicks elements on the page. $harpa.page.scroll: Scrolls the page up and down. $harpa.page.parse: Parses data from the page. $harpa.page.query: Queries elements on the page (e.g., by text content, CSS selectors). $harpa.page.fetch: Sends data over HTTP or requests HTTP resources. $harpa.page.idle: Waits for the page to stop updating. $harpa.inspector.*: Provides methods to inspect document nodes. ``` -------------------------------- ### Harpa AI Element Selectors Cheat Sheet Source: https://harpa.ai/chatml/ai-element-selectors Provides a quick reference for common AI Element Selectors used in Harpa AI, including text-based, anchor-based, CSS, XPath, parsing, positional, and ARIA role selectors. ```APIDOC 1. Search elements containing text: My Account 2. Escaping numbers, dates, etc.: Total views: {{data}} 3. Find an element closest to $anchor: $anchor: username 4. CSS Selector $css: $css: div.views-count > span 5. XPath Selector $xpath: $xpath: //div/span 6. Parse number from element with $parse selector. Parse options include: number, date, time, prices, currency, text. - Total views: {{data}} - $parse: number 7. Take 4th matching element: - $css: h2 - $at: 3 8. ARIA role selector: $role: button ```