client.workflows quản lý flow engine của Imbrace: tạo và kích hoạt các luồng tự động hóa, xem lịch sử chạy, tổ chức với folders, quản lý app connections và MCP servers, và truy cập workflow tables.
Để xem hướng dẫn chi tiết, tham khảo Workflows trong hướng dẫn SDK .
Schema
Flow
Trường Kiểu Mô tả idstring ID duy nhất của flow createdstring ISO 8601 thời gian tạo updatedstring ISO 8601 thời gian cập nhật projectIdstring Dự án sở hữu flow này externalIdstring Định danh bên ngoài tùy chọn status"ENABLED" | "DISABLED"Flow có đang hoạt động không operationStatusstring Trạng thái thao tác hiện tại versionFlowVersion Đối tượng phiên bản đang hoạt động
FlowVersion
Trường Kiểu Mô tả idstring ID duy nhất của phiên bản createdstring ISO 8601 thời gian tạo updatedstring ISO 8601 thời gian cập nhật flowIdstring Flow của phiên bản này displayNamestring Tên flow dễ đọc triggerobject Cấu hình trigger stepsobject? Cấu hình bước tùy chọn validboolean? Phiên bản có hợp lệ không
FlowRun
Trường Kiểu Mô tả idstring ID duy nhất của run createdstring ISO 8601 thời gian tạo updatedstring ISO 8601 thời gian cập nhật projectIdstring ID dự án flowIdstring Flow đã được thực thi flowVersionIdstring Phiên bản cụ thể đã chạy status"RUNNING" | "SUCCEEDED" | "FAILED" | "TIMEOUT" | "PAUSED" | "STOPPED"Kết quả chạy environment"PRODUCTION" | "TESTING"Môi trường thực thi startTimestring? Thời điểm bắt đầu chạy finishTimestring? Thời điểm kết thúc chạy failParentOnFailureboolean Lỗi có lan truyền lên flow cha không tagsstring[]? Thẻ gắn vào run này
AppConnection
Trường Kiểu Mô tả idstring ID duy nhất của kết nối createdstring ISO 8601 thời gian tạo updatedstring ISO 8601 thời gian cập nhật externalIdstring Định danh bên ngoài displayNamestring Tên dễ đọc pieceNamestring Piece (tích hợp) mà kết nối này dành cho projectIdstring ID dự án type"SECRET_TEXT" | "OAUTH2" | "CLOUD_OAUTH2" | "PLATFORM_OAUTH2" | "BASIC_AUTH" | "CUSTOM_AUTH"Loại xác thực kết nối
McpServer
Trường Kiểu Mô tả idstring ID duy nhất của MCP server createdstring ISO 8601 thời gian tạo updatedstring ISO 8601 thời gian cập nhật projectIdstring ID dự án namestring? Tên server
Phương thức
Flows
Phương thức TypeScript Python Mô tả Danh sách flow listFlowslist_flowsDanh sách flows có phân trang Lấy flow getFlowget_flowLấy một flow theo ID Tạo flow createFlowcreate_flowTạo flow mới Xóa flow deleteFlowdelete_flowXóa flow Áp dụng thao tác flow applyFlowOperationapply_flow_operationÁp dụng thao tác (vd: publish, enable) cho flow Kích hoạt flow triggerFlowtrigger_flowKích hoạt flow bất đồng bộ Kích hoạt flow đồng bộ triggerFlowSynctrigger_flow_syncKích hoạt flow và chờ kết quả
Lượt chạy flow
Phương thức TypeScript Python Mô tả Danh sách run listRunslist_runsDanh sách lịch sử chạy Lấy run getRunget_runLấy một run theo ID
Thư mục
Phương thức TypeScript Python Mô tả Danh sách thư mục listFolderslist_foldersDanh sách thư mục flow Lấy thư mục getFolderget_folderLấy thư mục theo ID Tạo thư mục createFoldercreate_folderTạo thư mục Cập nhật thư mục updateFolderupdate_folderĐổi tên thư mục Xóa thư mục deleteFolderdelete_folderXóa thư mục
Kết nối ứng dụng
Phương thức TypeScript Python Mô tả Danh sách kết nối listConnectionslist_connectionsDanh sách app connections Lấy kết nối getConnectionget_connectionLấy kết nối theo ID Upsert kết nối upsertConnectionupsert_connectionTạo hoặc cập nhật kết nối Xóa kết nối deleteConnectiondelete_connectionXóa kết nối
MCP Servers
Phương thức TypeScript Python Mô tả Danh sách MCP server listMcpServerslist_mcp_serversDanh sách MCP servers Lấy MCP server getMcpServerget_mcp_serverLấy server theo ID Tạo MCP server createMcpServercreate_mcp_serverĐăng ký MCP server mới Xóa MCP server deleteMcpServerdelete_mcp_serverXóa server Xoay vòng token rotateMcpTokenrotate_mcp_tokenXoay vòng token xác thực của server
listFlows / list_flows
const page = await client . workflows . listFlows ( {
for ( const flow of page . data ) {
console . log (flow . id , flow . version ?. displayName );
page = client.workflows. list_flows ( limit = 10 , status = " ENABLED " , folder_id = " folder_id " )
for flow in page. get ( " data " , [] ):
createFlow / create_flow
const flow = await client . workflows . createFlow ( {
displayName: " New Lead Notification " ,
flow = client.workflows. create_flow (
display_name = " New Lead Notification " ,
triggerFlow / trigger_flow
Kích hoạt flow bất đồng bộ với payload tùy chọn.
await client . workflows . triggerFlow ( " flow_id " , {
contact_id: " contact_123 " ,
client.workflows. trigger_flow ( " flow_id " , {
" contact_id " : " contact_123 " ,
listRuns / list_runs
const page = await client . workflows . listRuns ( {
page = client.workflows. list_runs (
upsertConnection / upsert_connection
Tạo hoặc cập nhật app connection (vd: API key cho dịch vụ bên thứ ba).
const conn = await client . workflows . upsertConnection ( {
displayName: " Slack Workspace " ,
value: { api_key: " xoxb-... " },
conn = client.workflows. upsert_connection ( {
" displayName " : " Slack Workspace " ,
" projectId " : " project_id " ,
" value " : { " api_key " : " xoxb-... " },
createMcpServer / create_mcp_server
const server = await client . workflows . createMcpServer ( {
server = client.workflows. create_mcp_server ( {
" projectId " : " project_id " ,