AI AiLogin — Hướng Dẫn Tự Động Hóa & Tích Hợp API AiLogin — Workflow Automation & API Guide Tài liệu Người dùng User Guide

Hướng Dẫn Sử Dụng Workflow, Khối Lệnh & Tích Hợp API

Cẩm nang tra cứu dành cho người dùng AiLogin để thiết kế kịch bản tự động hóa không cần lập trình, làm chủ 65+ khối lệnh điều khiển trình duyệt, sử dụng Biến động & Bảng dữ liệu và kết nối với API / Webhook bên ngoài.

65+ Khối lệnh Tự động hóa 22 Toán tử Điều kiện & Vòng lặp Hỗ trợ CSS Selector & XPath tự động Tích hợp HTTP API, Webhook, ChatGPT & Gemini

Workflow Automation, Blocks & API Integration Guide

The official reference guide for AiLogin users to build no-code browser automation workflows, master all 65+ blocks, work with Dynamic Variables & Data Tables, and connect workflows to external HTTP APIs & Webhooks.

65+ Automation Blocks 22 Condition Operators & Loops Auto CSS Selector & XPath Detection HTTP API, Webhook, ChatGPT & Gemini

Tài liệu này dành cho người dùng AiLogin để thiết kế kịch bản tự động hóa (Workflow), tra cứu toàn bộ 65+ khối lệnh (Blocks), sử dụng hệ thống Biến động & Bảng dữ liệu, cũng như kết nối kịch bản với các dịch vụ API / Webhook bên ngoài.


1. Tổng Quan Cách Hoạt Động Của Kịch Bản (Workflow)#

Sơ đồ Luồng Thực thi Kịch bản Tự động hóa (Workflow Execution Flow)
Start Bắt đầu phiên Open URL / Switch Tab Nạp biến {{row.*}} Conditions / Loop Cổng: true / false / loop Click / Type / Extract Tương tác & Lấy dữ liệu API / Webhook / File Đồng bộ kết quả ra ngoài End Hoàn tất

Mỗi kịch bản tự động hóa trong AiLogin được xây dựng dưới dạng lưu đồ gồm các Khối lệnh (Nodes) và các Đường nối (Edges) quyết định thứ tự thực thi.

1.1. Các Cổng Kết Nối (Output Ports / Handles)#

Một khối lệnh có thể có một hoặc nhiều cổng đầu ra để điều hướng luồng chạy:

  • Luồng chính (default): Chạy bước tiếp theo sau khi khối lệnh hiện tại hoàn tất (hoặc sau khi vòng lặp đã chạy hết số lần quy định).
  • Nhánh Đúng / Sai (true / false): Dùng cho các khối kiểm tra như Element exists hoặc If / Else.
  • Nhánh Điều kiện (path_1, path_2, ... & fallback): Dùng cho khối Conditions. Hệ thống kiểm tra từ trên xuống dưới, nhánh nào thỏa mãn đầu tiên sẽ được chạy; nếu không nhánh nào đúng sẽ đi theo cổng fallback.
  • Thân Vòng lặp (loop): Dùng cho các khối Loop, Loop data, Loop elements, While loop. Các khối nối từ cổng loop sẽ được lặp đi lặp lại; khi kết thúc vòng lặp, kịch bản đi tiếp qua cổng default.
  • Nhánh Bắt lỗi (fallback trên khối lệnh thường): Nếu một thao tác (ví dụ: Click hoặc Chờ phần tử) gặp lỗi và bạn nối cổng fallback của khối đó sang một nhánh xử lý khác (như Chụp màn hình lỗi hoặc Tải lại trang), kịch bản sẽ tự động chạy nhánh fallback rồi tiếp tục thay vì dừng đột ngột.

1.2. Tùy Chọn Chung Trên Mỗi Khối Lệnh (settings)#

  • Bật / Tắt khối lệnh (enabled): Khi tắt (false), kịch bản sẽ bỏ qua khối lệnh đó và đi thẳng sang khối kế tiếp.
  • Tiếp tục khi lỗi (continueOnError): Khi bật (true), nếu khối lệnh gặp lỗi (ví dụ không tìm thấy phần tử), kịch bản vẫn tiếp tục chạy bước tiếp theo mà không báo thất bại.

2. Hệ Thống Biến Số & Bảng Dữ Liệu (Variables & Data Tables)#

Bạn có thể chèn giá trị của bất kỳ biến nào vào các ô nhập liệu (URL, Selector, Văn bản gõ, Nội dung API, Đường dẫn file...) bằng cú pháp {{ten_bien}}.

2.1. Quy Tắc Nội Suy Biến#

  • Chèn biến vào chuỗi: Ví dụ https://example.com/user/{{username}}/page/{{loop.iteration}}.
  • Truyền trực tiếp mảng / đối tượng: Trong các khối xử lý dữ liệu (split_data, sort_data, regex_variable), bạn có thể nhập trực tiếp tên biến (ví dụ myList) hoặc dùng {{myList}}.
  • Nếu tên biến chưa được khởi tạo, chuỗi {{ten_bien}} sẽ được giữ nguyên để giúp bạn dễ dàng nhận biết tên biến bị gõ sai.

2.2. Danh Sách Biến Hệ Thống Có Sẵn (Built-in Variables)#

Cú pháp biếnPhạm vi hoạt độngÝ nghĩa & Giá trị
{{profileId}}, {{profile.id}}Toàn kịch bảnMã định danh (ID) của hồ sơ trình duyệt đang chạy
{{profileName}}, {{profile.name}}Toàn kịch bảnTên của hồ sơ trình duyệt đang chạy
{{row.<ten_cot>}}Toàn kịch bản / Trong loop_dataGiá trị cột <ten_cot> của dòng dữ liệu gắn với hồ sơ (hoặc dòng hiện tại trong vòng lặp dữ liệu)
{{row.index}}Trong loop_dataVị trí dòng hiện tại (bắt đầu từ 0)
{{table.<TenBang>.<ten_cot>}}Toàn kịch bảnTruy cập nhanh giá trị cột <ten_cot> ở dòng đầu tiên của bảng dữ liệu <TenBang>
{{loop.index}}Trong mọi vòng lặpChỉ số vòng lặp hiện tại (đếm từ 0, 1, 2...)
{{loop.iteration}}Trong mọi vòng lặpThứ tự vòng lặp hiện tại (đếm từ 1, 2, 3...)
{{element.selector}}Trong loop_elementsSelector tự động trỏ tới đúng phần tử của lượt lặp hiện tại (dùng để điền vào khối Click, Extract text...)
{{element.index}}Trong loop_elementsChỉ số phần tử hiện tại (đếm từ 0)
{{element.iteration}}Trong loop_elementsThứ tự phần tử hiện tại (đếm từ 1)
{{element.text}}Trong loop_elementsNội dung văn bản bên trong phần tử hiện tại (tối đa 500 ký tự)
{{element.count}}Sau element_exists / loop_elementsTổng số lượng phần tử khớp với Selector trên trang
{{element.found}}Sau element_existsNhận giá trị true nếu tìm thấy phần tử, ngược lại là false
{{last_screenshot}}Sau screenshotĐường dẫn file ảnh chụp màn hình vừa được lưu trên máy tính

3. Cách Viết Selector (CSS / XPath) & Làm Việc Với Iframe#

3.1. Tự Động Nhận Diện CSS Selector và XPath#

Tất cả các ô nhập Selector trong AiLogin đều hỗ trợ cả CSS Selector lẫn XPath mà không cần chuyển đổi chế độ thủ công:

  • XPath: Khi chuỗi bắt đầu bằng dấu / hoặc (:
  • Ví dụ 1: //button[contains(text(), "Đăng nhập")]
  • Ví dụ 2: (//div[@class="product-card"])[1]//a
  • CSS Selector: Tất cả các chuỗi còn lại:
  • Ví dụ 1: input[name="email"]
  • Ví dụ 2: #login-form > button.btn-primary

3.2. Tương Tác Với Phần Tử Nằm Trong <iframe>#

Mặc định các khối lệnh tìm kiếm phần tử trên trang chính. Nếu phần tử nằm bên trong một khung nhúng <iframe> (ví dụ khung thanh toán, khung captcha, trình soạn thảo):

  1. Dùng khối Switch frame (switch_to) với chế độ iframe và nhập Selector của thẻ <iframe>.
  2. Thực hiện các khối lệnh Click, Type text, Extract text... như bình thường.
  3. Dùng lại khối Switch frame (switch_to) với chế độ main để quay về trang chính (hoặc parent để lùi ra 1 cấp khung nhúng).

4. Tra Cứu Chi Tiết 65+ Khối Lệnh (Workflow Blocks)#

Nhóm A: Điều Khiển Luồng & Kịch Bản Con (Control & Sub-Workflows)#

Mã khối (type)Tên khối lệnhTham số cấu hình (data)Chức năng & Kết quả đầu ra
startStart(Không có)Điểm bắt đầu của kịch bản. Mỗi kịch bản có duy nhất 1 khối Start.
endEnd(Không có)Kết thúc kịch bản ngay lập tức với trạng thái Hoàn thành (success).
execute_workflowExecute workflow- workflowId / value: ID hoặc tên kịch bản con
- shareVariables: true / false (mặc định false)
- outputKey: Tên biến nhận kết quả (mặc định subWorkflow)
Gọi chạy một kịch bản khác bên trong kịch bản hiện tại (hỗ trợ lồng tối đa 5 cấp). Nếu bật shareVariables, kịch bản con dùng chung bộ biến với kịch bản cha; nếu tắt, kết quả đầu ra của kịch bản con sẽ lưu vào biến outputKey.
workflow_stateWorkflow state- value: stop_currentstop_all
- excludeCurrent: true / false
block_groupBlocks group- blocks: Danh sách các khối lệnh conGom nhiều bước thực thi tuần tự vào chung 1 khối gọn gàng trên màn hình thiết kế.
noteNote- value: Nội dung ghi chú
- color, fontSize
Thẻ ghi chú trực quan trên bảng thiết kế, không ảnh hưởng tới quá trình chạy.

Nhóm B: Điều Kiện Rẽ Nhánh & Vòng Lặp (Conditions & Loops)#

Mã khối (type)Tên khối lệnhTham số cấu hình (data)Cổng ra & Hành vi chi tiết
conditionsConditions- paths: Danh sách các nhánh điều kiện (mỗi nhánh gồm nhiều dòng điều kiện kết hợp bằng and / or)Kiểm tra lần lượt từng nhánh. Nhánh đầu tiên thỏa mãn sẽ chạy theo cổng mang ID của nhánh đó. Nếu không nhánh nào đúng, kịch bản chạy theo cổng fallback.
ifIf / Else- conditionLeft: Giá trị trái / Selector
- conditionOperator: Toán tử so sánh
- conditionRight: Giá trị phải
- timeoutMs: Thời gian chờ (mặc định 8000 ms)
Kiểm tra 1 điều kiện đơn. Nếu đúng đi theo cổng true, nếu sai đi theo cổng false.
element_existsElement exists- selector: CSS hoặc XPath
- timeoutMs: Thời gian chờ tối đa (mặc định 0 ms)
- visibleOnly: Chỉ tính phần tử đang hiển thị (true/false)
Kiểm tra phần tử có xuất hiện trên trang hay không. Lưu kết quả vào {{element.found}} và số lượng vào {{element.count}}, sau đó rẽ nhánh qua cổng true hoặc false.
loopLoop- loopCount: Số lần lặp (1 – 1,000,000, mặc định 2)Lặp lại nhánh nối ở cổng loop đúng loopCount lần. Cung cấp biến {{loop.index}} và {{loop.iteration}}. Khi hoàn tất sẽ đi tiếp qua cổng default.
loop_dataLoop data- value: ID Bảng dữ liệu (DataTable)
- conditionLeft: Chế độ duyệt (all
one
loop_elementsLoop elements- selector: CSS hoặc XPath
- loopCount: Số phần tử tối đa (0 = lặp hết tất cả)
Tìm tất cả phần tử khớp selector trên trang và duyệt qua từng phần tử ở cổng loop. Trong thân vòng lặp, hãy dùng {{element.selector}} để tương tác với đúng phần tử của lượt lặp đó và {{element.text}} để đọc nội dung.
while_loopWhile loop- conditionLeft, conditionOperator, conditionRight
- loopCount: Giới hạn tối đa (mặc định 1000)
- delayMs: Nghỉ giữa 2 lần lặp (ms)
Lặp lại cổng loop chừng nào điều kiện còn đúng (tối đa loopCount lần để tránh lặp vô tận).
loop_breakBreak- conditionLeft, conditionOperator, conditionRight (tùy chọn)Thoát ngay khỏi vòng lặp hiện tại và chuyển sang cổng default của vòng lặp. Nếu không điền điều kiện thì luôn luôn thoát.
loop_continueContinue- conditionLeft, conditionOperator, conditionRight (tùy chọn)Bỏ qua các bước còn lại của lượt lặp hiện tại và chuyển ngay sang lượt lặp kế tiếp.

Bảng 22 Toán Tử Điều Kiện (conditionOperator)#

  • So sánh văn bản: equals (bằng tuyệt đối), equals_ci (bằng không phân biệt hoa/thường), not_equals (khác), not_equals_ci, contains (chứa chuỗi), contains_ci, not_contains (không chứa), not_contains_ci, starts_with (bắt đầu bằng), ends_with (kết thúc bằng), regex_match (khớp biểu thức chính quy RegExp).
  • So sánh số học: greater_than (>), greater_equal (>=), less_than (<), less_equal (<=).
  • Kiểm tra dữ liệu: exists (có giá trị / khác rỗng), not_exists (trống), is_truthy (khác false, 0, null, undefined, no), is_falsy.
  • Kiểm tra phần tử trên trang web (vế trái nhập CSS hoặc XPath Selector):
  • element_exists: Phần tử có tồn tại trong cây HTML.
  • element_not_exists: Phần tử không tồn tại.
  • element_visible: Phần tử đang hiển thị rõ trên màn hình (có kích thước > 0 và không bị ẩn).
  • element_hidden: Phần tử đang bị ẩn hoặc không tồn tại.

Nhóm C: Điều Hướng Trình Duyệt, Quản Lý Tab, Cửa Sổ & Khung Nhúng#

Mã khối (type)Tên khối lệnhTham số cấu hình (data)Chức năng & Kết quả đầu ra
open_urlOpen URL- url: Địa chỉ trang web (hỗ trợ {{var}})
- openNewTab: Mở trong tab mới (true/false)
- waitLoad: Chờ tải xong (true/false)
Truy cập địa chỉ url trên tab hiện tại hoặc mở sang một tab mới.
open_tabOpen tab- url: Địa chỉ trang web (tùy chọn)Mở thêm một tab mới và chuyển quyền điều khiển sang tab đó.
new_windowNew window- url: Địa chỉ trang web (tùy chọn)
- waitLoad: true/false
Mở một cửa sổ trình duyệt tách biệt mới (hỗ trợ trên nhân Chromium).
switch_tabSwitch tab- mode: indexurl
close_tabClose tab- mode: activeurl_pattern
- value: Chuỗi URL cần đóng (khi chọn url_pattern)
- closeAllWindows: Đóng tất cả (true/false)
get_info_tabsGet info tabs- outputKey: Tên biến nhận (mặc định tabs)Lấy danh sách thông tin tất cả các tab đang mở ([{ index, url, title, active }]) lưu vào biến outputKey.
wait_tab_loadWait tab load- timeoutMs: Thời gian chờ tối đa (mặc định 15000 ms)Đợi cho tới khi trang web tải hoàn tất (readyState === 'complete').
switch_toSwitch frame- value: iframeparent
reloadReload(Không có)Tải lại (F5) trang web hiện tại.
go_backGo back(Không có)Quay lại trang trước đó trong lịch sử duyệt web.
go_forwardGo forward(Không có)Tiến tới trang tiếp theo trong lịch sử duyệt web.
zoom_pageZoom page- value: Tỷ lệ thu phóng (ví dụ 80% hoặc 1.2, mặc định 100%)Thay đổi tỷ lệ thu phóng giao diện trang web và giữ nguyên mức phóng này khi chuyển trang.

Nhóm D: Tương Tác Chuột, Bàn Phím & Chờ Đợi (Interaction & Waiting)#

Mã khối (type)Tên khối lệnhTham số cấu hình (data)Chức năng & Kết quả đầu ra
clickClick- targetMode: element (theo Selector)coordinates (theo tọa độ)
- selector: CSS/XPath
- value: Tọa độ x, y (khi chọn coordinates)
- clickType: left
click_randomClick Random Element- selector: Selector chính
- selectors: Các Selector phụ (mỗi dòng 1 selector)
- randomMode: random (ngẫu nhiên)
sequential (tuần tự theo vòng lặp)
- clickType: left
double_clickDouble click- selector: CSS/XPath
- timeoutMs: Mặc định 10000 ms
Nhấp đúp chuột trái vào phần tử.
right_clickRight click- selector: CSS/XPath
- timeoutMs: Mặc định 10000 ms
Nhấp chuột phải vào phần tử.
mouse_moveMouse move- selector: CSS/XPath (tùy chọn)
- value: Tọa độ x, y (tùy chọn)
Đưa con trỏ chuột tới vị trí phần tử hoặc tọa độ chỉ định trên màn hình.
hoverHover- selector: CSS/XPath
- timeoutMs: Mặc định 10000 ms
Di chuột đè lên phần tử để kích hoạt menu ẩn hoặc hiệu ứng mouseover.
typeType text- selector: CSS/XPath
- value: Nội dung văn bản cần gõ (hỗ trợ {{var}})
- clearBefore: Xóa nội dung cũ trước khi gõ (true/false)
- typingDelay: Độ trễ giữa từng phím gõ (ms, 0 = chèn tức thì)
- timeoutMs: Mặc định 10000 ms
Nhập văn bản vào ô input/textarea. Đặt typingDelay từ 30 – 80 ms nếu muốn mô phỏng tốc độ gõ phím tự nhiên của con người.
clear_inputClear input- selector: CSS/XPath
- timeoutMs: Mặc định 10000 ms
Xóa sạch nội dung đang có trong ô nhập liệu.
press_keyPress key- selector: CSS/XPath (tùy chọn — focus trước khi bấm)
- value: Tên phím hoặc chuỗi tổ hợp phím (mặc định Enter)
Nhấn phím đơn (Enter, Tab, Escape, Backspace, ArrowDown...), tổ hợp phím (Ctrl+A, Shift+Enter), hoặc nhiều phím liên tiếp cách nhau bởi dấu phẩy (Ctrl+A, Backspace, Enter).
select_optionSelect option- selector: CSS/XPath của thẻ <select>
- value: Giá trị value hoặc chữ hiển thị của mục cần chọn
Chọn một mục trong danh sách thả xuống (<select>).
scrollScroll Element- selector: Mặc định html (cuộn toàn trang)
- scrollHorizontal, scrollVertical: Khoảng cách cuộn (px)
- scrollIntoView: Cuộn đưa phần tử vào khung nhìn (true/false)
- smoothScroll: Cuộn mượt (true/false)
- incrementVertical: Cộng dồn khoảng cách cuộn (true/false)
Cuộn trang web hoặc vùng danh sách theo số pixel chỉ định, hoặc cuộn tới khi phần tử mục tiêu hiện ra giữa màn hình.
upload_fileUpload file- selector: CSS/XPath của thẻ <input type="file">
- value: Đường dẫn file trên máy tính (nhiều file cách nhau bằng xuống dòng hoặc dấu phẩy)
Đính kèm một hoặc nhiều tập tin từ máy tính lên biểu mẫu tải file của trang web.
wait_timeWait time- value: Số mili-giây cố định (ví dụ 2000) hoặc khoảng ngẫu nhiên min,max (ví dụ 1000,3500)Tạm dừng kịch bản trong khoảng thời gian chỉ định. Khuyên dùng dạng khoảng min,max để thời gian nghỉ tự nhiên hơn.
wait_selectorWait selector- selector: CSS/XPath
- timeoutMs: Mặc định 10000 ms
Chờ cho tới khi phần tử xuất hiện trên trang (báo lỗi nếu quá thời gian timeoutMs).
wait_connectionsWait connections- durationMs: Mặc định 10000 msChờ cho tới khi các kết nối mạng ngầm (AJAX/Fetch) trên trang tải xong.
download_waitWait download- durationMs: Thời gian chờ tối đa (mặc định 30000 ms)
- outputKey: Mặc định downloadedFile
Đợi file tải xuống hoàn tất và lưu đường dẫn file vừa tải vào biến outputKey.
handle_dialogHandle dialog- value: accept (Đồng ý)dismiss (Hủy bỏ)
- promptText: Văn bản điền vào hộp thoại prompt()
cookieCookie- value: getset
create_elementCreate element- selector: Phần tử cha (trống = document.body)
- value: Vị trí chèn (firstChild
lastChild

Nhóm E: Trích Xuất Dữ Liệu Trang Web & Chụp Màn Hình (Extraction & Evaluation)#

Mã khối (type)Tên khối lệnhTham số cấu hình (data)Chức năng & Kết quả đầu ra
extract_textExtract text- selector: CSS/XPath
- timeoutMs: Mặc định 10000 ms
- outputKey: Mặc định text
Lấy nội dung chữ (textContent) của phần tử và lưu vào biến outputKey.
extract_attributeExtract attribute- selector: CSS/XPath
- value: Tên thuộc tính (mặc định href, ví dụ src, value, data-id)
- timeoutMs: Mặc định 10000 ms
- outputKey: Mặc định attribute
Lấy giá trị thuộc tính HTML của phần tử và lưu vào biến outputKey.
extract_htmlExtract HTML- selector: CSS/XPath (để trống = lấy toàn bộ trang)
- timeoutMs: Mặc định 10000 ms
- outputKey: Mặc định html
Lấy mã nguồn HTML bên trong phần tử (hoặc toàn trang web) và lưu vào biến outputKey.
get_titleGet title- outputKey: Mặc định pageTitleLấy tiêu đề của tab hiện tại lưu vào biến outputKey.
get_current_urlGet URL- mode: active (tab hiện tại)all (tất cả các tab)
- filterType: none
screenshotScreenshot- source: viewport (khung nhìn)fullpage (toàn trang)
run_jsRun JS- script: Đoạn mã JavaScript cần chạy trên trang
- outputKey: Tên biến nhận kết quả trả về
Chạy mã JavaScript trực tiếp trên trang web (hỗ trợ cả async/await và return). Kết quả trả về được lưu vào biến outputKey.

Nhóm F: Biến Số, Xử Lý Chuỗi/Mảng & Sinh Dữ Liệu Ngẫu Nhiên#

Mã khối (type)Tên khối lệnhTham số cấu hình (data)Chức năng & Kết quả đầu ra
set_variableSet variable- outputKey: Tên biến cần gán
- value: Giá trị
- valueType: string
number
get_variableGet variable- value: Biểu thức nguồn (ví dụ {{row.email}})
- outputKey: Tên biến đích
Sao chép giá trị sang biến outputKey.
increase_variableIncrease variable- selector: Tên biến số cần tăng
- value: Giá trị cộng thêm (mặc định 1, có thể nhập số âm để giảm)
Tăng hoặc giảm giá trị của một biến đếm.
insert_dataInsert data- outputKey: Tên biến (mặc định data)
- value: Giá trị cần thêm
- mode: set (ghi đè)
append (thêm vào cuối danh sách)
delete_dataDelete data- selector: Tên biến cần xóaXóa biến khỏi bộ nhớ phiên chạy.
text_templateText template- script: Mẫu văn bản nhiều dòng có chứa {{var}}
- outputKey: Mặc định templated
Ghép nối các biến vào một đoạn văn bản mẫu hoàn chỉnh và lưu vào outputKey.
slice_variableSlice variable- selector: Tên biến nguồn (chuỗi hoặc mảng)
- conditionLeft: Vị trí bắt đầu (start)
- conditionRight: Vị trí kết thúc (end, tùy chọn)
- outputKey: Mặc định sliced
Cắt lấy một đoạn ký tự hoặc một đoạn phần tử trong mảng và lưu vào outputKey.
split_dataSplit data- selector: Tên biến nguồn hoặc chuỗi
- value: Ký tự phân cách (mặc định ,, ví dụ `
, ;, :)<br>- mode: all` (lấy cả mảng)
sort_dataSort data- selector: Tên biến mảng cần sắp xếp
- sortType: alpha (theo chữ cái)
numeric (theo con số)
- value: asc (tăng dần)
regex_variableRegEx variable- selector: Tên biến nguồn
- value: Biểu thức chính quy (Pattern, ví dụ \b\d{6}\b để lấy mã OTP 6 số)
- method: match (trích xuất)
replace (thay thế)
data_mappingData mapping- script: Cấu trúc JSON mẫu có chứa {{var}}
- outputKey: Mặc định mapped
Điền biến vào mẫu JSON và chuyển thành đối tượng dữ liệu lưu vào outputKey.
randomRandom- value: Loại dữ liệu cần sinh (number, text, digits, uuid, email, phone, first_name, last_name, full_name, username, password, city, country, color, boolean, ipv4, domain, url, date)
- conditionLeft: Giá trị nhỏ nhất (Min) hoặc Độ dài
- conditionRight: Giá trị lớn nhất (Max)
- outputKey: Mặc định random
Tự động tạo dữ liệu ngẫu nhiên theo 19 định dạng thông dụng (Họ tên, Email, SĐT, Mật khẩu, UUID, Ngày sinh...) phục vụ đăng ký tài khoản hoặc điền biểu mẫu.
random_numberRandom number- conditionLeft: Min (mặc định 0)
- conditionRight: Max (mặc định 100)
- outputKey: Mặc định randomNumber
Sinh số nguyên ngẫu nhiên trong khoảng [Min, Max].
random_textRandom text- value: Độ dài chuỗi (mặc định 10)
- outputKey: Mặc định randomText
Sinh chuỗi ký tự chữ & số ngẫu nhiên có độ dài tùy chọn.
get_log_dataGet log data- outputKey: Mặc định logDataLấy toàn bộ lịch sử nhật ký chạy của kịch bản lưu vào biến outputKey.
clipboardClipboard- value: copy (ghi vào bộ nhớ tạm)copy_selection (sao chép văn bản đang bôi đen)
resource_statusResource status- status: ActiveInactive

Nhóm G: Bảng Dữ Liệu & Đọc/Ghi Tập Tin (CSV, Excel, JSON, Text)#

Mã khối (type)Tên khối lệnhTham số cấu hình (data)Chức năng & Kết quả đầu ra
csv_readCSV read- value: ID Bảng dữ liệu (DataTable)
- outputKey: Mặc định csvRows
Đọc toàn bộ các dòng của bảng dữ liệu CSV vào biến outputKey.
excel_readExcel read- value: ID Bảng dữ liệu (DataTable)
- outputKey: Mặc định excelRows
Đọc toàn bộ các dòng của bảng dữ liệu Excel vào biến outputKey.
set_row_valueSet row value- selector: Tên cột cần cập nhật
- value: Giá trị mới
Cập nhật giá trị cột của dòng hiện tại trong Bảng dữ liệu (ví dụ: ghi cột status = "Đã đăng nhập").
save_row_resultSave row result(Không có)Lưu toàn bộ các biến kết quả hiện tại thành 1 bản ghi để xuất báo cáo cuối phiên.
export_csvExport CSV- value: Đường dẫn file .csv muốn xuất ra máy tínhXuất các dòng kết quả đã thu thập bằng save_row_result ra file CSV.
csv_writeCSV write- value: Đường dẫn file .csv
- script: Chuỗi JSON của dòng cần ghi (ví dụ {"email":"{{email}}","status":"OK"})
Ghi nối thêm (append) một hoặc nhiều dòng dữ liệu mới vào file CSV trên máy tính.
excel_writeExcel write- value: Đường dẫn file .xlsx
- selector: Tên Sheet (mặc định Sheet1)
- script: Chuỗi JSON của dòng cần ghi
Ghi nối thêm một dòng dữ liệu mới vào file Excel .xlsx.
json_readJSON read- value: Đường dẫn file .json
- outputKey: Mặc định jsonData
Đọc file JSON từ máy tính và nạp thành đối tượng trong biến outputKey.
json_writeJSON write- value: Đường dẫn file .json
- script: Nội dung JSON hoặc biến {{data}}
Lưu dữ liệu ra file .json trên máy tính.
read_file_textRead file text- value: Đường dẫn file .txt
- mode: all_text (toàn bộ)
all_lines (mảng các dòng)
file_actionFile action- value: writeappend
save_assetsSave asset- selector: Selector của thẻ <img>, <video>, <audio>, <a>
- url: Hoặc đường dẫn URL trực tiếp của file
- value: Tên file muốn lưu (ví dụ avatar.png)
- outputKey: Mặc định savedAsset
Tải hình ảnh, video hoặc tài nguyên ngay trong phiên trình duyệt (giữ nguyên trạng thái đăng nhập/Cookie của trang) và lưu về máy tính.

Nhóm H: Tích Hợp API Bên Ngoài, Webhook & Đổi Proxy Động (Network & Proxy)#

Mã khối (type)Tên khối lệnhTham số cấu hình (data)Chức năng & Kết quả đầu ra
api_requestAPI request- url: Địa chỉ API Endpoint (hỗ trợ {{var}})
- value: Phương thức (GET
POST
browser_requestBrowser request- url: Địa chỉ URL
- value: GET
POST
webhookWebhook- url: Địa chỉ Webhook nhận dữ liệu
- script: Nội dung JSON cần gửi (mặc định {})
Đẩy thông báo hoặc kết quả thu thập được (qua POST JSON) về Telegram Bot, Discord, Lark, n8n, Make, Zapier hoặc hệ thống quản lý của bạn.
proxyChange proxy- mode: stored (chọn từ kho Proxy đã lưu)manual (nhập tay)

Nhóm I: Trí Tuệ Nhân Tạo (AI) & Lệnh Hệ Thống#

Mã khối (type)Tên khối lệnhTham số cấu hình (data)Chức năng & Kết quả đầu ra
chatgptChatGPT- value: Tên model (mặc định gpt-4o-mini)
- systemPrompt: Vai trò / Chỉ dẫn hệ thống
- script: Nội dung yêu cầu (Prompt, hỗ trợ {{var}})
- temperature: Độ sáng tạo (0 – 2, mặc định 0.7)
- outputKey: Mặc định ai_result
Gọi OpenAI ChatGPT để tự động viết nội dung bài đăng, bình luận, dịch thuật hoặc phân tích dữ liệu trang web và lưu kết quả vào biến outputKey.
geminiGemini- value: Tên model (mặc định gemini-1.5-flash)
- systemPrompt: Vai trò / Chỉ dẫn hệ thống
- script: Nội dung yêu cầu (Prompt)
- temperature: Mặc định 0.7
- outputKey: Mặc định ai_result
Gọi Google Gemini AI để sinh văn bản hoặc xử lý dữ liệu thông minh và lưu vào biến outputKey.
cmdCmd- script: Câu lệnh Windows Command Prompt
- regex: Biểu thức RegExp lọc kết quả đầu ra (tùy chọn)
- outputKey: Mặc định shellOutput
Chạy lệnh CMD trên máy tính (ví dụ: đổi IP Dcom/HMA, gọi công cụ dòng lệnh bên ngoài) và lưu kết quả trả về vào outputKey.
powershellPowerShell- script: Câu lệnh Windows PowerShell
- outputKey: Mặc định shellOutput
Chạy lệnh PowerShell trên máy tính và lưu kết quả trả về vào outputKey.

5. Cấu Trúc File Kịch Bản (.ailogin / JSON) & Ví Dụ Mẫu#

Bạn có thể xuất kịch bản ra file .ailogin (định dạng JSON chuẩn) để chia sẻ, sao lưu hoặc tự sinh kịch bản hàng loạt bằng công cụ bên ngoài rồi nhập (Import) vào AiLogin.

5.1. Cấu Trúc JSON Chuẩn Của Một Kịch Bản#

JSON
{
  "name": "Đăng nhập & Lấy mã OTP qua API",
  "description": "Kịch bản mẫu kết hợp kiểm tra phần tử, gọi API lấy OTP và gửi kết quả về Webhook",
  "nodes": [
    {
      "id": "start_1",
      "type": "start",
      "data": {}
    },
    {
      "id": "open_login",
      "type": "open_url",
      "data": {
        "url": "https://example.com/login",
        "openNewTab": false,
        "waitLoad": true
      }
    },
    {
      "id": "check_email_box",
      "type": "element_exists",
      "data": {
        "selector": "input[name='email']",
        "timeoutMs": 5000,
        "visibleOnly": true
      }
    },
    {
      "id": "type_email",
      "type": "type",
      "data": {
        "selector": "input[name='email']",
        "value": "{{row.email}}",
        "clearBefore": true,
        "typingDelay": "40"
      }
    },
    {
      "id": "type_pass",
      "type": "type",
      "data": {
        "selector": "input[name='password']",
        "value": "{{row.password}}",
        "clearBefore": true,
        "typingDelay": "40"
      }
    },
    {
      "id": "click_login",
      "type": "click",
      "data": {
        "targetMode": "element",
        "selector": "button[type='submit']",
        "clickType": "left",
        "humanClick": true
      }
    },
    {
      "id": "fetch_otp_api",
      "type": "api_request",
      "data": {
        "url": "https://api.my-otp-service.example/code?email={{row.email}}",
        "value": "GET",
        "outputKey": "otpData"
      }
    },
    {
      "id": "notify_webhook",
      "type": "webhook",
      "data": {
        "url": "https://hooks.example.com/workflow-done",
        "script": "{\"profile\": \"{{profile.name}}\", \"email\": \"{{row.email}}\", \"status\": \"success\"}"
      }
    },
    {
      "id": "end_1",
      "type": "end",
      "data": {}
    }
  ],
  "edges": [
    { "from": "start_1", "to": "open_login", "sourceHandle": "default" },
    { "from": "open_login", "to": "check_email_box", "sourceHandle": "default" },
    { "from": "check_email_box", "to": "type_email", "sourceHandle": "true" },
    { "from": "check_email_box", "to": "notify_webhook", "sourceHandle": "false" },
    { "from": "type_email", "to": "type_pass", "sourceHandle": "default" },
    { "from": "type_pass", "to": "click_login", "sourceHandle": "default" },
    { "from": "click_login", "to": "fetch_otp_api", "sourceHandle": "default" },
    { "from": "fetch_otp_api", "to": "notify_webhook", "sourceHandle": "default" },
    { "from": "notify_webhook", "to": "end_1", "sourceHandle": "default" }
  ]
}

5.2. Mẹo Kết Hợp API Request & Browser Request Hiệu Quả#

  1. Khi nào dùng api_request?
  • Khi bạn cần gọi tới dịch vụ bên thứ 3 độc lập với trang web đang mở (ví dụ: dịch vụ giải Captcha 2Captcha/CapMonster/AntiCaptcha, dịch vụ thuê SIM OTP, đọc mail qua API, hoặc đẩy dữ liệu về Google Sheets / Telegram).
  1. Khi nào dùng browser_request?
  • Khi bạn muốn gọi trực tiếp API nội bộ của chính trang web đang mở trong trình duyệt (tận dụng luôn Cookie và phiên đăng nhập sẵn có của hồ sơ mà không cần tự lấy token).
  • Điền thêm trường dataPath (ví dụ data.items.0.id) để lấy thẳng giá trị cần thiết vào biến mà không cần viết thêm bước tách JSON.

This guide is designed for AiLogin users to build browser automation workflows, look up all 65+ Workflow Blocks, leverage Dynamic Variables & Data Tables, and integrate workflows with external HTTP APIs & Webhooks.


1. How Workflows Work#

Workflow Execution Flow Diagram
Start Entry point Open URL / Switch Tab Inject {{row.*}} vars Conditions / Loop Ports: true / false / loop Click / Type / Extract DOM Actions & Scraping API / Webhook / File External Sync & Export End Completed

Every automation workflow in AiLogin is structured as a visual flowchart composed of Blocks (Nodes) and Connections (Edges) that define the execution order.

1.1. Output Ports (Source Handles)#

A block can have one or more output ports to route the execution flow:

  • Main Flow (default): Proceeds to the next step after the current block finishes (or after a loop completes all iterations).
  • True / False Branches (true / false): Used by conditional blocks such as Element exists or If / Else.
  • Multi-Branch Conditions (path_1, path_2, ... & fallback): Used by the Conditions block. Branches are evaluated top-to-bottom; the first matching branch is taken, or fallback runs if none match.
  • Loop Body (loop): Used by Loop, Loop data, Loop elements, and While loop. Blocks connected to the loop port run repeatedly; once the loop finishes, execution continues via the default port.
  • On-Error Fallback (fallback on action blocks): If an action block (such as Click or Wait selector) fails and you connect its fallback port to a recovery branch (e.g., take an error screenshot or reload the page), the workflow executes the fallback branch and continues instead of aborting.

1.2. Common Block Settings (settings)#

  • Enable / Disable Block (enabled): When set to false, the block is skipped during execution and flow passes directly to the next step.
  • Continue on Error (continueOnError): When set to true, if the block encounters an error (e.g., element not found), the workflow logs the warning and continues to the next step.

2. Dynamic Variables & Data Tables#

You can inject any variable into input fields (URLs, Selectors, Typed text, API payloads, File paths...) using the {{variable_name}} syntax.

2.1. Variable Interpolation Rules#

  • Inline string interpolation: Example: https://example.com/user/{{username}}/page/{{loop.iteration}}.
  • Direct Array / Object passing: In data manipulation blocks (split_data, sort_data, regex_variable), you can enter either a bare variable name (e.g., myList) or {{myList}}.
  • If a variable name has not been set yet, the original {{variable_name}} placeholder is preserved to help you spot typos easily.

2.2. Built-in Runtime Variables Reference#

Variable SyntaxScopeDescription & Value
{{profileId}}, {{profile.id}}Entire workflowUnique ID of the currently running browser profile
{{profileName}}, {{profile.name}}Entire workflowDisplay name of the currently running browser profile
{{row.<column_name>}}Entire workflow / Inside loop_dataValue of <column_name> from the profile's assigned DataTable row (or the current row inside loop_data)
{{row.index}}Inside loop_dataZero-based index of the current data row (0, 1, 2...)
{{table.<TableName>.<column>}}Entire workflowQuick access to the <column> value in the first row of DataTable <TableName>
{{loop.index}}Inside any loopZero-based index of the current iteration (0, 1, 2...)
{{loop.iteration}}Inside any loopOne-based counter of the current iteration (1, 2, 3...)
{{element.selector}}Inside loop_elementsAuto-generated selector pointing to the exact DOM element of the current iteration (use in Click, Extract text, etc.)
{{element.index}}Inside loop_elementsZero-based index of the current element (0, 1...)
{{element.iteration}}Inside loop_elementsOne-based number of the current element (1, 2...)
{{element.text}}Inside loop_elementsTrimmed text content of the current element (up to 500 characters)
{{element.count}}After element_exists / loop_elementsTotal number of elements matching the selector on the page
{{element.found}}After element_existstrue if the element was found, otherwise false
{{last_screenshot}}After screenshotLocal file path of the most recently saved screenshot

3. Writing Selectors (CSS / XPath) & Working with Iframes#

3.1. Automatic CSS Selector & XPath Detection#

Every Selector field in AiLogin automatically supports both CSS Selectors and XPath without manual mode switching:

  • XPath: Automatically detected when the selector starts with / or (:
  • Example 1: //button[contains(text(), "Sign in")]
  • Example 2: (//div[@class="product-card"])[1]//a
  • CSS Selector: Used for all other selector strings:
  • Example 1: input[name="email"]
  • Example 2: #login-form > button.btn-primary

3.2. Interacting with Elements Inside an <iframe>#

By default, all blocks look up elements in the main page document. To interact with elements inside an embedded <iframe> (such as payment forms, captchas, or rich-text editors):

  1. Add a Switch frame (switch_to) block with mode set to iframe and provide the CSS/XPath selector of the <iframe> element.
  2. Run your Click, Type text, Extract text... blocks normally.
  3. Add another Switch frame (switch_to) block with mode set to main to return to the top-level page (or parent to step out one frame level).

4. Complete Reference of 65+ Workflow Blocks#

Group A: Flow Control & Sub-Workflows#

Block Type (type)Display NameConfiguration Parameters (data)Behavior & Output Variables
startStart(None)Entry point of the workflow. Each workflow has exactly one Start block.
endEnd(None)Immediately terminates the workflow with a success status.
execute_workflowExecute workflow- workflowId / value: ID or name of the sub-workflow
- shareVariables: true / false (default false)
- outputKey: Variable to store results (default subWorkflow)
Runs another saved workflow as a step (supports up to 5 nesting levels). When shareVariables is enabled, both workflows share the same variable scope; otherwise, the sub-workflow's outputs are stored in outputKey.
workflow_stateWorkflow state- value: stop_currentstop_all
- excludeCurrent: true / false
block_groupBlocks group- blocks: Array of child blocksGroups a sequence of blocks into a single collapsible unit on the canvas.
noteNote- value: Note text
- color, fontSize
Visual annotation sticky note on the canvas (no runtime operation).

Group B: Conditional Branching & Loops#

Block Type (type)Display NameConfiguration Parameters (data)Output Port & Detailed Behavior
conditionsConditions- paths: Array of condition branches (each combining rules with and / or)Evaluates branches in order. The first branch that evaluates to true routes execution through its port ID. If no branch matches, routes through fallback.
ifIf / Else- conditionLeft: Left operand / Selector
- conditionOperator: Comparison operator
- conditionRight: Right operand
- timeoutMs: Element wait timeout (default 8000 ms)
Evaluates a single condition. Routes to the true port if satisfied, or the false port otherwise.
element_existsElement exists- selector: CSS or XPath
- timeoutMs: Max wait time (default 0 ms)
- visibleOnly: Require element to be visible (true/false)
Checks whether an element exists on the page (polling up to timeoutMs). Sets {{element.found}} and {{element.count}}, then branches via true or false.
loopLoop- loopCount: Number of iterations (1 – 1,000,000, default 2)Repeats the branch connected to the loop port loopCount times. Updates {{loop.index}} and {{loop.iteration}}, then continues via default.
loop_dataLoop data- value: DataTable ID
- conditionLeft: Mode (all
one
loop_elementsLoop elements- selector: CSS or XPath
- loopCount: Max elements (0 = all matching elements)
Finds all elements matching selector and loops over each one via the loop port. Inside the loop body, use {{element.selector}} to target the current element and {{element.text}} to read its text.
while_loopWhile loop- conditionLeft, conditionOperator, conditionRight
- loopCount: Safety max iterations (default 1000)
- delayMs: Delay between iterations (ms)
Repeats the loop branch as long as the condition evaluates to true (up to loopCount times).
loop_breakBreak- conditionLeft, conditionOperator, conditionRight (optional)Exits the current loop immediately and jumps to the loop's default port.
loop_continueContinue- conditionLeft, conditionOperator, conditionRight (optional)Skips the remaining steps of the current iteration and starts the next loop iteration.

All 22 Condition Operators (conditionOperator)#

  • String / Value Comparison: equals (exact match), equals_ci (case-insensitive), not_equals, not_equals_ci, contains, contains_ci, not_contains, not_contains_ci, starts_with, ends_with, regex_match (matches Regular Expression).
  • Numeric Comparison: greater_than (>), greater_equal (>=), less_than (<), less_equal (<=).
  • Value Presence / Truthiness: exists (non-empty), not_exists (empty), is_truthy (not false, 0, null, undefined, no), is_falsy.
  • DOM Element Checks (set Left Operand to a CSS or XPath selector):
  • element_exists: Element is present in the DOM.
  • element_not_exists: Element is not present in the DOM.
  • element_visible: Element is present, visible, and has non-zero width/height.
  • element_hidden: Element is hidden or absent.

Group C: Browser Navigation, Tabs, Windows & Iframes#

Block Type (type)Display NameConfiguration Parameters (data)Behavior & Output Variables
open_urlOpen URL- url: Target URL (supports {{var}})
- openNewTab: Open in a new tab (true/false)
- waitLoad: Wait for page load (true/false)
Navigates the current tab to url, or opens url in a new tab.
open_tabOpen tab- url: Target URL (optional)Opens a new browser tab and switches active control to it.
new_windowNew window- url: Target URL (optional)
- waitLoad: true/false
Opens a separate browser window (supported on Chromium engine).
switch_tabSwitch tab- mode: indexurl
close_tabClose tab- mode: activeurl_pattern
- value: URL substring (when mode = 'url_pattern')
- closeAllWindows: Close all tabs (true/false)
get_info_tabsGet info tabs- outputKey: Variable name (default tabs)Retrieves metadata for all open tabs ([{ index, url, title, active }]) into outputKey.
wait_tab_loadWait tab load- timeoutMs: Max wait time (default 15000 ms)Waits until the active tab finishes loading (document.readyState === 'complete').
switch_toSwitch frame- value: iframeparent
reloadReload(None)Reloads the current page.
go_backGo back(None)Navigates back one entry in browser history.
go_forwardGo forward(None)Navigates forward one entry in browser history.
zoom_pageZoom page- value: Zoom level (e.g. 80% or 1.2, default 100%)Sets page zoom level and persists it across navigations.

Group D: Mouse, Keyboard Interaction & Waiting#

Block Type (type)Display NameConfiguration Parameters (data)Behavior & Output Variables
clickClick- targetMode: element (by Selector)coordinates (by X, Y)
- selector: CSS/XPath
- value: Coordinates x, y (when coordinates)
- clickType: left
click_randomClick Random Element- selector: Primary selector
- selectors: Extra selectors (one per line)
- randomMode: random
sequential
- clickType: left
double_clickDouble click- selector: CSS/XPath
- timeoutMs: Default 10000 ms
Double-clicks the target element.
right_clickRight click- selector: CSS/XPath
- timeoutMs: Default 10000 ms
Right-clicks (context menu click) the target element.
mouse_moveMouse move- selector: CSS/XPath (optional)
- value: Coordinates x, y (optional)
Moves the mouse pointer to the center of an element or to explicit x, y coordinates.
hoverHover- selector: CSS/XPath
- timeoutMs: Default 10000 ms
Hovers the cursor over an element to trigger dropdowns or mouseover events.
typeType text- selector: CSS/XPath
- value: Text to type (supports {{var}})
- clearBefore: Clear existing value first (true/false)
- typingDelay: Delay per keystroke in ms (0 = instant insert)
- timeoutMs: Default 10000 ms
Focuses the input element and enters text. Set typingDelay between 30 and 80 ms to emulate realistic human typing speed.
clear_inputClear input- selector: CSS/XPath
- timeoutMs: Default 10000 ms
Clears the current value of an input or textarea element.
press_keyPress key- selector: CSS/XPath (optional — focus before key press)
- value: Key name or chord sequence (default Enter)
Presses a single key (Enter, Tab, Escape, Backspace, ArrowDown...), a modifier chord (Ctrl+A, Shift+Enter), or a comma-separated sequence (Ctrl+A, Backspace, Enter).
select_optionSelect option- selector: CSS/XPath of a <select> element
- value: Option value or visible label text
Selects an option inside a <select> dropdown.
scrollScroll Element- selector: Default html (full page scroll)
- scrollHorizontal, scrollVertical: Scroll distance in px
- scrollIntoView: Scroll element into viewport (true/false)
- smoothScroll: Smooth animation (true/false)
- incrementVertical: Relative/incremental scroll (true/false)
Scrolls the page or a scrollable container by pixel offset, or scrolls a target element into the center of the viewport.
upload_fileUpload file- selector: CSS/XPath of <input type="file">
- value: Local file path(s) (newline or comma separated)
Attaches one or more local files to a file upload input.
wait_timeWait time- value: Fixed milliseconds (e.g. 2000) or random range min,max (e.g. 1000,3500)Pauses execution for the specified duration. Using a min,max range is recommended for natural timing.
wait_selectorWait selector- selector: CSS/XPath
- timeoutMs: Default 10000 ms
Waits until the matching element appears in the DOM (throws an error on timeout).
wait_connectionsWait connections- durationMs: Default 10000 msWaits until background network activity becomes idle.
download_waitWait download- durationMs: Max wait time (default 30000 ms)
- outputKey: Default downloadedFile
Monitors the download directory until a file finishes downloading and stores its full path in outputKey.
handle_dialogHandle dialog- value: acceptdismiss
- promptText: Text to supply to prompt() dialogs
cookieCookie- value: getset
create_elementCreate element- selector: Target container (empty = document.body)
- value: Position (firstChild
lastChild

Group E: DOM Extraction, Screenshots & Custom JS#

Block Type (type)Display NameConfiguration Parameters (data)Behavior & Output Variables
extract_textExtract text- selector: CSS/XPath
- timeoutMs: Default 10000 ms
- outputKey: Default text
Extracts trimmed textContent from the matching element and stores it in outputKey.
extract_attributeExtract attribute- selector: CSS/XPath
- value: Attribute name (default href, e.g. src, value, data-id)
- timeoutMs: Default 10000 ms
- outputKey: Default attribute
Reads the specified HTML attribute from the element and stores it in outputKey.
extract_htmlExtract HTML- selector: CSS/XPath (empty = full document HTML)
- timeoutMs: Default 10000 ms
- outputKey: Default html
Reads innerHTML of the element (or full outerHTML of the page) into outputKey.
get_titleGet title- outputKey: Default pageTitleReads document.title of the active tab into outputKey.
get_current_urlGet URL- mode: active (active tab)all (all open tabs)
- filterType: none
screenshotScreenshot- source: viewportfullpage
run_jsRun JS- script: JavaScript expression or async function body
- outputKey: Variable to receive the return value
Executes custom JavaScript inside the page context (supports async/await and return) and saves the result to outputKey.

Group F: Variables, String/Array Processing & Random Generators#

Block Type (type)Display NameConfiguration Parameters (data)Behavior & Output Variables
set_variableSet variable- outputKey: Variable name
- value: Value to assign
- valueType: string
number
get_variableGet variable- value: Source expression (e.g. {{row.email}})
- outputKey: Target variable name
Copies a value or expression into outputKey.
increase_variableIncrease variable- selector: Numeric variable name
- value: Increment step (default 1, can be negative)
Adds Number(value) to a numeric counter variable.
insert_dataInsert data- outputKey: Variable name (default data)
- value: Value to insert
- mode: set (overwrite)
append (push to array)
delete_dataDelete data- selector: Variable name to deleteRemoves the variable from the workflow runtime scope.
text_templateText template- script: Multi-line template containing {{var}}
- outputKey: Default templated
Renders a multi-line string template with variable interpolation into outputKey.
slice_variableSlice variable- selector: Source variable name (string or array)
- conditionLeft: Start index (start)
- conditionRight: End index (end, optional)
- outputKey: Default sliced
Extracts a substring or subarray (slice(start, end)) into outputKey.
split_dataSplit data- selector: Source variable or text
- value: Delimiter (default ,, e.g. `
, ;, :)<br>- mode: all` (array)
sort_dataSort data- selector: Source array variable
- sortType: alpha (alphabetical)
numeric (numerical)
- value: asc (ascending)
regex_variableRegEx variable- selector: Source variable name
- value: Regular Expression pattern (e.g. \b\d{6}\b for a 6-digit OTP)
- method: match
replace
data_mappingData mapping- script: JSON template containing {{var}}
- outputKey: Default mapped
Interpolates variables into a JSON template and parses it into a structured object in outputKey.
randomRandom- value: Generator type (number, text, digits, uuid, email, phone, first_name, last_name, full_name, username, password, city, country, color, boolean, ipv4, domain, url, date)
- conditionLeft: Min value or Length
- conditionRight: Max value
- outputKey: Default random
Generates realistic random data across 19 built-in formats (names, emails, phones, passwords, UUIDs, dates...) for form filling and registration.
random_numberRandom number- conditionLeft: Min (default 0)
- conditionRight: Max (default 100)
- outputKey: Default randomNumber
Generates a random integer within [Min, Max].
random_textRandom text- value: String length (default 10)
- outputKey: Default randomText
Generates a random alphanumeric string of the specified length.
get_log_dataGet log data- outputKey: Default logDataCopies the current workflow run's execution logs into outputKey.
clipboardClipboard- value: copy (write text)copy_selection (copy selected page text)
resource_statusResource status- status: ActiveInactive

Group G: Data Tables & Local File I/O (CSV, Excel, JSON, Text)#

Block Type (type)Display NameConfiguration Parameters (data)Behavior & Output Variables
csv_readCSV read- value: DataTable ID
- outputKey: Default csvRows
Loads all rows from an imported CSV DataTable into outputKey.
excel_readExcel read- value: DataTable ID
- outputKey: Default excelRows
Loads all rows from an imported Excel DataTable into outputKey.
set_row_valueSet row value- selector: Column name
- value: New value
Updates a column value for the current row in the linked DataTable (e.g., setting status = "Verified").
save_row_resultSave row result(None)Captures all current output variables as a result row for batch export.
export_csvExport CSV- value: Output .csv file pathExports all rows collected via save_row_result to a CSV file on disk.
csv_writeCSV write- value: Target .csv file path
- script: JSON object or array of rows (e.g. {"email":"{{email}}","status":"OK"})
Appends one or more rows to a CSV file on disk (automatically creating headers if new).
excel_writeExcel write- value: Target .xlsx file path
- selector: Sheet name (default Sheet1)
- script: JSON object of the row
Appends a data row to the specified sheet in an Excel .xlsx file.
json_readJSON read- value: Path to .json file
- outputKey: Default jsonData
Reads and parses a local JSON file into outputKey.
json_writeJSON write- value: Path to .json file
- script: JSON string or variable {{data}}
Writes formatted JSON data to a local .json file.
read_file_textRead file text- value: Path to text file
- mode: all_text
all_lines
file_actionFile action- value: writeappend
save_assetsSave asset- selector: Selector for <img>, <video>, <audio>, <a>
- url: Or direct asset URL
- value: Desired filename (e.g. avatar.png)
- outputKey: Default savedAsset
Downloads media or files directly from inside the browser session (preserving cookies and login state) to the local downloads folder.

Group H: External APIs, Webhooks & Dynamic Proxy Switching#

Block Type (type)Display NameConfiguration Parameters (data)Behavior & Output Variables
api_requestAPI request- url: API Endpoint URL (supports {{var}})
- value: HTTP Method (GET
POST
browser_requestBrowser request- url: Request URL
- value: GET
POST
webhookWebhook- url: Destination Webhook URL
- script: JSON payload (default {})
Sends a POST JSON notification or result payload to Telegram Bots, Discord, Lark, n8n, Make, Zapier, or your custom backend.
proxyChange proxy- mode: stored (from saved Proxies)manual (custom host/port)

Group I: Artificial Intelligence (AI) & Local Shell Commands#

Block Type (type)Display NameConfiguration Parameters (data)Behavior & Output Variables
chatgptChatGPT- value: Model name (default gpt-4o-mini)
- systemPrompt: System instructions / persona
- script: User prompt (supports {{var}})
- temperature: Creativity (0 – 2, default 0.7)
- outputKey: Default ai_result
Calls OpenAI ChatGPT to generate posts, comments, translations, or analyze extracted page text, saving the response in outputKey.
geminiGemini- value: Model name (default gemini-1.5-flash)
- systemPrompt: System instructions
- script: User prompt
- temperature: Default 0.7
- outputKey: Default ai_result
Calls Google Gemini AI to generate content or process data, saving the response in outputKey.
cmdCmd- script: Windows Command Prompt command
- regex: Optional RegExp to filter output
- outputKey: Default shellOutput
Runs a command in Windows CMD and stores the output (or regex match) in outputKey.
powershellPowerShell- script: Windows PowerShell command
- outputKey: Default shellOutput
Runs a PowerShell command and stores the trimmed stdout in outputKey.

5. Workflow File Schema (.ailogin / JSON) & Practical Examples#

You can export any workflow as a .ailogin file (standard JSON format) to share, back up, or programmatically generate workflows and import them into AiLogin.

5.1. Complete Sample Workflow JSON#

JSON
{
  "name": "Sign In & Fetch OTP via API",
  "description": "Sample workflow combining element checks, external OTP API call, and Webhook notification",
  "nodes": [
    {
      "id": "start_1",
      "type": "start",
      "data": {}
    },
    {
      "id": "open_login",
      "type": "open_url",
      "data": {
        "url": "https://example.com/login",
        "openNewTab": false,
        "waitLoad": true
      }
    },
    {
      "id": "check_email_box",
      "type": "element_exists",
      "data": {
        "selector": "input[name='email']",
        "timeoutMs": 5000,
        "visibleOnly": true
      }
    },
    {
      "id": "type_email",
      "type": "type",
      "data": {
        "selector": "input[name='email']",
        "value": "{{row.email}}",
        "clearBefore": true,
        "typingDelay": "40"
      }
    },
    {
      "id": "type_pass",
      "type": "type",
      "data": {
        "selector": "input[name='password']",
        "value": "{{row.password}}",
        "clearBefore": true,
        "typingDelay": "40"
      }
    },
    {
      "id": "click_login",
      "type": "click",
      "data": {
        "targetMode": "element",
        "selector": "button[type='submit']",
        "clickType": "left",
        "humanClick": true
      }
    },
    {
      "id": "fetch_otp_api",
      "type": "api_request",
      "data": {
        "url": "https://api.my-otp-service.example/code?email={{row.email}}",
        "value": "GET",
        "outputKey": "otpData"
      }
    },
    {
      "id": "notify_webhook",
      "type": "webhook",
      "data": {
        "url": "https://hooks.example.com/workflow-done",
        "script": "{\"profile\": \"{{profile.name}}\", \"email\": \"{{row.email}}\", \"status\": \"success\"}"
      }
    },
    {
      "id": "end_1",
      "type": "end",
      "data": {}
    }
  ],
  "edges": [
    { "from": "start_1", "to": "open_login", "sourceHandle": "default" },
    { "from": "open_login", "to": "check_email_box", "sourceHandle": "default" },
    { "from": "check_email_box", "to": "type_email", "sourceHandle": "true" },
    { "from": "check_email_box", "to": "notify_webhook", "sourceHandle": "false" },
    { "from": "type_email", "to": "type_pass", "sourceHandle": "default" },
    { "from": "type_pass", "to": "click_login", "sourceHandle": "default" },
    { "from": "click_login", "to": "fetch_otp_api", "sourceHandle": "default" },
    { "from": "fetch_otp_api", "to": "notify_webhook", "sourceHandle": "default" },
    { "from": "notify_webhook", "to": "end_1", "sourceHandle": "default" }
  ]
}

5.2. Best Practices: api_request vs. browser_request#

  1. When to use api_request?
  • Use it when calling third-party services independent of the current website (e.g., Captcha solvers like 2Captcha/CapMonster, SMS OTP providers, email APIs, or pushing data to Google Sheets / Telegram).
  1. When to use browser_request?
  • Use it when calling internal endpoints of the website currently open in the browser tab — it automatically reuses the browser profile's active Cookies and session without manual token extraction.
  • Specify dataPath (e.g., data.items.0.id) to extract nested JSON values directly into your output variable.
Đã sao chép vào bộ nhớ tạm!