Cancelar mensagem agendada
curl --request POST \
--url https://api.wegly.com.br/integrations/external/chats/{id}/scheduled-messages/{scheduledMessageId}/cancel \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"reason": "<string>"
}
'import requests
url = "https://api.wegly.com.br/integrations/external/chats/{id}/scheduled-messages/{scheduledMessageId}/cancel"
payload = { "reason": "<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({reason: '<string>'})
};
fetch('https://api.wegly.com.br/integrations/external/chats/{id}/scheduled-messages/{scheduledMessageId}/cancel', 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.wegly.com.br/integrations/external/chats/{id}/scheduled-messages/{scheduledMessageId}/cancel",
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([
'reason' => '<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.wegly.com.br/integrations/external/chats/{id}/scheduled-messages/{scheduledMessageId}/cancel"
payload := strings.NewReader("{\n \"reason\": \"<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.wegly.com.br/integrations/external/chats/{id}/scheduled-messages/{scheduledMessageId}/cancel")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"reason\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.wegly.com.br/integrations/external/chats/{id}/scheduled-messages/{scheduledMessageId}/cancel")
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 \"reason\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"chat_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"company_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"is_scheduled": true,
"status": "PENDING",
"message_kind": "OPEN_MESSAGE",
"cancel_reason": "USER_REQUEST",
"cancel_reason_description": "<string>",
"failure_reason": "<string>",
"cancel_on_inbound": true,
"scheduled_at": "2023-11-07T05:31:56Z",
"processed_at": "2023-11-07T05:31:56Z",
"sent_at": "2023-11-07T05:31:56Z",
"canceled_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"created_by_user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sender_agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"canceled_by_user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"payload": {
"type": "text",
"body": "<string>",
"template": {
"name": "<string>",
"language": "<string>"
},
"template_fields": [
{
"component": "HEADER",
"type": "TEXT",
"value": "<string>",
"index": 123,
"button_index": 123,
"card_index": 123
}
],
"reference_wamid": "<string>"
},
"attachments": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"file_name": "<string>",
"mime_type": "<string>",
"file_size": 123
}
],
"sent_message_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"whatsapp_ai_agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}Chats
Cancelar mensagem agendada
Somente PENDING pode ser cancelado. Retorna o agendamento com status CANCELED e cancel_reason USER_REQUEST; reason é opcional. Permissão da chave: crm/chats.write. O acesso também respeita a empresa e as permissões do usuário criador da chave.
POST
/
integrations
/
external
/
chats
/
{id}
/
scheduled-messages
/
{scheduledMessageId}
/
cancel
Cancelar mensagem agendada
curl --request POST \
--url https://api.wegly.com.br/integrations/external/chats/{id}/scheduled-messages/{scheduledMessageId}/cancel \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"reason": "<string>"
}
'import requests
url = "https://api.wegly.com.br/integrations/external/chats/{id}/scheduled-messages/{scheduledMessageId}/cancel"
payload = { "reason": "<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({reason: '<string>'})
};
fetch('https://api.wegly.com.br/integrations/external/chats/{id}/scheduled-messages/{scheduledMessageId}/cancel', 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.wegly.com.br/integrations/external/chats/{id}/scheduled-messages/{scheduledMessageId}/cancel",
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([
'reason' => '<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.wegly.com.br/integrations/external/chats/{id}/scheduled-messages/{scheduledMessageId}/cancel"
payload := strings.NewReader("{\n \"reason\": \"<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.wegly.com.br/integrations/external/chats/{id}/scheduled-messages/{scheduledMessageId}/cancel")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"reason\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.wegly.com.br/integrations/external/chats/{id}/scheduled-messages/{scheduledMessageId}/cancel")
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 \"reason\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"chat_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"company_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"is_scheduled": true,
"status": "PENDING",
"message_kind": "OPEN_MESSAGE",
"cancel_reason": "USER_REQUEST",
"cancel_reason_description": "<string>",
"failure_reason": "<string>",
"cancel_on_inbound": true,
"scheduled_at": "2023-11-07T05:31:56Z",
"processed_at": "2023-11-07T05:31:56Z",
"sent_at": "2023-11-07T05:31:56Z",
"canceled_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"created_by_user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sender_agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"canceled_by_user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"payload": {
"type": "text",
"body": "<string>",
"template": {
"name": "<string>",
"language": "<string>"
},
"template_fields": [
{
"component": "HEADER",
"type": "TEXT",
"value": "<string>",
"index": 123,
"button_index": 123,
"card_index": 123
}
],
"reference_wamid": "<string>"
},
"attachments": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"file_name": "<string>",
"mime_type": "<string>",
"file_size": 123
}
],
"sent_message_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"whatsapp_ai_agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}Authorizations
Chave de integração com prefixo wegly_, enviada em Authorization: Bearer . Não é JWT. A chave deve estar ativa, não excluída e dentro da validade. Com allowed_domain, Origin (ou Referer na ausência de Origin) precisa informar o hostname permitido. A empresa e as permissões são obtidas pela chave.
Path Parameters
UUID da conversa.
UUID da mensagem agendada.
Body
application/json
Maximum string length:
500Response
Operação realizada.
Available options:
true Available options:
PENDING, PROCESSING, SENT, CANCELED, FAILED Available options:
OPEN_MESSAGE, TEMPLATE Available options:
USER_REQUEST, CHAT_INTERACTION, TEMPLATE_INVALID_OR_UNAVAILABLE Show child attributes
Show child attributes
Show child attributes
Show child attributes
Agente de IA que criou o agendamento; null para agendamentos criados por pessoas ou pela integração.
