cURL
curl --request POST \
--url https://api.gptmaker.ai/v2/channel/{channelId}/start-conversation \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"phone": "<string>",
"message": "<string>"
}
'import requests
url = "https://api.gptmaker.ai/v2/channel/{channelId}/start-conversation"
payload = {
"phone": "<string>",
"message": "<string>"
}
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({phone: '<string>', message: '<string>'})
};
fetch('https://api.gptmaker.ai/v2/channel/{channelId}/start-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/channel/{channelId}/start-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([
'phone' => '<string>',
'message' => '<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://api.gptmaker.ai/v2/channel/{channelId}/start-conversation"
payload := strings.NewReader("{\n \"phone\": \"<string>\",\n \"message\": \"<string>\"\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/channel/{channelId}/start-conversation")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"phone\": \"<string>\",\n \"message\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gptmaker.ai/v2/channel/{channelId}/start-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 \"phone\": \"<string>\",\n \"message\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true
}Whatsapp
Iniciar conversa
Iniciar conversa
Arquivos em base64
Os campos image, audio, video e document aceitam a URL pública do arquivo ou o próprio arquivo em base64. Em base64, envie como data URI, com o tipo no prefixo: data:<tipo>;base64,<conteúdo>. Base64 sem o prefixo não é aceito.
O GPT Maker guarda o arquivo e entrega ao canal uma URL própria.
Limites
- Até 14 MB por arquivo, depois de decodificado.
- Imagem com até 50 milhões de pixels.
Tipos aceitos
image:image/jpeg,image/png,image/gif,image/webpaudio:audio/mpeg,audio/ogg,audio/opus,audio/wav,audio/aac,audio/amr,audio/mp4,audio/x-m4avideo:video/mp4,video/3gpp,video/quicktime,video/webmdocument:application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation,text/plain,text/csv,text/markdown,text/rtf
O canal ainda aplica os próprios limites. No WhatsApp oficial, por exemplo, a imagem precisa ser JPEG ou PNG de até 5 MB, e o vídeo, MP4 ou 3GP.
Erros
Quando o arquivo é recusado, a resposta é 400 com error e errorCode:
errorCode | Motivo |
|---|---|
INVALID_BASE64 | O conteúdo não é base64 válido ou não corresponde ao tipo informado. |
UNSUPPORTED_MEDIA_TYPE | O tipo não está na lista aceita. |
MEDIA_TOO_LARGE | O arquivo passa de 14 MB. |
IMAGE_TOO_LARGE | A imagem passa de 50 milhões de pixels. |
POST
/
v2
/
channel
/
{channelId}
/
start-conversation
cURL
curl --request POST \
--url https://api.gptmaker.ai/v2/channel/{channelId}/start-conversation \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"phone": "<string>",
"message": "<string>"
}
'import requests
url = "https://api.gptmaker.ai/v2/channel/{channelId}/start-conversation"
payload = {
"phone": "<string>",
"message": "<string>"
}
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({phone: '<string>', message: '<string>'})
};
fetch('https://api.gptmaker.ai/v2/channel/{channelId}/start-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/channel/{channelId}/start-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([
'phone' => '<string>',
'message' => '<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://api.gptmaker.ai/v2/channel/{channelId}/start-conversation"
payload := strings.NewReader("{\n \"phone\": \"<string>\",\n \"message\": \"<string>\"\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/channel/{channelId}/start-conversation")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"phone\": \"<string>\",\n \"message\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gptmaker.ai/v2/channel/{channelId}/start-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 \"phone\": \"<string>\",\n \"message\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true
}Authorizations
Body
application/json
Dados da mensagem a ser disparada, atualmente iniciar a conversa só está disponível para canais do tipo Whatsapp não oficial.

