curl --request POST \
--url https://api.wegly.com.br/integrations/external/chats/{id}/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "text",
"body": "Olá, tudo bem?"
}
'{
"total": 123,
"records": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"type": "text",
"origin": "INBOUND",
"from_me": true,
"sent_via": "CONTACT",
"status": "processing",
"body_text": "<string>",
"meta_timestamp": "2023-11-07T05:31:56Z",
"transcription": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"media": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"mime_type": "<string>",
"file_name": "<string>",
"is_downloaded": true,
"url": "<string>"
},
"call": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "RINGING",
"direction": "INBOUND",
"started_at": "2023-11-07T05:31:56Z",
"ended_at": "2023-11-07T05:31:56Z",
"duration_ms": 123,
"recording_processed": true,
"recording_available": true,
"has_recording": true
},
"content_payload": {},
"reactions": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"emoji": "<string>",
"actor": "CONTACT",
"reactor_wa_id": "<string>",
"reactor_user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z"
}
],
"is_history": true,
"history_phase": 123,
"history_chunk_order": 123,
"history_progress": 123,
"is_media_placeholder": true,
"agent": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"user": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"avatar": "<string>"
}
},
"user": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"avatar": "<string>"
},
"is_forwarded": true,
"error_code": 123,
"error_message": "<string>",
"quoted_message": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"type": "text",
"origin": "INBOUND",
"status": "processing",
"page": 123,
"from_me": true,
"sent_via": "CONTACT",
"body_text": "<string>",
"content_payload": {},
"reactions": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"emoji": "<string>",
"actor": "CONTACT",
"reactor_wa_id": "<string>",
"reactor_user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z"
}
],
"meta_timestamp": "2023-11-07T05:31:56Z",
"is_history": true,
"history_phase": 123,
"history_chunk_order": 123,
"history_progress": 123,
"is_media_placeholder": true,
"agent": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"user": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"avatar": "<string>"
}
},
"user": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"avatar": "<string>"
},
"transcription": "<string>",
"is_forwarded": true,
"error_code": 123,
"error_message": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"media": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"mime_type": "<string>",
"file_name": "<string>",
"is_downloaded": true,
"url": "<string>"
},
"whatsapp_ai_agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"whatsapp_ai_agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
]
}Enviar mensagem
Envio síncrono WhatsApp: aguarda o retorno imediato do provedor. Exige conteúdo ou anexos; fora da janela é necessário template. Texto e arquivos podem gerar vários records. Tipos interactive e location exigem as rotas próprias. Envio manual pode atribuir responsável e pausar fluxo WhatsApp ativo. type assume text quando omitido; para template, envie type=template e não envie body, pois o texto é enviado no lugar do template. Com type=template, os arquivos enviados servem apenas como mídia do cabeçalho. Cada arquivo aceita até 100 MB (16 MB para áudio); a falha de um arquivo volta em records com status=failed, ainda com resposta 201. 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 POST \
--url https://api.wegly.com.br/integrations/external/chats/{id}/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "text",
"body": "Olá, tudo bem?"
}
'{
"total": 123,
"records": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"type": "text",
"origin": "INBOUND",
"from_me": true,
"sent_via": "CONTACT",
"status": "processing",
"body_text": "<string>",
"meta_timestamp": "2023-11-07T05:31:56Z",
"transcription": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"media": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"mime_type": "<string>",
"file_name": "<string>",
"is_downloaded": true,
"url": "<string>"
},
"call": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "RINGING",
"direction": "INBOUND",
"started_at": "2023-11-07T05:31:56Z",
"ended_at": "2023-11-07T05:31:56Z",
"duration_ms": 123,
"recording_processed": true,
"recording_available": true,
"has_recording": true
},
"content_payload": {},
"reactions": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"emoji": "<string>",
"actor": "CONTACT",
"reactor_wa_id": "<string>",
"reactor_user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z"
}
],
"is_history": true,
"history_phase": 123,
"history_chunk_order": 123,
"history_progress": 123,
"is_media_placeholder": true,
"agent": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"user": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"avatar": "<string>"
}
},
"user": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"avatar": "<string>"
},
"is_forwarded": true,
"error_code": 123,
"error_message": "<string>",
"quoted_message": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"type": "text",
"origin": "INBOUND",
"status": "processing",
"page": 123,
"from_me": true,
"sent_via": "CONTACT",
"body_text": "<string>",
"content_payload": {},
"reactions": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"emoji": "<string>",
"actor": "CONTACT",
"reactor_wa_id": "<string>",
"reactor_user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z"
}
],
"meta_timestamp": "2023-11-07T05:31:56Z",
"is_history": true,
"history_phase": 123,
"history_chunk_order": 123,
"history_progress": 123,
"is_media_placeholder": true,
"agent": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"user": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"avatar": "<string>"
}
},
"user": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"avatar": "<string>"
},
"transcription": "<string>",
"is_forwarded": true,
"error_code": 123,
"error_message": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"media": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"mime_type": "<string>",
"file_name": "<string>",
"is_downloaded": true,
"url": "<string>"
},
"whatsapp_ai_agent_id": "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.
Body
Payload para envio de mensagem textual, template ou mídia em um chat existente.
Valores aceitos pelo DTO. Quando omitido, assume text; o template não é inferido pelo conteúdo e exige type=template. interactive e location são recusados nesta rota com 400; use as rotas dedicadas.
text, reaction, image, video, audio, document, location, template, interactive, call Texto da mensagem. Se houver anexos, o texto é enviado como mensagem separada e também como legenda de cada imagem, vídeo ou documento. Com type=template, não envie body: o texto seria enviado no lugar do template. Texto aberto admite até 4096 caracteres.
WAMID ou UUID local de uma mensagem de referência pertencente ao chat; a API resolve o WAMID antes do envio.
200Show child attributes
Show child attributes
Show child attributes
Show child attributes
