人間の入力フォームを送信
対象アプリ: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_body{}Authorizations
API Key 認証です。すべての API リクエストにおいて、Authorization HTTP ヘッダーに Bearer プレフィックスを付けた API Key を含めてください。例: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 を使用してください。
受信者が選択したアクションボタンの ID。フォームの user_actions リスト(人間の入力フォームを取得 エンドポイントから返される)にある id のいずれかと一致する必要があります。
ユーザー識別子。開発者のルールで定義され、アプリケーション内で一意である必要があります。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{}