Serverless AI Bot Trigger
AI powered bot trigger service that determines if user input can trigger external APIs and generates appropriate payloads.
Endpoint
Trigger external APIs based on user input
POSThttps://api.xtartapp.com/bot/trigger
*Authentication
You must use a Bearer token provided by the dashboard to use for authentication. Add the token to the Authorization header.
Request body
Name | Type | Required | Max | Description |
---|---|---|---|---|
ask | string | Yes | 500 | The user input message |
triggers | array of objects | Yes | 10 | List of possible triggers to evaluate |
triggers[].name | string | Yes | 50 | The name of the trigger |
triggers[].url | string | Yes | - | The URL to trigger when the input matches the criteria |
triggers[].objective | string | Yes | 100 | The objective of the trigger |
triggers[].parameters | array of strings | No | 50 | List of parameter names that can be used with this trigger |
history | array of objects | No | 15 | Previous conversation history between user and bot |
history[].role | string | Yes | - | The role of the message sender (user or bot) |
history[].content | string | Yes | 500 | The message content |
context | array of strings | No | 25 | Additional context information for trigger evaluation |
context[] | string | Yes | 500 | Additional context information for trigger evaluation |
language | string | No | - | The language code for the response |
Response
Name | Type | Description |
---|---|---|
data | object | The trigger response data |
data.triggers | array | Array of relevant triggers with explanations and confidence scores |
data.triggers[].name | string | The name of the relevant trigger |
data.triggers[].explanation | string | Explanation of why the trigger is relevant |
data.triggers[].confidence | number | Confidence score between 0 and 1 |
data.triggers[].payload | object | The parsed parameters as a JSON object to be submitted to the trigger URL |
data.triggers[].url | string | The URL of the matched trigger |
data.response | string | The response to the user message |
metadata | object | Metadata about the trigger process |
metadata.cost | number | The cost of the trigger request |
Errors
{
"error": "string",
"code": "string"
}
HTTP Status | Error Code | Message |
---|---|---|
400 | INVALID_PAYLOAD | Occurs when the payload is invalid. |
400 | INVALID_REQUEST | Ex.: The request is invalid. |
400 | BOT_TRIGGER_ERROR | Ex: could not process trigger | parsing error |
400 | HARM_CONTENT | Ex.: The content is harmful and cannot be processed. |
400 | INSUFFICIENT_BALANCE | The user has insufficient balance |
400 | INPUT_TOO_LONG | The input text exceeds the maximum length |
401 | UNAUTHORIZED | Ex.: The token is invalid. |
429 | TOO_MANY_REQUESTS | Ex.: The request limit has been reached. |