Skip to main content
POST
/
v1
/
actions
Create a New Action
curl --request POST \
  --url https://api.trata.ai/v1/actions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "get_delivery_date",
  "description": "Get the delivery date for a customer'\''s order. Call this whenever you need to know the delivery date, for example when a customer asks '\''Where is my package'\''",
  "parameters": false,
  "endpoint": {
    "url": "http://example.com/api/action",
    "method": "POST",
    "headers": "application/json",
    "payload": "123456"
  },
  "userWaitingText": "Please wait while we get the delivery date for your order",
  "userSuccessText": "We have sent you an email with the delivery date",
  "userErrorText": "We are unable to get the delivery date for your order",
  "invocationTrigger": "user_query"
}'
{
  "id": "act.1234567890",
  "orgId": "org.1234567890",
  "name": "Webhook on call completion.",
  "description": "This action will be invoked when a call is completed. It will send a webhook to the specified url.",
  "parameters": {},
  "endpoint": {
    "url": "https://webhook-endpoint.com",
    "method": "POST"
  },
  "invocationTrigger": "webhook.conversation_en",
  "userWaitingText": "Please wait...",
  "userSuccessText": "Action completed successfully",
  "userErrorText": "An error occurred",
  "createdBy": "usr.1234567890",
  "createdAt": "2024-12-06T19:23:38.616711",
  "updatedBy": "usr.1234567890",
  "updatedAt": "2024-12-06T19:23:38.616714"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
name
string
required

Name of the action

Required string length: 1 - 512
Example:

"get_delivery_date"

parameters
object
required

Parameters for the action. It should be a JSON schema object

Example:

false

endpoint
object
required

Endpoint for the action

  • HttpActionEndpoint
  • InternalActionEndpoint
invocationTrigger
enum<string>
required

Trigger who invokes the action

Available options:
user_query,
webhook.conversation_start,
webhook.conversation_end
description
string | null

Description about the action and it should also contain when the action should be triggered

Required string length: 1 - 512
Example:

"Get the delivery date for a customer's order. Call this whenever you need to know the delivery date, for example when a customer asks 'Where is my package'"

userWaitingText
string | null

Text to be rendered to user when action is invoked

Maximum length: 2048
Example:

"Please wait while we get the delivery date for your order"

userSuccessText
string | null

Text to be rendered to user when action is successful

Maximum length: 2048
Example:

"We have sent you an email with the delivery date"

userErrorText
string | null

Text to be rendered to user when action is not successful

Maximum length: 2048
Example:

"We are unable to get the delivery date for your order"

Response

Action created successfully

Action entity to store the actions which can be performed by ai agents

id
string
orgId
string
name
string
description
string | null
parameters
object | null
endpoint
object | null
invocationTrigger
string | null
userWaitingText
string | null
userSuccessText
string | null
userErrorText
string | null
createdBy
string
createdAt
string<date-time>
updatedBy
string
updatedAt
string<date-time>
I