Register a new action
curl --request POST \
--url https://api.flowent.chat/api/v1/gateway/actions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "send_email",
"description": "Send an email to a specified recipient",
"webhook_url": "https://your-server.com/actions/send_email",
"json_schema": {
"type": "object",
"properties": {
"recipient": {
"type": "string",
"description": "Email address of the recipient"
},
"subject": {
"type": "string",
"description": "Email subject line"
},
"body": {
"type": "string",
"description": "Email body content"
}
},
"required": [
"recipient",
"subject",
"body"
]
}
}
'import requests
url = "https://api.flowent.chat/api/v1/gateway/actions"
payload = {
"name": "send_email",
"description": "Send an email to a specified recipient",
"webhook_url": "https://your-server.com/actions/send_email",
"json_schema": {
"type": "object",
"properties": {
"recipient": {
"type": "string",
"description": "Email address of the recipient"
},
"subject": {
"type": "string",
"description": "Email subject line"
},
"body": {
"type": "string",
"description": "Email body content"
}
},
"required": ["recipient", "subject", "body"]
}
}
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({
name: 'send_email',
description: 'Send an email to a specified recipient',
webhook_url: 'https://your-server.com/actions/send_email',
json_schema: {
type: 'object',
properties: {
recipient: {type: 'string', description: 'Email address of the recipient'},
subject: {type: 'string', description: 'Email subject line'},
body: JSON.stringify({type: 'string', description: 'Email body content'})
},
required: ['recipient', 'subject', 'body']
}
})
};
fetch('https://api.flowent.chat/api/v1/gateway/actions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"action": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"tenant_id": "123e4567-e89b-12d3-a456-426614174001",
"name": "send_email",
"description": "Send an email to a specified recipient",
"json_schema": {
"type": "object",
"properties": {
"recipient": {
"type": "string",
"description": "Email address of the recipient"
},
"subject": {
"type": "string",
"description": "Email subject line"
},
"body": {
"type": "string",
"description": "Email body content"
}
},
"required": [
"recipient",
"subject",
"body"
]
},
"webhook_url": "https://your-server.com/actions/send_email",
"created_at": "2023-01-01T12:00:00Z",
"updated_at": "2023-01-01T12:00:00Z"
}
}{
"error": "Invalid request format",
"details": "Field 'name' is required"
}{
"error": "Invalid token"
}{
"error": "action with name 'send_email' already exists"
}Actions
Register a new action
Register a new action with Flowent. The action’s webhook URL will be validated with a test request during registration.
POST
/
actions
Register a new action
curl --request POST \
--url https://api.flowent.chat/api/v1/gateway/actions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "send_email",
"description": "Send an email to a specified recipient",
"webhook_url": "https://your-server.com/actions/send_email",
"json_schema": {
"type": "object",
"properties": {
"recipient": {
"type": "string",
"description": "Email address of the recipient"
},
"subject": {
"type": "string",
"description": "Email subject line"
},
"body": {
"type": "string",
"description": "Email body content"
}
},
"required": [
"recipient",
"subject",
"body"
]
}
}
'import requests
url = "https://api.flowent.chat/api/v1/gateway/actions"
payload = {
"name": "send_email",
"description": "Send an email to a specified recipient",
"webhook_url": "https://your-server.com/actions/send_email",
"json_schema": {
"type": "object",
"properties": {
"recipient": {
"type": "string",
"description": "Email address of the recipient"
},
"subject": {
"type": "string",
"description": "Email subject line"
},
"body": {
"type": "string",
"description": "Email body content"
}
},
"required": ["recipient", "subject", "body"]
}
}
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({
name: 'send_email',
description: 'Send an email to a specified recipient',
webhook_url: 'https://your-server.com/actions/send_email',
json_schema: {
type: 'object',
properties: {
recipient: {type: 'string', description: 'Email address of the recipient'},
subject: {type: 'string', description: 'Email subject line'},
body: JSON.stringify({type: 'string', description: 'Email body content'})
},
required: ['recipient', 'subject', 'body']
}
})
};
fetch('https://api.flowent.chat/api/v1/gateway/actions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"action": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"tenant_id": "123e4567-e89b-12d3-a456-426614174001",
"name": "send_email",
"description": "Send an email to a specified recipient",
"json_schema": {
"type": "object",
"properties": {
"recipient": {
"type": "string",
"description": "Email address of the recipient"
},
"subject": {
"type": "string",
"description": "Email subject line"
},
"body": {
"type": "string",
"description": "Email body content"
}
},
"required": [
"recipient",
"subject",
"body"
]
},
"webhook_url": "https://your-server.com/actions/send_email",
"created_at": "2023-01-01T12:00:00Z",
"updated_at": "2023-01-01T12:00:00Z"
}
}{
"error": "Invalid request format",
"details": "Field 'name' is required"
}{
"error": "Invalid token"
}{
"error": "action with name 'send_email' already exists"
}Authorizations
JWT token obtained from token exchange
Body
application/json
Action name (lowercase, underscores, no spaces)
Required string length:
1 - 100Pattern:
^[a-z0-9_]+$Example:
"send_email"
Human-readable description of the action
Required string length:
1 - 500Example:
"Send an email to a specified recipient"
URL where the action will be executed (must be HTTPS in production)
Example:
"https://your-server.com/actions/send_email"
JSON Schema defining the action's parameters
Example:
{
"type": "object",
"properties": {
"recipient": {
"type": "string",
"description": "Email address of the recipient"
},
"subject": {
"type": "string",
"description": "Email subject line"
},
"body": {
"type": "string",
"description": "Email body content"
}
},
"required": ["recipient", "subject", "body"]
}
Response
Action created successfully
Show child attributes
Show child attributes