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.
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.
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)#
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ổngfallback. - 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ổngloopsẽ đượ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ổngdefault. - Nhánh Bắt lỗi (
fallbacktrê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ổngfallbackcủ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ánhfallbackrồ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ến | Phạm vi hoạt động | Ý nghĩa & Giá trị |
|---|---|---|
{{profileId}}, {{profile.id}} | Toàn kịch bản | Mã định danh (ID) của hồ sơ trình duyệt đang chạy |
{{profileName}}, {{profile.name}} | Toàn kịch bản | Tên của hồ sơ trình duyệt đang chạy |
{{row.<ten_cot>}} | Toàn kịch bản / Trong loop_data | Giá 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_data | Vị trí dòng hiện tại (bắt đầu từ 0) |
{{table.<TenBang>.<ten_cot>}} | Toàn kịch bản | Truy 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ặp | Chỉ số vòng lặp hiện tại (đếm từ 0, 1, 2...) |
{{loop.iteration}} | Trong mọi vòng lặp | Thứ tự vòng lặp hiện tại (đếm từ 1, 2, 3...) |
{{element.selector}} | Trong loop_elements | Selector 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_elements | Chỉ số phần tử hiện tại (đếm từ 0) |
{{element.iteration}} | Trong loop_elements | Thứ tự phần tử hiện tại (đếm từ 1) |
{{element.text}} | Trong loop_elements | Nộ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_elements | Tổng số lượng phần tử khớp với Selector trên trang |
{{element.found}} | Sau element_exists | Nhậ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):
- Dùng khối Switch frame (
switch_to) với chế độiframevà nhập Selector của thẻ<iframe>. - Thực hiện các khối lệnh Click, Type text, Extract text... như bình thường.
- Dùng lại khối Switch frame (
switch_to) với chế độmainđể quay về trang chính (hoặcparentđể 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ệnh | Tham số cấu hình (data) | Chức năng & Kết quả đầu ra |
|---|---|---|---|
start | Start | (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. |
end | End | (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_workflow | Execute 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_state | Workflow state | - value: stop_current | stop_all- excludeCurrent: true / false |
block_group | Blocks group | - blocks: Danh sách các khối lệnh con | Gom 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ế. |
note | Note | - 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ệnh | Tham số cấu hình (data) | Cổng ra & Hành vi chi tiết |
|---|---|---|---|
conditions | Conditions | - 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. |
if | If / 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_exists | Element 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. |
loop | Loop | - 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_data | Loop data | - value: ID Bảng dữ liệu (DataTable)- conditionLeft: Chế độ duyệt (all | one |
loop_elements | Loop 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_loop | While 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_break | Break | - 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_continue | Continue | - 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ácfalse,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ệnh | Tham số cấu hình (data) | Chức năng & Kết quả đầu ra |
|---|---|---|---|
open_url | Open 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_tab | Open 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_window | New 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_tab | Switch tab | - mode: index | url |
close_tab | Close tab | - mode: active | url_pattern- value: Chuỗi URL cần đóng (khi chọn url_pattern)- closeAllWindows: Đóng tất cả (true/false) |
get_info_tabs | Get 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_load | Wait 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_to | Switch frame | - value: iframe | parent |
reload | Reload | (Không có) | Tải lại (F5) trang web hiện tại. |
go_back | Go back | (Không có) | Quay lại trang trước đó trong lịch sử duyệt web. |
go_forward | Go forward | (Không có) | Tiến tới trang tiếp theo trong lịch sử duyệt web. |
zoom_page | Zoom 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ệnh | Tham số cấu hình (data) | Chức năng & Kết quả đầu ra |
|---|---|---|---|
click | Click | - targetMode: element (theo Selector) | coordinates (theo tọa độ)- selector: CSS/XPath- value: Tọa độ x, y (khi chọn coordinates)- clickType: left |
click_random | Click 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_click | Double click | - selector: CSS/XPath- timeoutMs: Mặc định 10000 ms | Nhấp đúp chuột trái vào phần tử. |
right_click | Right click | - selector: CSS/XPath- timeoutMs: Mặc định 10000 ms | Nhấp chuột phải vào phần tử. |
mouse_move | Mouse 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. |
hover | Hover | - 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. |
type | Type 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_input | Clear 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_key | Press 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_option | Select 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>). |
scroll | Scroll 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_file | Upload 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_time | Wait 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_selector | Wait 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_connections | Wait connections | - durationMs: Mặc định 10000 ms | Chờ cho tới khi các kết nối mạng ngầm (AJAX/Fetch) trên trang tải xong. |
download_wait | Wait 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_dialog | Handle dialog | - value: accept (Đồng ý) | dismiss (Hủy bỏ)- promptText: Văn bản điền vào hộp thoại prompt() |
cookie | Cookie | - value: get | set |
create_element | Create 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ệnh | Tham số cấu hình (data) | Chức năng & Kết quả đầu ra |
|---|---|---|---|
extract_text | Extract 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_attribute | Extract 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_html | Extract 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_title | Get title | - outputKey: Mặc định pageTitle | Lấy tiêu đề của tab hiện tại lưu vào biến outputKey. |
get_current_url | Get URL | - mode: active (tab hiện tại) | all (tất cả các tab)- filterType: none |
screenshot | Screenshot | - source: viewport (khung nhìn) | fullpage (toàn trang) |
run_js | Run 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ệnh | Tham số cấu hình (data) | Chức năng & Kết quả đầu ra |
|---|---|---|---|
set_variable | Set variable | - outputKey: Tên biến cần gán- value: Giá trị- valueType: string | number |
get_variable | Get 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_variable | Increase 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_data | Insert 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_data | Delete data | - selector: Tên biến cần xóa | Xóa biến khỏi bộ nhớ phiên chạy. |
text_template | Text 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_variable | Slice 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_data | Split 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_data | Sort 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_variable | RegEx 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_mapping | Data 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. |
random | Random | - 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_number | Random 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_text | Random 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_data | Get log data | - outputKey: Mặc định logData | Lấ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. |
clipboard | Clipboard | - value: copy (ghi vào bộ nhớ tạm) | copy_selection (sao chép văn bản đang bôi đen) |
resource_status | Resource status | - status: Active | Inactive |
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ệnh | Tham số cấu hình (data) | Chức năng & Kết quả đầu ra |
|---|---|---|---|
csv_read | CSV 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_read | Excel 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_value | Set 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_result | Save 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_csv | Export CSV | - value: Đường dẫn file .csv muốn xuất ra máy tính | Xuất các dòng kết quả đã thu thập bằng save_row_result ra file CSV. |
csv_write | CSV 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_write | Excel 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_read | JSON 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_write | JSON 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_text | Read file text | - value: Đường dẫn file .txt- mode: all_text (toàn bộ) | all_lines (mảng các dòng) |
file_action | File action | - value: write | append |
save_assets | Save 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ệnh | Tham số cấu hình (data) | Chức năng & Kết quả đầu ra |
|---|---|---|---|
api_request | API request | - url: Địa chỉ API Endpoint (hỗ trợ {{var}})- value: Phương thức (GET | POST |
browser_request | Browser request | - url: Địa chỉ URL- value: GET | POST |
webhook | Webhook | - 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. |
proxy | Change 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ệnh | Tham số cấu hình (data) | Chức năng & Kết quả đầu ra |
|---|---|---|---|
chatgpt | ChatGPT | - 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. |
gemini | Gemini | - 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. |
cmd | Cmd | - 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. |
powershell | PowerShell | - 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#
{
"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ả#
- 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).
- 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#
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, orfallbackruns if none match. - Loop Body (
loop): Used by Loop, Loop data, Loop elements, and While loop. Blocks connected to theloopport run repeatedly; once the loop finishes, execution continues via thedefaultport. - On-Error Fallback (
fallbackon action blocks): If an action block (such as Click or Wait selector) fails and you connect itsfallbackport to a recovery branch (e.g., take an error screenshot or reload the page), the workflow executes thefallbackbranch and continues instead of aborting.
1.2. Common Block Settings (settings)#
- Enable / Disable Block (
enabled): When set tofalse, the block is skipped during execution and flow passes directly to the next step. - Continue on Error (
continueOnError): When set totrue, 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 Syntax | Scope | Description & Value |
|---|---|---|
{{profileId}}, {{profile.id}} | Entire workflow | Unique ID of the currently running browser profile |
{{profileName}}, {{profile.name}} | Entire workflow | Display name of the currently running browser profile |
{{row.<column_name>}} | Entire workflow / Inside loop_data | Value of <column_name> from the profile's assigned DataTable row (or the current row inside loop_data) |
{{row.index}} | Inside loop_data | Zero-based index of the current data row (0, 1, 2...) |
{{table.<TableName>.<column>}} | Entire workflow | Quick access to the <column> value in the first row of DataTable <TableName> |
{{loop.index}} | Inside any loop | Zero-based index of the current iteration (0, 1, 2...) |
{{loop.iteration}} | Inside any loop | One-based counter of the current iteration (1, 2, 3...) |
{{element.selector}} | Inside loop_elements | Auto-generated selector pointing to the exact DOM element of the current iteration (use in Click, Extract text, etc.) |
{{element.index}} | Inside loop_elements | Zero-based index of the current element (0, 1...) |
{{element.iteration}} | Inside loop_elements | One-based number of the current element (1, 2...) |
{{element.text}} | Inside loop_elements | Trimmed text content of the current element (up to 500 characters) |
{{element.count}} | After element_exists / loop_elements | Total number of elements matching the selector on the page |
{{element.found}} | After element_exists | true if the element was found, otherwise false |
{{last_screenshot}} | After screenshot | Local 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):
- Add a Switch frame (
switch_to) block with mode set toiframeand provide the CSS/XPath selector of the<iframe>element. - Run your Click, Type text, Extract text... blocks normally.
- Add another Switch frame (
switch_to) block with mode set tomainto return to the top-level page (orparentto step out one frame level).
4. Complete Reference of 65+ Workflow Blocks#
Group A: Flow Control & Sub-Workflows#
Block Type (type) | Display Name | Configuration Parameters (data) | Behavior & Output Variables |
|---|---|---|---|
start | Start | (None) | Entry point of the workflow. Each workflow has exactly one Start block. |
end | End | (None) | Immediately terminates the workflow with a success status. |
execute_workflow | Execute 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_state | Workflow state | - value: stop_current | stop_all- excludeCurrent: true / false |
block_group | Blocks group | - blocks: Array of child blocks | Groups a sequence of blocks into a single collapsible unit on the canvas. |
note | Note | - value: Note text- color, fontSize | Visual annotation sticky note on the canvas (no runtime operation). |
Group B: Conditional Branching & Loops#
Block Type (type) | Display Name | Configuration Parameters (data) | Output Port & Detailed Behavior |
|---|---|---|---|
conditions | Conditions | - 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. |
if | If / 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_exists | Element 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. |
loop | Loop | - 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_data | Loop data | - value: DataTable ID- conditionLeft: Mode (all | one |
loop_elements | Loop 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_loop | While 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_break | Break | - conditionLeft, conditionOperator, conditionRight (optional) | Exits the current loop immediately and jumps to the loop's default port. |
loop_continue | Continue | - 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(notfalse,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 Name | Configuration Parameters (data) | Behavior & Output Variables |
|---|---|---|---|
open_url | Open 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_tab | Open tab | - url: Target URL (optional) | Opens a new browser tab and switches active control to it. |
new_window | New window | - url: Target URL (optional)- waitLoad: true/false | Opens a separate browser window (supported on Chromium engine). |
switch_tab | Switch tab | - mode: index | url |
close_tab | Close tab | - mode: active | url_pattern- value: URL substring (when mode = 'url_pattern')- closeAllWindows: Close all tabs (true/false) |
get_info_tabs | Get info tabs | - outputKey: Variable name (default tabs) | Retrieves metadata for all open tabs ([{ index, url, title, active }]) into outputKey. |
wait_tab_load | Wait tab load | - timeoutMs: Max wait time (default 15000 ms) | Waits until the active tab finishes loading (document.readyState === 'complete'). |
switch_to | Switch frame | - value: iframe | parent |
reload | Reload | (None) | Reloads the current page. |
go_back | Go back | (None) | Navigates back one entry in browser history. |
go_forward | Go forward | (None) | Navigates forward one entry in browser history. |
zoom_page | Zoom 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 Name | Configuration Parameters (data) | Behavior & Output Variables |
|---|---|---|---|
click | Click | - targetMode: element (by Selector) | coordinates (by X, Y)- selector: CSS/XPath- value: Coordinates x, y (when coordinates)- clickType: left |
click_random | Click Random Element | - selector: Primary selector- selectors: Extra selectors (one per line)- randomMode: random | sequential- clickType: left |
double_click | Double click | - selector: CSS/XPath- timeoutMs: Default 10000 ms | Double-clicks the target element. |
right_click | Right click | - selector: CSS/XPath- timeoutMs: Default 10000 ms | Right-clicks (context menu click) the target element. |
mouse_move | Mouse 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. |
hover | Hover | - selector: CSS/XPath- timeoutMs: Default 10000 ms | Hovers the cursor over an element to trigger dropdowns or mouseover events. |
type | Type 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_input | Clear input | - selector: CSS/XPath- timeoutMs: Default 10000 ms | Clears the current value of an input or textarea element. |
press_key | Press 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_option | Select option | - selector: CSS/XPath of a <select> element- value: Option value or visible label text | Selects an option inside a <select> dropdown. |
scroll | Scroll 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_file | Upload 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_time | Wait 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_selector | Wait selector | - selector: CSS/XPath- timeoutMs: Default 10000 ms | Waits until the matching element appears in the DOM (throws an error on timeout). |
wait_connections | Wait connections | - durationMs: Default 10000 ms | Waits until background network activity becomes idle. |
download_wait | Wait 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_dialog | Handle dialog | - value: accept | dismiss- promptText: Text to supply to prompt() dialogs |
cookie | Cookie | - value: get | set |
create_element | Create element | - selector: Target container (empty = document.body)- value: Position (firstChild | lastChild |
Group E: DOM Extraction, Screenshots & Custom JS#
Block Type (type) | Display Name | Configuration Parameters (data) | Behavior & Output Variables |
|---|---|---|---|
extract_text | Extract text | - selector: CSS/XPath- timeoutMs: Default 10000 ms- outputKey: Default text | Extracts trimmed textContent from the matching element and stores it in outputKey. |
extract_attribute | Extract 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_html | Extract 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_title | Get title | - outputKey: Default pageTitle | Reads document.title of the active tab into outputKey. |
get_current_url | Get URL | - mode: active (active tab) | all (all open tabs)- filterType: none |
screenshot | Screenshot | - source: viewport | fullpage |
run_js | Run 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 Name | Configuration Parameters (data) | Behavior & Output Variables |
|---|---|---|---|
set_variable | Set variable | - outputKey: Variable name- value: Value to assign- valueType: string | number |
get_variable | Get variable | - value: Source expression (e.g. {{row.email}})- outputKey: Target variable name | Copies a value or expression into outputKey. |
increase_variable | Increase variable | - selector: Numeric variable name- value: Increment step (default 1, can be negative) | Adds Number(value) to a numeric counter variable. |
insert_data | Insert data | - outputKey: Variable name (default data)- value: Value to insert- mode: set (overwrite) | append (push to array) |
delete_data | Delete data | - selector: Variable name to delete | Removes the variable from the workflow runtime scope. |
text_template | Text template | - script: Multi-line template containing {{var}}- outputKey: Default templated | Renders a multi-line string template with variable interpolation into outputKey. |
slice_variable | Slice 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_data | Split data | - selector: Source variable or text- value: Delimiter (default ,, e.g. ` | , ;, :)<br>- mode: all` (array) |
sort_data | Sort data | - selector: Source array variable- sortType: alpha (alphabetical) | numeric (numerical)- value: asc (ascending) |
regex_variable | RegEx variable | - selector: Source variable name- value: Regular Expression pattern (e.g. \b\d{6}\b for a 6-digit OTP)- method: match | replace |
data_mapping | Data mapping | - script: JSON template containing {{var}}- outputKey: Default mapped | Interpolates variables into a JSON template and parses it into a structured object in outputKey. |
random | Random | - 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_number | Random number | - conditionLeft: Min (default 0)- conditionRight: Max (default 100)- outputKey: Default randomNumber | Generates a random integer within [Min, Max]. |
random_text | Random text | - value: String length (default 10)- outputKey: Default randomText | Generates a random alphanumeric string of the specified length. |
get_log_data | Get log data | - outputKey: Default logData | Copies the current workflow run's execution logs into outputKey. |
clipboard | Clipboard | - value: copy (write text) | copy_selection (copy selected page text) |
resource_status | Resource status | - status: Active | Inactive |
Group G: Data Tables & Local File I/O (CSV, Excel, JSON, Text)#
Block Type (type) | Display Name | Configuration Parameters (data) | Behavior & Output Variables |
|---|---|---|---|
csv_read | CSV read | - value: DataTable ID- outputKey: Default csvRows | Loads all rows from an imported CSV DataTable into outputKey. |
excel_read | Excel read | - value: DataTable ID- outputKey: Default excelRows | Loads all rows from an imported Excel DataTable into outputKey. |
set_row_value | Set 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_result | Save row result | (None) | Captures all current output variables as a result row for batch export. |
export_csv | Export CSV | - value: Output .csv file path | Exports all rows collected via save_row_result to a CSV file on disk. |
csv_write | CSV 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_write | Excel 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_read | JSON read | - value: Path to .json file- outputKey: Default jsonData | Reads and parses a local JSON file into outputKey. |
json_write | JSON write | - value: Path to .json file- script: JSON string or variable {{data}} | Writes formatted JSON data to a local .json file. |
read_file_text | Read file text | - value: Path to text file- mode: all_text | all_lines |
file_action | File action | - value: write | append |
save_assets | Save 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 Name | Configuration Parameters (data) | Behavior & Output Variables |
|---|---|---|---|
api_request | API request | - url: API Endpoint URL (supports {{var}})- value: HTTP Method (GET | POST |
browser_request | Browser request | - url: Request URL- value: GET | POST |
webhook | Webhook | - 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. |
proxy | Change proxy | - mode: stored (from saved Proxies) | manual (custom host/port) |
Group I: Artificial Intelligence (AI) & Local Shell Commands#
Block Type (type) | Display Name | Configuration Parameters (data) | Behavior & Output Variables |
|---|---|---|---|
chatgpt | ChatGPT | - 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. |
gemini | Gemini | - 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. |
cmd | Cmd | - 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. |
powershell | PowerShell | - 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#
{
"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#
- 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).
- 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.