Executar ação da Z-API (GET)
curl --request GET \
--url https://api.gptmaker.ai/v2/channel/{channelId}/whatsapp/{action} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.gptmaker.ai/v2/channel/{channelId}/whatsapp/{action}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.gptmaker.ai/v2/channel/{channelId}/whatsapp/{action}', 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}/whatsapp/{action}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.gptmaker.ai/v2/channel/{channelId}/whatsapp/{action}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.gptmaker.ai/v2/channel/{channelId}/whatsapp/{action}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gptmaker.ai/v2/channel/{channelId}/whatsapp/{action}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"zaapId": "3999984263738042930CD6ECDE9VDWSA",
"messageId": "D241XXXX732339502B68",
"id": "D241XXXX732339502B68"
}{
"error": "phone is required"
}{
"error": "<string>"
}{
"error": "not found"
}{
"error": "z-api unavailable"
}Whatsapp
Executar ação da Z-API (GET)
Repassa a chamada para a API da Z-API usando a instância do canal no GPT Maker. Use para recursos da Z-API que a API do GPT Maker ainda não expõe, como lista de opções (send-option-list) e botões (send-button-list).
actioné o caminho da rota na Z-API depois de/instances/{instância}/token/{token}/, por exemplosend-option-list. Pode ter mais de um trecho, comochats/5511999999999.- O corpo e a query string vão para a Z-API como foram enviados, e a resposta é a da Z-API.
- Funciona só para canais Z-API.
- Envios (rotas
send-*) exigemphoneno corpo. - Mensagens enviadas por aqui aparecem no chat do GPT Maker e não acionam o agente.
- Rotas bloqueadas: alteração de webhooks (
update-webhook-*eupdate-every-webhooks) eme.
Erros
| Status | Quando |
|---|---|
404 | Canal inexistente, de outra conta ou que não é Z-API, rota bloqueada ou caminho inválido. |
400 | Envio (send-*) sem phone no corpo. |
502 | A Z-API não respondeu. |
Os demais erros vêm da Z-API, com o status e o corpo dela.
GET
/
v2
/
channel
/
{channelId}
/
whatsapp
/
{action}
Executar ação da Z-API (GET)
curl --request GET \
--url https://api.gptmaker.ai/v2/channel/{channelId}/whatsapp/{action} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.gptmaker.ai/v2/channel/{channelId}/whatsapp/{action}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.gptmaker.ai/v2/channel/{channelId}/whatsapp/{action}', 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}/whatsapp/{action}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.gptmaker.ai/v2/channel/{channelId}/whatsapp/{action}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.gptmaker.ai/v2/channel/{channelId}/whatsapp/{action}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gptmaker.ai/v2/channel/{channelId}/whatsapp/{action}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"zaapId": "3999984263738042930CD6ECDE9VDWSA",
"messageId": "D241XXXX732339502B68",
"id": "D241XXXX732339502B68"
}{
"error": "phone is required"
}{
"error": "<string>"
}{
"error": "not found"
}{
"error": "z-api unavailable"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
ID do canal Z-API
Rota da Z-API, por exemplo send-option-list
Response
Resposta da Z-API
The response is of type object.

