evolution-api icon indicating copy to clipboard operation
evolution-api copied to clipboard

500 internal error in simple sendMessage API call: Cannot read properties of undefined (reading 'textMessage')

Open doryashar opened this issue 7 months ago • 3 comments

Welcome!

  • [x] Yes, I have searched for similar issues on GitHub and found none.

What did you do?

Hi Guys, i'm using latest release (docker atendai/evolution-api:latest) and updated an instance from the web ui with my whatsapp (Bailys). the instance shows connected after i scanned the QR code.

sending simple curl SendText request:

curl --request POST
--url http://<MY_EVOLUTION_URL>/message/sendText/<INSTNACE_ID>
--header 'Content-Type: application/json' --header 'apikey: <EVOLUTION_API_KEY>' --data '{ "number": "972528888888", "text": "Hi, Test", "delay": 1 }'

result: {"status":500,"error":"Internal Server Error","response":{"message":"Cannot read properties of undefined (reading 'textMessage')"}}

What did you expect?

200 response.

What did you observe instead of what you expected?

500 (internal server error)

Screenshots/Videos

No response

Which version of the API are you using?

2.2.3

What is your environment?

Windows

Other environment specifications

No response

If applicable, paste the log output

No response

Additional Notes

No response

doryashar avatar May 02 '25 09:05 doryashar

The same ++

aleksander-pankow avatar May 10 '25 12:05 aleksander-pankow

Also happened to me with the latest docker image.

{
  "status": 500,
  "error": "Internal Server Error",
  "response": {
    "message": "Connection Closed"
  }
}

lamurian avatar May 29 '25 04:05 lamurian

I resolved this issue by updating CONFIG_SESSION_PHONE_VERSION, then reconnecting the instance. This issue seems to be related: https://github.com/EvolutionAPI/evolution-api/issues/1014

lamurian avatar May 29 '25 12:05 lamurian

The issue was fixed. python webhooks(/websocket) and stated above curl command are matching Evolution version 1 API instead of version 2

doryashar avatar Jun 29 '25 22:06 doryashar

O que você fez para corrigir o problema?

Ainda to com o mesmo problema:

curl --request POST \
  --url https://<MY_EVOLUTION_URL>/message/sendText/<INSTNACE_ID> \
  --header 'Content-Type: application/json' \
  --header 'apikey: <EVOLUTION_API_KEY>' \
  --data '{
  "number": "5585997961111",
  "text": "Fala meu mano"
}'

Minha imagem:

image: evoapicloud/evolution-api:latest

Versão do whatsapp:

CONFIG_SESSION_PHONE_VERSION=2.3000.1020885143

Toda vez que tento chamar esse curl, caio nessa msg:

{"status":500,"error":"Internal Server Error","response":{"message":"Cannot read properties of undefined (reading 'textMessage')"}}

Obrigado.

alanalvestech avatar Jul 02 '25 04:07 alanalvestech

try like this:

curl --request POST
--url https://{server-url}/message/sendText/{instance**_NAME**}
--header 'Content-Type: application/json'
--header 'apikey: '
--data '{ "number": "", "textMessage": { "text": "" } }'

doryashar avatar Jul 02 '25 05:07 doryashar

{"status":400,"error":"Bad Request","response":{"message":[["instance requires property "text""]]}}

alanalvestech avatar Jul 02 '25 06:07 alanalvestech

I'm facing this error bellow when I try to send text message to a group:

{"status":400,"error":"Bad Request","response":{"message":["Error: not-acceptable"]}}

I think it might be related to this issue

faelperetta avatar Sep 14 '25 14:09 faelperetta

{"status":400,"error":"Solicitação inválida","response":{"message":[["instância requer propriedade "texto""]]}}

same here, did you manage to solve it?

GuilhermeLimaSP avatar Sep 19 '25 07:09 GuilhermeLimaSP

I managed to solve it by changing the instance, I had put a uuid when it was just the name

GuilhermeLimaSP avatar Sep 19 '25 07:09 GuilhermeLimaSP