curl --request PATCH \
--url https://api.wegly.com.br/integrations/external/chats/{id}/scheduled-messages/{scheduledMessageId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"scheduled_at": "2023-11-07T05:31:56Z",
"cancel_on_inbound": true,
"body": "<string>",
"template_fields": [
{
"value": "<string>",
"index": 123,
"button_index": 123,
"card_index": 123
}
],
"reference_wamid": "<string>",
"replace_files": true
}
'import requests
url = "https://api.wegly.com.br/integrations/external/chats/{id}/scheduled-messages/{scheduledMessageId}"
payload = {
"scheduled_at": "2023-11-07T05:31:56Z",
"cancel_on_inbound": True,
"body": "<string>",
"template_fields": [
{
"value": "<string>",
"index": 123,
"button_index": 123,
"card_index": 123
}
],
"reference_wamid": "<string>",
"replace_files": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
scheduled_at: '2023-11-07T05:31:56Z',
cancel_on_inbound: true,
body: JSON.stringify('<string>'),
template_fields: [{value: '<string>', index: 123, button_index: 123, card_index: 123}],
reference_wamid: '<string>',
replace_files: true
})
};
fetch('https://api.wegly.com.br/integrations/external/chats/{id}/scheduled-messages/{scheduledMessageId}', 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}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'scheduled_at' => '2023-11-07T05:31:56Z',
'cancel_on_inbound' => true,
'body' => '<string>',
'template_fields' => [
[
'value' => '<string>',
'index' => 123,
'button_index' => 123,
'card_index' => 123
]
],
'reference_wamid' => '<string>',
'replace_files' => true
]),
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}"
payload := strings.NewReader("{\n \"scheduled_at\": \"2023-11-07T05:31:56Z\",\n \"cancel_on_inbound\": true,\n \"body\": \"<string>\",\n \"template_fields\": [\n {\n \"value\": \"<string>\",\n \"index\": 123,\n \"button_index\": 123,\n \"card_index\": 123\n }\n ],\n \"reference_wamid\": \"<string>\",\n \"replace_files\": true\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.wegly.com.br/integrations/external/chats/{id}/scheduled-messages/{scheduledMessageId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"scheduled_at\": \"2023-11-07T05:31:56Z\",\n \"cancel_on_inbound\": true,\n \"body\": \"<string>\",\n \"template_fields\": [\n {\n \"value\": \"<string>\",\n \"index\": 123,\n \"button_index\": 123,\n \"card_index\": 123\n }\n ],\n \"reference_wamid\": \"<string>\",\n \"replace_files\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.wegly.com.br/integrations/external/chats/{id}/scheduled-messages/{scheduledMessageId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"scheduled_at\": \"2023-11-07T05:31:56Z\",\n \"cancel_on_inbound\": true,\n \"body\": \"<string>\",\n \"template_fields\": [\n {\n \"value\": \"<string>\",\n \"index\": 123,\n \"button_index\": 123,\n \"card_index\": 123\n }\n ],\n \"reference_wamid\": \"<string>\",\n \"replace_files\": true\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"
}Atualizar mensagem agendada
Somente PENDING pode ser editado. Campos ausentes preservam o valor atual. Novos arquivos substituem todos os anexos; replace_files=true sem arquivos limpa os anexos. Revalida data futura e janela de atendimento. Agendamentos criados por agente de IA não podem ser editados e retornam 400; o cancelamento continua disponível. Permissão da chave: crm/chats.write. O acesso também respeita a empresa e as permissões do usuário criador da chave.
curl --request PATCH \
--url https://api.wegly.com.br/integrations/external/chats/{id}/scheduled-messages/{scheduledMessageId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"scheduled_at": "2023-11-07T05:31:56Z",
"cancel_on_inbound": true,
"body": "<string>",
"template_fields": [
{
"value": "<string>",
"index": 123,
"button_index": 123,
"card_index": 123
}
],
"reference_wamid": "<string>",
"replace_files": true
}
'import requests
url = "https://api.wegly.com.br/integrations/external/chats/{id}/scheduled-messages/{scheduledMessageId}"
payload = {
"scheduled_at": "2023-11-07T05:31:56Z",
"cancel_on_inbound": True,
"body": "<string>",
"template_fields": [
{
"value": "<string>",
"index": 123,
"button_index": 123,
"card_index": 123
}
],
"reference_wamid": "<string>",
"replace_files": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
scheduled_at: '2023-11-07T05:31:56Z',
cancel_on_inbound: true,
body: JSON.stringify('<string>'),
template_fields: [{value: '<string>', index: 123, button_index: 123, card_index: 123}],
reference_wamid: '<string>',
replace_files: true
})
};
fetch('https://api.wegly.com.br/integrations/external/chats/{id}/scheduled-messages/{scheduledMessageId}', 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}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'scheduled_at' => '2023-11-07T05:31:56Z',
'cancel_on_inbound' => true,
'body' => '<string>',
'template_fields' => [
[
'value' => '<string>',
'index' => 123,
'button_index' => 123,
'card_index' => 123
]
],
'reference_wamid' => '<string>',
'replace_files' => true
]),
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}"
payload := strings.NewReader("{\n \"scheduled_at\": \"2023-11-07T05:31:56Z\",\n \"cancel_on_inbound\": true,\n \"body\": \"<string>\",\n \"template_fields\": [\n {\n \"value\": \"<string>\",\n \"index\": 123,\n \"button_index\": 123,\n \"card_index\": 123\n }\n ],\n \"reference_wamid\": \"<string>\",\n \"replace_files\": true\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.wegly.com.br/integrations/external/chats/{id}/scheduled-messages/{scheduledMessageId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"scheduled_at\": \"2023-11-07T05:31:56Z\",\n \"cancel_on_inbound\": true,\n \"body\": \"<string>\",\n \"template_fields\": [\n {\n \"value\": \"<string>\",\n \"index\": 123,\n \"button_index\": 123,\n \"card_index\": 123\n }\n ],\n \"reference_wamid\": \"<string>\",\n \"replace_files\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.wegly.com.br/integrations/external/chats/{id}/scheduled-messages/{scheduledMessageId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"scheduled_at\": \"2023-11-07T05:31:56Z\",\n \"cancel_on_inbound\": true,\n \"body\": \"<string>\",\n \"template_fields\": [\n {\n \"value\": \"<string>\",\n \"index\": 123,\n \"button_index\": 123,\n \"card_index\": 123\n }\n ],\n \"reference_wamid\": \"<string>\",\n \"replace_files\": true\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
Data/hora futura com fuso, em ISO 8601.
Quando omitido, passa a template se template for enviado; caso contrário, mantém o tipo atual do agendamento.
text, template Show child attributes
Show child attributes
Show child attributes
Show child attributes
200true remove/substitui anexos anteriores. Enviar novos arquivos também substitui todos os anexos anteriores.
Response
Operação realizada.
true PENDING, PROCESSING, SENT, CANCELED, FAILED OPEN_MESSAGE, TEMPLATE 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.
