Executar ação da Z-API (PUT)
curl --request PUT \
--url https://api.gptmaker.ai/v2/channel/{channelId}/whatsapp/{action} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"phone": "5511999999999",
"message": "Escolha uma opção",
"optionList": {
"title": "Opções",
"buttonLabel": "Ver opções",
"options": [
{
"id": "1",
"title": "Suporte",
"description": "Falar com o suporte"
},
{
"id": "2",
"title": "Vendas"
}
]
}
}
'import requests
url = "https://api.gptmaker.ai/v2/channel/{channelId}/whatsapp/{action}"
payload = {
"phone": "5511999999999",
"message": "Escolha uma opção",
"optionList": {
"title": "Opções",
"buttonLabel": "Ver opções",
"options": [
{
"id": "1",
"title": "Suporte",
"description": "Falar com o suporte"
},
{
"id": "2",
"title": "Vendas"
}
]
}
}
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({
phone: '5511999999999',
message: 'Escolha uma opção',
optionList: {
title: 'Opções',
buttonLabel: 'Ver opções',
options: [
{id: '1', title: 'Suporte', description: 'Falar com o suporte'},
{id: '2', title: 'Vendas'}
]
}
})
};
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 => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'phone' => '5511999999999',
'message' => 'Escolha uma opção',
'optionList' => [
'title' => 'Opções',
'buttonLabel' => 'Ver opções',
'options' => [
[
'id' => '1',
'title' => 'Suporte',
'description' => 'Falar com o suporte'
],
[
'id' => '2',
'title' => 'Vendas'
]
]
]
]),
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}/whatsapp/{action}"
payload := strings.NewReader("{\n \"phone\": \"5511999999999\",\n \"message\": \"Escolha uma opção\",\n \"optionList\": {\n \"title\": \"Opções\",\n \"buttonLabel\": \"Ver opções\",\n \"options\": [\n {\n \"id\": \"1\",\n \"title\": \"Suporte\",\n \"description\": \"Falar com o suporte\"\n },\n {\n \"id\": \"2\",\n \"title\": \"Vendas\"\n }\n ]\n }\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://api.gptmaker.ai/v2/channel/{channelId}/whatsapp/{action}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"phone\": \"5511999999999\",\n \"message\": \"Escolha uma opção\",\n \"optionList\": {\n \"title\": \"Opções\",\n \"buttonLabel\": \"Ver opções\",\n \"options\": [\n {\n \"id\": \"1\",\n \"title\": \"Suporte\",\n \"description\": \"Falar com o suporte\"\n },\n {\n \"id\": \"2\",\n \"title\": \"Vendas\"\n }\n ]\n }\n}")
.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::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"phone\": \"5511999999999\",\n \"message\": \"Escolha uma opção\",\n \"optionList\": {\n \"title\": \"Opções\",\n \"buttonLabel\": \"Ver opções\",\n \"options\": [\n {\n \"id\": \"1\",\n \"title\": \"Suporte\",\n \"description\": \"Falar com o suporte\"\n },\n {\n \"id\": \"2\",\n \"title\": \"Vendas\"\n }\n ]\n }\n}"
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 (PUT)
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.
PUT
/
v2
/
channel
/
{channelId}
/
whatsapp
/
{action}
Executar ação da Z-API (PUT)
curl --request PUT \
--url https://api.gptmaker.ai/v2/channel/{channelId}/whatsapp/{action} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"phone": "5511999999999",
"message": "Escolha uma opção",
"optionList": {
"title": "Opções",
"buttonLabel": "Ver opções",
"options": [
{
"id": "1",
"title": "Suporte",
"description": "Falar com o suporte"
},
{
"id": "2",
"title": "Vendas"
}
]
}
}
'import requests
url = "https://api.gptmaker.ai/v2/channel/{channelId}/whatsapp/{action}"
payload = {
"phone": "5511999999999",
"message": "Escolha uma opção",
"optionList": {
"title": "Opções",
"buttonLabel": "Ver opções",
"options": [
{
"id": "1",
"title": "Suporte",
"description": "Falar com o suporte"
},
{
"id": "2",
"title": "Vendas"
}
]
}
}
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({
phone: '5511999999999',
message: 'Escolha uma opção',
optionList: {
title: 'Opções',
buttonLabel: 'Ver opções',
options: [
{id: '1', title: 'Suporte', description: 'Falar com o suporte'},
{id: '2', title: 'Vendas'}
]
}
})
};
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 => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'phone' => '5511999999999',
'message' => 'Escolha uma opção',
'optionList' => [
'title' => 'Opções',
'buttonLabel' => 'Ver opções',
'options' => [
[
'id' => '1',
'title' => 'Suporte',
'description' => 'Falar com o suporte'
],
[
'id' => '2',
'title' => 'Vendas'
]
]
]
]),
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}/whatsapp/{action}"
payload := strings.NewReader("{\n \"phone\": \"5511999999999\",\n \"message\": \"Escolha uma opção\",\n \"optionList\": {\n \"title\": \"Opções\",\n \"buttonLabel\": \"Ver opções\",\n \"options\": [\n {\n \"id\": \"1\",\n \"title\": \"Suporte\",\n \"description\": \"Falar com o suporte\"\n },\n {\n \"id\": \"2\",\n \"title\": \"Vendas\"\n }\n ]\n }\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://api.gptmaker.ai/v2/channel/{channelId}/whatsapp/{action}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"phone\": \"5511999999999\",\n \"message\": \"Escolha uma opção\",\n \"optionList\": {\n \"title\": \"Opções\",\n \"buttonLabel\": \"Ver opções\",\n \"options\": [\n {\n \"id\": \"1\",\n \"title\": \"Suporte\",\n \"description\": \"Falar com o suporte\"\n },\n {\n \"id\": \"2\",\n \"title\": \"Vendas\"\n }\n ]\n }\n}")
.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::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"phone\": \"5511999999999\",\n \"message\": \"Escolha uma opção\",\n \"optionList\": {\n \"title\": \"Opções\",\n \"buttonLabel\": \"Ver opções\",\n \"options\": [\n {\n \"id\": \"1\",\n \"title\": \"Suporte\",\n \"description\": \"Falar com o suporte\"\n },\n {\n \"id\": \"2\",\n \"title\": \"Vendas\"\n }\n ]\n }\n}"
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
Body
application/json
Corpo da rota da Z-API
Response
Resposta da Z-API
The response is of type object.

