提交人工介入表单
适用于:Chatflow、Workflow。
向暂停中的人工介入表单提交接收人的响应。接受后工作流将继续;可通过订阅工作流事件接口跟踪后续事件。需要 WebApp 提交方式。
curl --request POST \
--url https://{api_base_url}/form/human_input/{form_token} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"inputs": {
"feedback": "可以发布",
"priority": "high",
"attachment": {
"transfer_method": "local_file",
"upload_file_id": "3c8fa1b2-7d4e-4f9a-b0c1-d2e3f4a5b6c7",
"type": "image"
},
"attachments": [
{
"transfer_method": "local_file",
"upload_file_id": "1a77f0df-c0e6-461c-987c-e72526f341ee",
"type": "document"
},
{
"transfer_method": "remote_url",
"url": "https://example.com/report.pdf",
"type": "document"
}
]
},
"action": "approve",
"user": "abc-123"
}
'import requests
url = "https://{api_base_url}/form/human_input/{form_token}"
payload = {
"inputs": {
"feedback": "可以发布",
"priority": "high",
"attachment": {
"transfer_method": "local_file",
"upload_file_id": "3c8fa1b2-7d4e-4f9a-b0c1-d2e3f4a5b6c7",
"type": "image"
},
"attachments": [
{
"transfer_method": "local_file",
"upload_file_id": "1a77f0df-c0e6-461c-987c-e72526f341ee",
"type": "document"
},
{
"transfer_method": "remote_url",
"url": "https://example.com/report.pdf",
"type": "document"
}
]
},
"action": "approve",
"user": "abc-123"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
inputs: {
feedback: '可以发布',
priority: 'high',
attachment: {
transfer_method: 'local_file',
upload_file_id: '3c8fa1b2-7d4e-4f9a-b0c1-d2e3f4a5b6c7',
type: 'image'
},
attachments: [
{
transfer_method: 'local_file',
upload_file_id: '1a77f0df-c0e6-461c-987c-e72526f341ee',
type: 'document'
},
{
transfer_method: 'remote_url',
url: 'https://example.com/report.pdf',
type: 'document'
}
]
},
action: 'approve',
user: 'abc-123'
})
};
fetch('https://{api_base_url}/form/human_input/{form_token}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{api_base_url}/form/human_input/{form_token}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'inputs' => [
'feedback' => '可以发布',
'priority' => 'high',
'attachment' => [
'transfer_method' => 'local_file',
'upload_file_id' => '3c8fa1b2-7d4e-4f9a-b0c1-d2e3f4a5b6c7',
'type' => 'image'
],
'attachments' => [
[
'transfer_method' => 'local_file',
'upload_file_id' => '1a77f0df-c0e6-461c-987c-e72526f341ee',
'type' => 'document'
],
[
'transfer_method' => 'remote_url',
'url' => 'https://example.com/report.pdf',
'type' => 'document'
]
]
],
'action' => 'approve',
'user' => 'abc-123'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{api_base_url}/form/human_input/{form_token}"
payload := strings.NewReader("{\n \"inputs\": {\n \"feedback\": \"可以发布\",\n \"priority\": \"high\",\n \"attachment\": {\n \"transfer_method\": \"local_file\",\n \"upload_file_id\": \"3c8fa1b2-7d4e-4f9a-b0c1-d2e3f4a5b6c7\",\n \"type\": \"image\"\n },\n \"attachments\": [\n {\n \"transfer_method\": \"local_file\",\n \"upload_file_id\": \"1a77f0df-c0e6-461c-987c-e72526f341ee\",\n \"type\": \"document\"\n },\n {\n \"transfer_method\": \"remote_url\",\n \"url\": \"https://example.com/report.pdf\",\n \"type\": \"document\"\n }\n ]\n },\n \"action\": \"approve\",\n \"user\": \"abc-123\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{api_base_url}/form/human_input/{form_token}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"inputs\": {\n \"feedback\": \"可以发布\",\n \"priority\": \"high\",\n \"attachment\": {\n \"transfer_method\": \"local_file\",\n \"upload_file_id\": \"3c8fa1b2-7d4e-4f9a-b0c1-d2e3f4a5b6c7\",\n \"type\": \"image\"\n },\n \"attachments\": [\n {\n \"transfer_method\": \"local_file\",\n \"upload_file_id\": \"1a77f0df-c0e6-461c-987c-e72526f341ee\",\n \"type\": \"document\"\n },\n {\n \"transfer_method\": \"remote_url\",\n \"url\": \"https://example.com/report.pdf\",\n \"type\": \"document\"\n }\n ]\n },\n \"action\": \"approve\",\n \"user\": \"abc-123\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{api_base_url}/form/human_input/{form_token}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"inputs\": {\n \"feedback\": \"可以发布\",\n \"priority\": \"high\",\n \"attachment\": {\n \"transfer_method\": \"local_file\",\n \"upload_file_id\": \"3c8fa1b2-7d4e-4f9a-b0c1-d2e3f4a5b6c7\",\n \"type\": \"image\"\n },\n \"attachments\": [\n {\n \"transfer_method\": \"local_file\",\n \"upload_file_id\": \"1a77f0df-c0e6-461c-987c-e72526f341ee\",\n \"type\": \"document\"\n },\n {\n \"transfer_method\": \"remote_url\",\n \"url\": \"https://example.com/report.pdf\",\n \"type\": \"document\"\n }\n ]\n },\n \"action\": \"approve\",\n \"user\": \"abc-123\"\n}"
response = http.request(request)
puts response.read_bodyAuthorizations
API Key 认证。对于所有 API 请求,请在 Authorization HTTP 头中包含您的 API Key,并加上 Bearer 前缀。示例:Authorization: Bearer {API_KEY}。强烈建议将 API Key 存储在服务端,不要在客户端共享或存储,以避免 API Key 泄漏导致严重后果。缺少或无效的 API Key 会返回 HTTP 401,错误码为 unauthorized。
Path Parameters
暂停表单的访问令牌,由流式模式下执行工作流或发送对话消息接口返回的 human_input_required 事件提供。
Body
按各输入的 output_variable_name 作为键提交的值。段落和下拉选项输入为字符串;file 输入为单个文件映射;file-list 输入为文件映射数组。文件映射为 {transfer_method: local_file, upload_file_id, type} 或 {transfer_method: remote_url, url, type},其中 type 为该字段 allowed_file_types 中的一种(image、document、audio、video、custom)。对于 local_file,upload_file_id 为 上传文件 返回的 id。请在执行、上传和提交各次调用中使用一致的 user。
用户标识符,由开发者定义的规则生成,必须在应用内唯一。Service API 与 WebApp 的用户 ID 相互独立,即使取值相同也不指向同一用户。
Response
表单提交成功。响应体为空对象。
The response is of type object.
Was this page helpful?
curl --request POST \
--url https://{api_base_url}/form/human_input/{form_token} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"inputs": {
"feedback": "可以发布",
"priority": "high",
"attachment": {
"transfer_method": "local_file",
"upload_file_id": "3c8fa1b2-7d4e-4f9a-b0c1-d2e3f4a5b6c7",
"type": "image"
},
"attachments": [
{
"transfer_method": "local_file",
"upload_file_id": "1a77f0df-c0e6-461c-987c-e72526f341ee",
"type": "document"
},
{
"transfer_method": "remote_url",
"url": "https://example.com/report.pdf",
"type": "document"
}
]
},
"action": "approve",
"user": "abc-123"
}
'import requests
url = "https://{api_base_url}/form/human_input/{form_token}"
payload = {
"inputs": {
"feedback": "可以发布",
"priority": "high",
"attachment": {
"transfer_method": "local_file",
"upload_file_id": "3c8fa1b2-7d4e-4f9a-b0c1-d2e3f4a5b6c7",
"type": "image"
},
"attachments": [
{
"transfer_method": "local_file",
"upload_file_id": "1a77f0df-c0e6-461c-987c-e72526f341ee",
"type": "document"
},
{
"transfer_method": "remote_url",
"url": "https://example.com/report.pdf",
"type": "document"
}
]
},
"action": "approve",
"user": "abc-123"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
inputs: {
feedback: '可以发布',
priority: 'high',
attachment: {
transfer_method: 'local_file',
upload_file_id: '3c8fa1b2-7d4e-4f9a-b0c1-d2e3f4a5b6c7',
type: 'image'
},
attachments: [
{
transfer_method: 'local_file',
upload_file_id: '1a77f0df-c0e6-461c-987c-e72526f341ee',
type: 'document'
},
{
transfer_method: 'remote_url',
url: 'https://example.com/report.pdf',
type: 'document'
}
]
},
action: 'approve',
user: 'abc-123'
})
};
fetch('https://{api_base_url}/form/human_input/{form_token}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{api_base_url}/form/human_input/{form_token}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'inputs' => [
'feedback' => '可以发布',
'priority' => 'high',
'attachment' => [
'transfer_method' => 'local_file',
'upload_file_id' => '3c8fa1b2-7d4e-4f9a-b0c1-d2e3f4a5b6c7',
'type' => 'image'
],
'attachments' => [
[
'transfer_method' => 'local_file',
'upload_file_id' => '1a77f0df-c0e6-461c-987c-e72526f341ee',
'type' => 'document'
],
[
'transfer_method' => 'remote_url',
'url' => 'https://example.com/report.pdf',
'type' => 'document'
]
]
],
'action' => 'approve',
'user' => 'abc-123'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{api_base_url}/form/human_input/{form_token}"
payload := strings.NewReader("{\n \"inputs\": {\n \"feedback\": \"可以发布\",\n \"priority\": \"high\",\n \"attachment\": {\n \"transfer_method\": \"local_file\",\n \"upload_file_id\": \"3c8fa1b2-7d4e-4f9a-b0c1-d2e3f4a5b6c7\",\n \"type\": \"image\"\n },\n \"attachments\": [\n {\n \"transfer_method\": \"local_file\",\n \"upload_file_id\": \"1a77f0df-c0e6-461c-987c-e72526f341ee\",\n \"type\": \"document\"\n },\n {\n \"transfer_method\": \"remote_url\",\n \"url\": \"https://example.com/report.pdf\",\n \"type\": \"document\"\n }\n ]\n },\n \"action\": \"approve\",\n \"user\": \"abc-123\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{api_base_url}/form/human_input/{form_token}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"inputs\": {\n \"feedback\": \"可以发布\",\n \"priority\": \"high\",\n \"attachment\": {\n \"transfer_method\": \"local_file\",\n \"upload_file_id\": \"3c8fa1b2-7d4e-4f9a-b0c1-d2e3f4a5b6c7\",\n \"type\": \"image\"\n },\n \"attachments\": [\n {\n \"transfer_method\": \"local_file\",\n \"upload_file_id\": \"1a77f0df-c0e6-461c-987c-e72526f341ee\",\n \"type\": \"document\"\n },\n {\n \"transfer_method\": \"remote_url\",\n \"url\": \"https://example.com/report.pdf\",\n \"type\": \"document\"\n }\n ]\n },\n \"action\": \"approve\",\n \"user\": \"abc-123\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{api_base_url}/form/human_input/{form_token}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"inputs\": {\n \"feedback\": \"可以发布\",\n \"priority\": \"high\",\n \"attachment\": {\n \"transfer_method\": \"local_file\",\n \"upload_file_id\": \"3c8fa1b2-7d4e-4f9a-b0c1-d2e3f4a5b6c7\",\n \"type\": \"image\"\n },\n \"attachments\": [\n {\n \"transfer_method\": \"local_file\",\n \"upload_file_id\": \"1a77f0df-c0e6-461c-987c-e72526f341ee\",\n \"type\": \"document\"\n },\n {\n \"transfer_method\": \"remote_url\",\n \"url\": \"https://example.com/report.pdf\",\n \"type\": \"document\"\n }\n ]\n },\n \"action\": \"approve\",\n \"user\": \"abc-123\"\n}"
response = http.request(request)
puts response.read_body