Instance criada com sucesso, mas envio de mensagens retorna "instance does not exist"
Welcome!
- [x] Yes, I have searched for similar issues on GitHub and found none.
What did you do?
Estamos tentando utilizar a Evolution API (versão v2.2.3) em um ambiente Kubernetes. A instância é criada com sucesso, conseguimos visualizá-la via fetchInstances, mas ao tentar enviar uma mensagem, a API responde que a instância não existe, mesmo utilizando o ID retornado no fetchInstances.
Ambiente está configurado conforme a seguir:
- name: SERVER_URL value: https://evolution-api.xxxx
- name: LOG_LEVEL value: DEBUG
- name: LOG_BAILEYS value: debug
- name: LOG_COLOR value: "true"
- name: DATABASE_ENABLED value: "true"
- name: DATABASE_PROVIDER value: postgresql
- name: DATABASE_CONNECTION_URI value: postgresql://xxxxxx/evolutixxxx?schema=public
- name: DATABASE_CONNECTION_CLIENT_NAME value: evolution_v2
- name: AUTHENTICATION_API_KEY value: ak5vxxxxx image: atendai/evolution-api:v2.2.3
What did you expect?
Esperávamos conseguir enviar uma mensagem para um número via API, utilizando o ID da instância retornado pela própria Evolution API (fetchInstances) com um dos tokens válidos (global ou da instância).
What did you observe instead of what you expected?
Ao tentar enviar a mensagem com a chamada abaixo (usando token global):
curl --request POST
--url https://evolution-api.xxxxxxx/message/sendText/5b2aaf54-2dcc-4c75-8fb0-745e998ed014
--header 'Content-Type: application/json'
--header 'apikey: ak5vxxxx'
--data '{"number": "+5575998578250","text": "teste"}'
Ou com o token da instância:
curl --request POST
--url https://evolution-api.xxxxxxx/message/sendText/5b2aaf54-2dcc-4c75-8fb0-745e998ed014
--header 'Content-Type: application/json'
--header 'apikey: 12C2xxxxxxx'
--data '{"number": "+5575998578250","text": "teste"}'
A resposta é sempre a seguinte:
{ "status": 404, "error": "Not Found", "response": { "message": [ "The "5b2aaf54-2dcc-4c75-8fb0-745e998ed014" instance does not exist" ] } }
Screenshots/Videos
Confirmação que a API está funcional:
date; curl --request GET --url https://evolution-api.xxxx | jq
{ "status": 200, "message": "Welcome to the Evolution API, it is working!", "version": "2.2.3", "clientName": "evolution_v2", "manager": "http://evolution-api.xxxx/manager", "documentation": "https://doc.evolution-api.com" }
Resposta da API ao listar instâncias:
[ { "id": "5b2aaf54-2dcc-4c75-8fb0-745e998ed014", "name": "numero2", "connectionStatus": "open", "ownerJid": "[email protected]", "profileName": "xxxxxxxxxx", "profilePicUrl": "https://pps.whatsapp.net/v/xxxxxxxx", "integration": "WHATSAPP-BAILEYS", "number": null, "businessId": null, "token": "12Cxxxxxxxxx", "clientName": "evolution_v2", "disconnectionReasonCode": null, "disconnectionObject": null, "disconnectionAt": null, "createdAt": "2025-04-16T17:45:11.792Z", "updatedAt": "2025-04-17T12:48:33.669Z", "Chatwoot": null, "Proxy": null, "Rabbitmq": null, "Sqs": null, "Websocket": null, "Setting": { "id": "cm9k825br00024w4jdrzusisl", "rejectCall": false, "msgCall": "", "groupsIgnore": false, "alwaysOnline": false, "readMessages": false, "readStatus": false, "syncFullHistory": false, "wavoipToken": "", "createdAt": "2025-04-16T17:45:11.798Z", "updatedAt": "2025-04-16T17:45:11.798Z", "instanceId": "5b2aaf54-2dcc-4c75-8fb0-745e998ed014" }, "_count": { "Message": 0, "Contact": 0, "Chat": 0 } }
1- Confirmando se o evolution esta ok:
date;curl --request GET --url http://evolution-api/|jq Thu Apr 17 14:12:55 UTC 2025
{ "status": 200, "message": "Welcome to the Evolution API, it is working!", "version": "2.2.3", "clientName": "evolution_v2", "manager": "http://evolution-api/manager", "documentation": "https://doc.evolution-api.com" }
............... 2- Listando a Instance:
date;curl --request GET --url http://evolution-api/instance/fetchInstances --header 'Content-Type: application/json' --header 'apikey: 12C25C3xxxxxx'|jq
Thu Apr 17 14:13:48 UTC 2025
[ { "id": "5b2aaf54-2dcc-4c75-8fb0-745e998ed014", "name": "numero2", "connectionStatus": "open", "ownerJid": "[email protected]", "profileName": "xxxxxx", "profilePicUrl": "https://pps.whatsapp.net/v/xxxxxxx", "integration": "WHATSAPP-BAILEYS", "number": null, "businessId": null, "token": "12C25Cxxxxxxxx", "clientName": "evolution_v2", "disconnectionReasonCode": null, "disconnectionObject": null, "disconnectionAt": null, "createdAt": "2025-04-16T17:45:11.792Z", "updatedAt": "2025-04-17T13:38:33.014Z", "Chatwoot": null, "Proxy": null, "Rabbitmq": null, "Sqs": null, "Websocket": null, "Setting": { "id": "cm9k825br00024w4jdrzusisl", "rejectCall": false, "msgCall": "", "groupsIgnore": false, "alwaysOnline": false, "readMessages": false, "readStatus": false, "syncFullHistory": false, "wavoipToken": "", "createdAt": "2025-04-16T17:45:11.798Z", "updatedAt": "2025-04-16T17:45:11.798Z", "instanceId": "5b2aaf54-2dcc-4c75-8fb0-745e998ed014" }, "_count": { "Message": 0, "Contact": 0, "Chat": 0 } } ]
3- Tentando enviar uma mensagem:
#usando o Token global:
date;curl --request POST --url http://evolution-api/message/sendText/5b2aaf54-2dcc-4c75-8fb0-745e998ed014 --header 'Content-Type: application/json' --header 'apikey: ak5vVxxxxxx' --data '{"number": "+5575998578250","text": "teste"}'
Thu Apr 17 14:15:54 UTC 2025
{"status":404,"error":"Not Found","response":{"message":["The "5b2aaf54-2dcc-4c75-8fb0-745e998ed014" instance does not exist"]}}
#usando o Token da instancia: date;curl --request POST --url http://evolution-api/message/sendText/5b2aaf54-2dcc-4c75-8fb0-745e998ed014 --header 'Content-Type: application/json' --header 'apikey: 12C25Cxxxxx' --data '{"number": "+5575998578250","text": "teste"}'
Thu Apr 17 14:17:06 UTC 2025
{"status":404,"error":"Not Found","response":{"message":["The "5b2aaf54-2dcc-4c75-8fb0-745e998ed014" instance does not exist"]}}
Which version of the API are you using?
atendai/evolution-api:v2.2.3
What is your environment?
Kubernetes
Other environment specifications
Orquestração: Kubernetes
Database: PostgreSQL
Client Name: evolution_v2
API Key: Global e por instância (testado com ambos)
Ambiente configurado com variáveis de ambiente descritas acima
If applicable, paste the log output
Infelizmente os logs não mostraram erro claro relacionado ao envio da mensagem. Mas se necessário, posso coletar logs com mais verbosidade.
Additional Notes
O comportamento é confuso, pois a instância é retornada corretamente na listagem (fetchInstances), mas a tentativa de envio de mensagem acusa que ela não existe. Esse problema impede o uso da API em produção.
Gostaríamos de apoio para entender:
Se é necessário algum outro tipo de "registro" da instância além da criação.
Se há diferenciação entre o ID de instância para listar e para enviar mensagens.
Se há alguma limitação no uso com PostgreSQL ou algo mal documentado.
Agradecemos desde já o suporte!
Ao contrário do que diz a documentação, ao invés de passar o id da instância, é esperado o nome da instância.
No seu exemplo numero2
@tondatto, Sua resposta foi bem a tempo. Estava tendo o mesmo problema. Consegui usando os seguintes dados:
url: http://localhost:8080/message/sendText/<Nome da Instancia>
Body:
{
"number":"<numero de telefone com código do país, sem o sinal +>, ex: 5575xxxxxx",
"delay":123,
"text":"
Headers
{
"Content-Type": "application/json",
"apikey":"
Ao contrário do que diz a documentação, ao invés de passar o
idda instância, é esperado onomeda instância. No seu exemplonumero2
ja tava achando que eu estava louco , muito obrigado
Ao contrário do que diz a documentação, ao invés de passar o
idda instância, é esperado onomeda instância. No seu exemplonumero2
Herói. Obrigado!
Estou tentando em uma instancia com status open, mas estou recebendo timeout, esse timeout seria de onde?
curl --request GET --url https://evolution-api.xxxxxx.com/instance/fetchInstances --header 'Content-Type: application/json' --header 'apikey:xxxxxxxx'|jq
[ { "id": "2fab6011-9402-4f7e-8a71-ad2bfceea57d", "name": "teste3", "connectionStatus": "open", "ownerJid": "[email protected]", "profileName": null,
"integration": "WHATSAPP-BAILEYS",
"number": null,
"businessId": null,
"token": "xxxxx",
"clientName": "evolution_v2",
"disconnectionReasonCode": null,
"disconnectionObject": null,
"disconnectionAt": null,
"Chatwoot": null,
"Proxy": null,
"Rabbitmq": null,
"Sqs": null,
"Websocket": null,
"Setting": {
"id": "xxxxxxx",
"rejectCall": false,
"msgCall": "",
"groupsIgnore": false,
"alwaysOnline": false,
"readMessages": false,
"readStatus": false,
"syncFullHistory": false,
"wavoipToken": "",
},
"_count": {
"Message": 0,
"Contact": 0,
"Chat": 0
}
} ]
Teste aqui:
curl --request POST --url 'https://evolution-api.xxxxx.com/message/sendText/teste3' --header 'Content-Type: application/json' --header 'apikey: xxxxx' --data '{"number": "+5575998578250","text": "teste"}'
504 Gateway Time-out
as configs estao corretas? esta faltando algo?
Ao contrário do que diz a documentação, ao invés de passar o
idda instância, é esperado onomeda instância. No seu exemplonumero2
Inclusive já percebi que vai ter vários erros na api, testando, mandei o sendPresence, corrigi com sua resposta.
porém na documentação fala para usar no body a chave options com presence e delay, mas não é, delay e presence precisa vir na raiz do json e não dentro de options