AI Functions
Update AI function
Changes settings on an existing AI function. Call aiFunctions.list to resolve its id first.
PUT
/
v1
/
ai-functions
/
{id}
Update AI function
curl --request PUT \
--url https://app.chatbotx.io/api/v1/ai-functions/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"dataCollect": [
{
"from": "<string>",
"to": "<string>"
}
],
"purpose": "<string>",
"outputMessage": "<string>",
"triggerFlowId": "<string>"
}
'import requests
url = "https://app.chatbotx.io/api/v1/ai-functions/{id}"
payload = {
"name": "<string>",
"dataCollect": [
{
"from": "<string>",
"to": "<string>"
}
],
"purpose": "<string>",
"outputMessage": "<string>",
"triggerFlowId": "<string>"
}
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: '<string>',
dataCollect: [{from: '<string>', to: '<string>'}],
purpose: '<string>',
outputMessage: '<string>',
triggerFlowId: '<string>'
})
};
fetch('https://app.chatbotx.io/api/v1/ai-functions/{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://app.chatbotx.io/api/v1/ai-functions/{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' => '<string>',
'dataCollect' => [
[
'from' => '<string>',
'to' => '<string>'
]
],
'purpose' => '<string>',
'outputMessage' => '<string>',
'triggerFlowId' => '<string>'
]),
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://app.chatbotx.io/api/v1/ai-functions/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"dataCollect\": [\n {\n \"from\": \"<string>\",\n \"to\": \"<string>\"\n }\n ],\n \"purpose\": \"<string>\",\n \"outputMessage\": \"<string>\",\n \"triggerFlowId\": \"<string>\"\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://app.chatbotx.io/api/v1/ai-functions/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"dataCollect\": [\n {\n \"from\": \"<string>\",\n \"to\": \"<string>\"\n }\n ],\n \"purpose\": \"<string>\",\n \"outputMessage\": \"<string>\",\n \"triggerFlowId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.chatbotx.io/api/v1/ai-functions/{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\": \"<string>\",\n \"dataCollect\": [\n {\n \"from\": \"<string>\",\n \"to\": \"<string>\"\n }\n ],\n \"purpose\": \"<string>\",\n \"outputMessage\": \"<string>\",\n \"triggerFlowId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"name": "<string>",
"purpose": "<string>",
"dataCollect": "<string>",
"outputMessage": "<string>",
"workspaceId": "<string>",
"triggerFlowId": null
}{
"defined": true,
"code": "businessError",
"status": 400,
"message": "An error occurred while processing your request",
"data": "<unknown>"
}{
"defined": true,
"code": "UNAUTHORIZED",
"status": 401,
"message": "Authentication required",
"data": "<unknown>"
}{
"defined": true,
"code": "FORBIDDEN",
"status": 403,
"message": "You do not have permission to perform this action",
"data": "<unknown>"
}{
"defined": true,
"code": "notFound",
"status": 404,
"message": "Resource not found",
"data": "<unknown>"
}{
"defined": true,
"code": "invalidRequestData",
"status": 422,
"message": "Input validation failed",
"data": {
"issues": [
{
"message": "<string>",
"path": [
"<string>"
]
}
]
}
}{
"defined": true,
"code": "tooManyRequests",
"status": 429,
"message": "Too many requests",
"data": "<unknown>"
}{
"defined": true,
"code": "INTERNAL_SERVER_ERROR",
"status": 500,
"message": "An unexpected error occurred",
"data": "<unknown>"
}Authorizations
bearerAuthdeveloperAccessTokentokenInSearchParams
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
AI function id. Get it from aiFunctions.list.
Pattern:
^\d+$Body
application/json
AI function name.
Minimum string length:
1Field mappings collecting model output into contact/custom fields.
Show child attributes
Show child attributes
Description of when the model should call this function.
Message sent to the contact after this function runs.
Flow id (numeric string) to start after this function runs.
Pattern:
^\d+$Response
OK
Was this page helpful?
⌘I
Update AI function
curl --request PUT \
--url https://app.chatbotx.io/api/v1/ai-functions/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"dataCollect": [
{
"from": "<string>",
"to": "<string>"
}
],
"purpose": "<string>",
"outputMessage": "<string>",
"triggerFlowId": "<string>"
}
'import requests
url = "https://app.chatbotx.io/api/v1/ai-functions/{id}"
payload = {
"name": "<string>",
"dataCollect": [
{
"from": "<string>",
"to": "<string>"
}
],
"purpose": "<string>",
"outputMessage": "<string>",
"triggerFlowId": "<string>"
}
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: '<string>',
dataCollect: [{from: '<string>', to: '<string>'}],
purpose: '<string>',
outputMessage: '<string>',
triggerFlowId: '<string>'
})
};
fetch('https://app.chatbotx.io/api/v1/ai-functions/{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://app.chatbotx.io/api/v1/ai-functions/{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' => '<string>',
'dataCollect' => [
[
'from' => '<string>',
'to' => '<string>'
]
],
'purpose' => '<string>',
'outputMessage' => '<string>',
'triggerFlowId' => '<string>'
]),
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://app.chatbotx.io/api/v1/ai-functions/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"dataCollect\": [\n {\n \"from\": \"<string>\",\n \"to\": \"<string>\"\n }\n ],\n \"purpose\": \"<string>\",\n \"outputMessage\": \"<string>\",\n \"triggerFlowId\": \"<string>\"\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://app.chatbotx.io/api/v1/ai-functions/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"dataCollect\": [\n {\n \"from\": \"<string>\",\n \"to\": \"<string>\"\n }\n ],\n \"purpose\": \"<string>\",\n \"outputMessage\": \"<string>\",\n \"triggerFlowId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.chatbotx.io/api/v1/ai-functions/{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\": \"<string>\",\n \"dataCollect\": [\n {\n \"from\": \"<string>\",\n \"to\": \"<string>\"\n }\n ],\n \"purpose\": \"<string>\",\n \"outputMessage\": \"<string>\",\n \"triggerFlowId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"name": "<string>",
"purpose": "<string>",
"dataCollect": "<string>",
"outputMessage": "<string>",
"workspaceId": "<string>",
"triggerFlowId": null
}{
"defined": true,
"code": "businessError",
"status": 400,
"message": "An error occurred while processing your request",
"data": "<unknown>"
}{
"defined": true,
"code": "UNAUTHORIZED",
"status": 401,
"message": "Authentication required",
"data": "<unknown>"
}{
"defined": true,
"code": "FORBIDDEN",
"status": 403,
"message": "You do not have permission to perform this action",
"data": "<unknown>"
}{
"defined": true,
"code": "notFound",
"status": 404,
"message": "Resource not found",
"data": "<unknown>"
}{
"defined": true,
"code": "invalidRequestData",
"status": 422,
"message": "Input validation failed",
"data": {
"issues": [
{
"message": "<string>",
"path": [
"<string>"
]
}
]
}
}{
"defined": true,
"code": "tooManyRequests",
"status": 429,
"message": "Too many requests",
"data": "<unknown>"
}{
"defined": true,
"code": "INTERNAL_SERVER_ERROR",
"status": 500,
"message": "An unexpected error occurred",
"data": "<unknown>"
}