curl --request POST \
--url https://{server-url}/openai/create/{instance} \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"enabled": true,
"openaiCredsId": "<string>",
"botType": "<string>",
"assistantId": "<string>",
"functionUrl": "<string>",
"model": "<string>",
"systemMessages": [
"<string>"
],
"assistantMessages": [
"<string>"
],
"userMessages": [
"<string>"
],
"maxTokens": 123,
"triggerType": "<string>",
"triggerOperator": "<string>",
"triggerValue": "<string>",
"expire": 123,
"keywordFinish": "<string>",
"delayMessage": 123,
"unknownMessage": "<string>",
"listeningFromMe": true,
"stopBotFromMe": true,
"keepOpen": true,
"debounceTime": 123,
"ignoreJids": [
"<string>"
]
}
'import requests
url = "https://{server-url}/openai/create/{instance}"
payload = {
"enabled": True,
"openaiCredsId": "<string>",
"botType": "<string>",
"assistantId": "<string>",
"functionUrl": "<string>",
"model": "<string>",
"systemMessages": ["<string>"],
"assistantMessages": ["<string>"],
"userMessages": ["<string>"],
"maxTokens": 123,
"triggerType": "<string>",
"triggerOperator": "<string>",
"triggerValue": "<string>",
"expire": 123,
"keywordFinish": "<string>",
"delayMessage": 123,
"unknownMessage": "<string>",
"listeningFromMe": True,
"stopBotFromMe": True,
"keepOpen": True,
"debounceTime": 123,
"ignoreJids": ["<string>"]
}
headers = {
"apikey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {apikey: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
enabled: true,
openaiCredsId: '<string>',
botType: '<string>',
assistantId: '<string>',
functionUrl: '<string>',
model: '<string>',
systemMessages: ['<string>'],
assistantMessages: ['<string>'],
userMessages: ['<string>'],
maxTokens: 123,
triggerType: '<string>',
triggerOperator: '<string>',
triggerValue: '<string>',
expire: 123,
keywordFinish: '<string>',
delayMessage: 123,
unknownMessage: '<string>',
listeningFromMe: true,
stopBotFromMe: true,
keepOpen: true,
debounceTime: 123,
ignoreJids: ['<string>']
})
};
fetch('https://{server-url}/openai/create/{instance}', 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://{server-url}/openai/create/{instance}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'enabled' => true,
'openaiCredsId' => '<string>',
'botType' => '<string>',
'assistantId' => '<string>',
'functionUrl' => '<string>',
'model' => '<string>',
'systemMessages' => [
'<string>'
],
'assistantMessages' => [
'<string>'
],
'userMessages' => [
'<string>'
],
'maxTokens' => 123,
'triggerType' => '<string>',
'triggerOperator' => '<string>',
'triggerValue' => '<string>',
'expire' => 123,
'keywordFinish' => '<string>',
'delayMessage' => 123,
'unknownMessage' => '<string>',
'listeningFromMe' => true,
'stopBotFromMe' => true,
'keepOpen' => true,
'debounceTime' => 123,
'ignoreJids' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apikey: <api-key>"
],
]);
$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://{server-url}/openai/create/{instance}"
payload := strings.NewReader("{\n \"enabled\": true,\n \"openaiCredsId\": \"<string>\",\n \"botType\": \"<string>\",\n \"assistantId\": \"<string>\",\n \"functionUrl\": \"<string>\",\n \"model\": \"<string>\",\n \"systemMessages\": [\n \"<string>\"\n ],\n \"assistantMessages\": [\n \"<string>\"\n ],\n \"userMessages\": [\n \"<string>\"\n ],\n \"maxTokens\": 123,\n \"triggerType\": \"<string>\",\n \"triggerOperator\": \"<string>\",\n \"triggerValue\": \"<string>\",\n \"expire\": 123,\n \"keywordFinish\": \"<string>\",\n \"delayMessage\": 123,\n \"unknownMessage\": \"<string>\",\n \"listeningFromMe\": true,\n \"stopBotFromMe\": true,\n \"keepOpen\": true,\n \"debounceTime\": 123,\n \"ignoreJids\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("apikey", "<api-key>")
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.post("https://{server-url}/openai/create/{instance}")
.header("apikey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"enabled\": true,\n \"openaiCredsId\": \"<string>\",\n \"botType\": \"<string>\",\n \"assistantId\": \"<string>\",\n \"functionUrl\": \"<string>\",\n \"model\": \"<string>\",\n \"systemMessages\": [\n \"<string>\"\n ],\n \"assistantMessages\": [\n \"<string>\"\n ],\n \"userMessages\": [\n \"<string>\"\n ],\n \"maxTokens\": 123,\n \"triggerType\": \"<string>\",\n \"triggerOperator\": \"<string>\",\n \"triggerValue\": \"<string>\",\n \"expire\": 123,\n \"keywordFinish\": \"<string>\",\n \"delayMessage\": 123,\n \"unknownMessage\": \"<string>\",\n \"listeningFromMe\": true,\n \"stopBotFromMe\": true,\n \"keepOpen\": true,\n \"debounceTime\": 123,\n \"ignoreJids\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{server-url}/openai/create/{instance}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["apikey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"enabled\": true,\n \"openaiCredsId\": \"<string>\",\n \"botType\": \"<string>\",\n \"assistantId\": \"<string>\",\n \"functionUrl\": \"<string>\",\n \"model\": \"<string>\",\n \"systemMessages\": [\n \"<string>\"\n ],\n \"assistantMessages\": [\n \"<string>\"\n ],\n \"userMessages\": [\n \"<string>\"\n ],\n \"maxTokens\": 123,\n \"triggerType\": \"<string>\",\n \"triggerOperator\": \"<string>\",\n \"triggerValue\": \"<string>\",\n \"expire\": 123,\n \"keywordFinish\": \"<string>\",\n \"delayMessage\": 123,\n \"unknownMessage\": \"<string>\",\n \"listeningFromMe\": true,\n \"stopBotFromMe\": true,\n \"keepOpen\": true,\n \"debounceTime\": 123,\n \"ignoreJids\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_bodyThis response has no body data.Create OpenIA Bot
Create an OpenAI bot with detailed configuration
curl --request POST \
--url https://{server-url}/openai/create/{instance} \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"enabled": true,
"openaiCredsId": "<string>",
"botType": "<string>",
"assistantId": "<string>",
"functionUrl": "<string>",
"model": "<string>",
"systemMessages": [
"<string>"
],
"assistantMessages": [
"<string>"
],
"userMessages": [
"<string>"
],
"maxTokens": 123,
"triggerType": "<string>",
"triggerOperator": "<string>",
"triggerValue": "<string>",
"expire": 123,
"keywordFinish": "<string>",
"delayMessage": 123,
"unknownMessage": "<string>",
"listeningFromMe": true,
"stopBotFromMe": true,
"keepOpen": true,
"debounceTime": 123,
"ignoreJids": [
"<string>"
]
}
'import requests
url = "https://{server-url}/openai/create/{instance}"
payload = {
"enabled": True,
"openaiCredsId": "<string>",
"botType": "<string>",
"assistantId": "<string>",
"functionUrl": "<string>",
"model": "<string>",
"systemMessages": ["<string>"],
"assistantMessages": ["<string>"],
"userMessages": ["<string>"],
"maxTokens": 123,
"triggerType": "<string>",
"triggerOperator": "<string>",
"triggerValue": "<string>",
"expire": 123,
"keywordFinish": "<string>",
"delayMessage": 123,
"unknownMessage": "<string>",
"listeningFromMe": True,
"stopBotFromMe": True,
"keepOpen": True,
"debounceTime": 123,
"ignoreJids": ["<string>"]
}
headers = {
"apikey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {apikey: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
enabled: true,
openaiCredsId: '<string>',
botType: '<string>',
assistantId: '<string>',
functionUrl: '<string>',
model: '<string>',
systemMessages: ['<string>'],
assistantMessages: ['<string>'],
userMessages: ['<string>'],
maxTokens: 123,
triggerType: '<string>',
triggerOperator: '<string>',
triggerValue: '<string>',
expire: 123,
keywordFinish: '<string>',
delayMessage: 123,
unknownMessage: '<string>',
listeningFromMe: true,
stopBotFromMe: true,
keepOpen: true,
debounceTime: 123,
ignoreJids: ['<string>']
})
};
fetch('https://{server-url}/openai/create/{instance}', 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://{server-url}/openai/create/{instance}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'enabled' => true,
'openaiCredsId' => '<string>',
'botType' => '<string>',
'assistantId' => '<string>',
'functionUrl' => '<string>',
'model' => '<string>',
'systemMessages' => [
'<string>'
],
'assistantMessages' => [
'<string>'
],
'userMessages' => [
'<string>'
],
'maxTokens' => 123,
'triggerType' => '<string>',
'triggerOperator' => '<string>',
'triggerValue' => '<string>',
'expire' => 123,
'keywordFinish' => '<string>',
'delayMessage' => 123,
'unknownMessage' => '<string>',
'listeningFromMe' => true,
'stopBotFromMe' => true,
'keepOpen' => true,
'debounceTime' => 123,
'ignoreJids' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apikey: <api-key>"
],
]);
$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://{server-url}/openai/create/{instance}"
payload := strings.NewReader("{\n \"enabled\": true,\n \"openaiCredsId\": \"<string>\",\n \"botType\": \"<string>\",\n \"assistantId\": \"<string>\",\n \"functionUrl\": \"<string>\",\n \"model\": \"<string>\",\n \"systemMessages\": [\n \"<string>\"\n ],\n \"assistantMessages\": [\n \"<string>\"\n ],\n \"userMessages\": [\n \"<string>\"\n ],\n \"maxTokens\": 123,\n \"triggerType\": \"<string>\",\n \"triggerOperator\": \"<string>\",\n \"triggerValue\": \"<string>\",\n \"expire\": 123,\n \"keywordFinish\": \"<string>\",\n \"delayMessage\": 123,\n \"unknownMessage\": \"<string>\",\n \"listeningFromMe\": true,\n \"stopBotFromMe\": true,\n \"keepOpen\": true,\n \"debounceTime\": 123,\n \"ignoreJids\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("apikey", "<api-key>")
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.post("https://{server-url}/openai/create/{instance}")
.header("apikey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"enabled\": true,\n \"openaiCredsId\": \"<string>\",\n \"botType\": \"<string>\",\n \"assistantId\": \"<string>\",\n \"functionUrl\": \"<string>\",\n \"model\": \"<string>\",\n \"systemMessages\": [\n \"<string>\"\n ],\n \"assistantMessages\": [\n \"<string>\"\n ],\n \"userMessages\": [\n \"<string>\"\n ],\n \"maxTokens\": 123,\n \"triggerType\": \"<string>\",\n \"triggerOperator\": \"<string>\",\n \"triggerValue\": \"<string>\",\n \"expire\": 123,\n \"keywordFinish\": \"<string>\",\n \"delayMessage\": 123,\n \"unknownMessage\": \"<string>\",\n \"listeningFromMe\": true,\n \"stopBotFromMe\": true,\n \"keepOpen\": true,\n \"debounceTime\": 123,\n \"ignoreJids\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{server-url}/openai/create/{instance}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["apikey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"enabled\": true,\n \"openaiCredsId\": \"<string>\",\n \"botType\": \"<string>\",\n \"assistantId\": \"<string>\",\n \"functionUrl\": \"<string>\",\n \"model\": \"<string>\",\n \"systemMessages\": [\n \"<string>\"\n ],\n \"assistantMessages\": [\n \"<string>\"\n ],\n \"userMessages\": [\n \"<string>\"\n ],\n \"maxTokens\": 123,\n \"triggerType\": \"<string>\",\n \"triggerOperator\": \"<string>\",\n \"triggerValue\": \"<string>\",\n \"expire\": 123,\n \"keywordFinish\": \"<string>\",\n \"delayMessage\": 123,\n \"unknownMessage\": \"<string>\",\n \"listeningFromMe\": true,\n \"stopBotFromMe\": true,\n \"keepOpen\": true,\n \"debounceTime\": 123,\n \"ignoreJids\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_bodyThis response has no body data.Authorizations
Your authorization key header
Path Parameters
Name of the instance
Body
Indicates whether the bot is enabled
ID of the OpenAI credentials
Type of the bot (e.g., 'assistant')
Unique identifier for the assistant
URL for additional bot functionality
Model to be used (e.g., 'gpt-4o')
Messages to define system behavior
Predefined assistant messages
Predefined user messages
Maximum number of tokens per interaction
Type of trigger for the bot
Operator for trigger evaluation
Value to trigger the bot
Expiration time in seconds
Keyword to terminate the bot interaction
Delay before the bot responds, in milliseconds
Message to display for unrecognized input
Indicates if the bot listens to messages from the user
Indicates if the bot can be stopped by the user
Indicates if the bot session remains open
Debounce time for message processing
List of JIDs to ignore
Response
Ok

