curl --request PUT \
--url https://api.trata.ai/v1/actions/{action_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"name": "get_delivery_date",
"parameters": false,
"endpoint": {
"url": "http://example.com/api/action",
"method": "POST",
"headers": "application/json",
"payload": "123456"
},
"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'",
"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"
}
EOFimport requests
url = "https://api.trata.ai/v1/actions/{action_id}"
payload = {
"name": "get_delivery_date",
"parameters": False,
"endpoint": {
"url": "http://example.com/api/action",
"method": "POST",
"headers": "application/json",
"payload": "123456"
},
"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'",
"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"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'get_delivery_date',
parameters: false,
endpoint: {
url: 'http://example.com/api/action',
method: 'POST',
headers: 'application/json',
payload: '123456'
},
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\'',
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'
})
};
fetch('https://api.trata.ai/v1/actions/{action_id}', 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.trata.ai/v1/actions/{action_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'get_delivery_date',
'parameters' => false,
'endpoint' => [
'url' => 'http://example.com/api/action',
'method' => 'POST',
'headers' => 'application/json',
'payload' => '123456'
],
'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\'',
'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'
]),
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.trata.ai/v1/actions/{action_id}"
payload := strings.NewReader("{\n \"name\": \"get_delivery_date\",\n \"parameters\": false,\n \"endpoint\": {\n \"url\": \"http://example.com/api/action\",\n \"method\": \"POST\",\n \"headers\": \"application/json\",\n \"payload\": \"123456\"\n },\n \"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'\",\n \"userWaitingText\": \"Please wait while we get the delivery date for your order\",\n \"userSuccessText\": \"We have sent you an email with the delivery date\",\n \"userErrorText\": \"We are unable to get the delivery date for your order\"\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.trata.ai/v1/actions/{action_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"get_delivery_date\",\n \"parameters\": false,\n \"endpoint\": {\n \"url\": \"http://example.com/api/action\",\n \"method\": \"POST\",\n \"headers\": \"application/json\",\n \"payload\": \"123456\"\n },\n \"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'\",\n \"userWaitingText\": \"Please wait while we get the delivery date for your order\",\n \"userSuccessText\": \"We have sent you an email with the delivery date\",\n \"userErrorText\": \"We are unable to get the delivery date for your order\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.trata.ai/v1/actions/{action_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"get_delivery_date\",\n \"parameters\": false,\n \"endpoint\": {\n \"url\": \"http://example.com/api/action\",\n \"method\": \"POST\",\n \"headers\": \"application/json\",\n \"payload\": \"123456\"\n },\n \"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'\",\n \"userWaitingText\": \"Please wait while we get the delivery date for your order\",\n \"userSuccessText\": \"We have sent you an email with the delivery date\",\n \"userErrorText\": \"We are unable to get the delivery date for your order\"\n}"
response = http.request(request)
puts response.read_body{
"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"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Update a Specific Action by ID
Update a Specific Action by ID
curl --request PUT \
--url https://api.trata.ai/v1/actions/{action_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"name": "get_delivery_date",
"parameters": false,
"endpoint": {
"url": "http://example.com/api/action",
"method": "POST",
"headers": "application/json",
"payload": "123456"
},
"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'",
"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"
}
EOFimport requests
url = "https://api.trata.ai/v1/actions/{action_id}"
payload = {
"name": "get_delivery_date",
"parameters": False,
"endpoint": {
"url": "http://example.com/api/action",
"method": "POST",
"headers": "application/json",
"payload": "123456"
},
"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'",
"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"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'get_delivery_date',
parameters: false,
endpoint: {
url: 'http://example.com/api/action',
method: 'POST',
headers: 'application/json',
payload: '123456'
},
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\'',
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'
})
};
fetch('https://api.trata.ai/v1/actions/{action_id}', 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.trata.ai/v1/actions/{action_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'get_delivery_date',
'parameters' => false,
'endpoint' => [
'url' => 'http://example.com/api/action',
'method' => 'POST',
'headers' => 'application/json',
'payload' => '123456'
],
'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\'',
'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'
]),
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.trata.ai/v1/actions/{action_id}"
payload := strings.NewReader("{\n \"name\": \"get_delivery_date\",\n \"parameters\": false,\n \"endpoint\": {\n \"url\": \"http://example.com/api/action\",\n \"method\": \"POST\",\n \"headers\": \"application/json\",\n \"payload\": \"123456\"\n },\n \"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'\",\n \"userWaitingText\": \"Please wait while we get the delivery date for your order\",\n \"userSuccessText\": \"We have sent you an email with the delivery date\",\n \"userErrorText\": \"We are unable to get the delivery date for your order\"\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.trata.ai/v1/actions/{action_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"get_delivery_date\",\n \"parameters\": false,\n \"endpoint\": {\n \"url\": \"http://example.com/api/action\",\n \"method\": \"POST\",\n \"headers\": \"application/json\",\n \"payload\": \"123456\"\n },\n \"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'\",\n \"userWaitingText\": \"Please wait while we get the delivery date for your order\",\n \"userSuccessText\": \"We have sent you an email with the delivery date\",\n \"userErrorText\": \"We are unable to get the delivery date for your order\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.trata.ai/v1/actions/{action_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"get_delivery_date\",\n \"parameters\": false,\n \"endpoint\": {\n \"url\": \"http://example.com/api/action\",\n \"method\": \"POST\",\n \"headers\": \"application/json\",\n \"payload\": \"123456\"\n },\n \"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'\",\n \"userWaitingText\": \"Please wait while we get the delivery date for your order\",\n \"userSuccessText\": \"We have sent you an email with the delivery date\",\n \"userErrorText\": \"We are unable to get the delivery date for your order\"\n}"
response = http.request(request)
puts response.read_body{
"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"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
ID of the action
Body
Name of the action
1 - 512"get_delivery_date"
Parameters for the action. It should be a JSON schema object
false
Endpoint for the action
- HttpActionEndpoint
- InternalActionEndpoint
Show child attributes
Show child attributes
Trigger who invokes the action
user_query, webhook.conversation_start, webhook.conversation_end Description about the action and it should also contain when the action should be triggered
1 - 512"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'"
Text to be rendered to user when action is invoked
2048"Please wait while we get the delivery date for your order"
Text to be rendered to user when action is successful
2048"We have sent you an email with the delivery date"
Text to be rendered to user when action is not successful
2048"We are unable to get the delivery date for your order"
Response
Action updated successfully
Action entity to store the actions which can be performed by ai agents
