cURL
curl --request POST \
--url https://api.gptmaker.ai/v2/agent/{agentId}/conversation \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"contextId": "12345",
"prompt": "oi qual seu nome?",
"callbackUrl": "https://webhook.site",
"onFinishCallback": "https://webhook.site",
"chatName": "Fulano",
"chatPicture": "https://foto.jpeg",
"phone": "55xxxxxxxx"
}
'import requests
url = "https://api.gptmaker.ai/v2/agent/{agentId}/conversation"
payload = {
"contextId": "12345",
"prompt": "oi qual seu nome?",
"callbackUrl": "https://webhook.site",
"onFinishCallback": "https://webhook.site",
"chatName": "Fulano",
"chatPicture": "https://foto.jpeg",
"phone": "55xxxxxxxx"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
contextId: '12345',
prompt: 'oi qual seu nome?',
callbackUrl: 'https://webhook.site',
onFinishCallback: 'https://webhook.site',
chatName: 'Fulano',
chatPicture: 'https://foto.jpeg',
phone: '55xxxxxxxx'
})
};
fetch('https://api.gptmaker.ai/v2/agent/{agentId}/conversation', 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.gptmaker.ai/v2/agent/{agentId}/conversation",
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([
'contextId' => '12345',
'prompt' => 'oi qual seu nome?',
'callbackUrl' => 'https://webhook.site',
'onFinishCallback' => 'https://webhook.site',
'chatName' => 'Fulano',
'chatPicture' => 'https://foto.jpeg',
'phone' => '55xxxxxxxx'
]),
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.gptmaker.ai/v2/agent/{agentId}/conversation"
payload := strings.NewReader("{\n \"contextId\": \"12345\",\n \"prompt\": \"oi qual seu nome?\",\n \"callbackUrl\": \"https://webhook.site\",\n \"onFinishCallback\": \"https://webhook.site\",\n \"chatName\": \"Fulano\",\n \"chatPicture\": \"https://foto.jpeg\",\n \"phone\": \"55xxxxxxxx\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.gptmaker.ai/v2/agent/{agentId}/conversation")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"contextId\": \"12345\",\n \"prompt\": \"oi qual seu nome?\",\n \"callbackUrl\": \"https://webhook.site\",\n \"onFinishCallback\": \"https://webhook.site\",\n \"chatName\": \"Fulano\",\n \"chatPicture\": \"https://foto.jpeg\",\n \"phone\": \"55xxxxxxxx\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gptmaker.ai/v2/agent/{agentId}/conversation")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"contextId\": \"12345\",\n \"prompt\": \"oi qual seu nome?\",\n \"callbackUrl\": \"https://webhook.site\",\n \"onFinishCallback\": \"https://webhook.site\",\n \"chatName\": \"Fulano\",\n \"chatPicture\": \"https://foto.jpeg\",\n \"phone\": \"55xxxxxxxx\"\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"images": [
"<string>"
],
"audios": [
"<string>"
],
"documents": [
"<string>"
]
}{
"error": "<string>"
}{
"error": "<string>"
}Agentes
Conversar com agente
Permite conversar com o agente via API enviando texto, imagem ou áudio
POST
/
v2
/
agent
/
{agentId}
/
conversation
cURL
curl --request POST \
--url https://api.gptmaker.ai/v2/agent/{agentId}/conversation \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"contextId": "12345",
"prompt": "oi qual seu nome?",
"callbackUrl": "https://webhook.site",
"onFinishCallback": "https://webhook.site",
"chatName": "Fulano",
"chatPicture": "https://foto.jpeg",
"phone": "55xxxxxxxx"
}
'import requests
url = "https://api.gptmaker.ai/v2/agent/{agentId}/conversation"
payload = {
"contextId": "12345",
"prompt": "oi qual seu nome?",
"callbackUrl": "https://webhook.site",
"onFinishCallback": "https://webhook.site",
"chatName": "Fulano",
"chatPicture": "https://foto.jpeg",
"phone": "55xxxxxxxx"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
contextId: '12345',
prompt: 'oi qual seu nome?',
callbackUrl: 'https://webhook.site',
onFinishCallback: 'https://webhook.site',
chatName: 'Fulano',
chatPicture: 'https://foto.jpeg',
phone: '55xxxxxxxx'
})
};
fetch('https://api.gptmaker.ai/v2/agent/{agentId}/conversation', 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.gptmaker.ai/v2/agent/{agentId}/conversation",
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([
'contextId' => '12345',
'prompt' => 'oi qual seu nome?',
'callbackUrl' => 'https://webhook.site',
'onFinishCallback' => 'https://webhook.site',
'chatName' => 'Fulano',
'chatPicture' => 'https://foto.jpeg',
'phone' => '55xxxxxxxx'
]),
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.gptmaker.ai/v2/agent/{agentId}/conversation"
payload := strings.NewReader("{\n \"contextId\": \"12345\",\n \"prompt\": \"oi qual seu nome?\",\n \"callbackUrl\": \"https://webhook.site\",\n \"onFinishCallback\": \"https://webhook.site\",\n \"chatName\": \"Fulano\",\n \"chatPicture\": \"https://foto.jpeg\",\n \"phone\": \"55xxxxxxxx\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.gptmaker.ai/v2/agent/{agentId}/conversation")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"contextId\": \"12345\",\n \"prompt\": \"oi qual seu nome?\",\n \"callbackUrl\": \"https://webhook.site\",\n \"onFinishCallback\": \"https://webhook.site\",\n \"chatName\": \"Fulano\",\n \"chatPicture\": \"https://foto.jpeg\",\n \"phone\": \"55xxxxxxxx\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gptmaker.ai/v2/agent/{agentId}/conversation")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"contextId\": \"12345\",\n \"prompt\": \"oi qual seu nome?\",\n \"callbackUrl\": \"https://webhook.site\",\n \"onFinishCallback\": \"https://webhook.site\",\n \"chatName\": \"Fulano\",\n \"chatPicture\": \"https://foto.jpeg\",\n \"phone\": \"55xxxxxxxx\"\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"images": [
"<string>"
],
"audios": [
"<string>"
],
"documents": [
"<string>"
]
}{
"error": "<string>"
}{
"error": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
ID do agente
Body
application/json
Dados para conversar com o agente
- Texto
- Imagem
- Áudio
- Vídeo
- Documento
ID externo para identificar o cliente
Example:
"12345"
Texto para o agente responder
Example:
"oi qual seu nome?"
Caso seja informado, a chamada será assíncrona, quando o agente responder, ele vai chamar esse webhook com a resposta.
Example:
"https://webhook.site"
Caso seja informado, será disparado um webhook sempre que o atendimento for finalizado.
Example:
"https://webhook.site"
Você pode informar o nome do cliente caso já possua.
Example:
"Fulano"
Uma foto do cliente que será mostrada no chat de atendimento.
Example:
"https://foto.jpeg"
Número de whatsapp do cliente.
Example:
"55xxxxxxxx"
⌘I

