I can not send a message via rest, example?
Closed this issue · 7 comments
Hi!
How do i:
Send GET /api/v1/whatsapp/auth
Authorization Basic
I get a token
Send Post
/api/v1/whatsapp/login
Authorization Bearer
I get a QR pic, scan QR on mobile app
Send Post
POST http://172.16.0.101:3000/api/v1/whatsapp/send/text?msisdn=79143720232@s.whatsapp.net&message=test"edid=0"edmsg=0&delay=10
Accept: application/json
Cache-Control: no-cache
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjoiNzk2Mjg3MTYwNDlAcy53aGF0c2FwcC5uZXQiLCJleHAiOjE1ODkyMDEyNjd9.UFSxFYiTxllDNhOL9oZaE-x8_07FVJqIpubT_VMy4gUG88Y_NOrYerhVUgaV0jsZJJ9jt9s8gV_Wjr-4MUheSbG_wCMSaKXaOk50lTwEGkkt-lWjuiLECZ3SoHk4VwfF3GDe-vLXuKnJ4iGfP4MLFSogMDqf8ty-oShHvsBflXci351_qaBtzWMb3RQ4rV72JlCJT_rNi1WmvMhJ-QAzEbpD2V5CwRpFPvlj9PjSwsABD9-NGBzO7Bj_GrQNZSaz05mWy_Pf0MYyFU79HUyxfRYkVfmVv1mCdD0yAH0_F-YzJQD7RprvwXmjDmPucgA6tYXNl0S14VSsu5wA4B8D9w
Return
{"status":false,"code":500,"message":"Internal Server Error","error":"connection is invalid"}
Two days I can’t understand what the problem is ... There are no errors, and will not authorize :(
Maybe something else needs to be done in advance?
it's mean the connection to the WhatsApp WebSocket is not established correctly and the connection is not found in the array, can you try to hit the /login API again?
and for the additional information currently WhatsApp Client version has been updated i think you also need to adjust it, otherwise sometime the connection is failed
it's mean the connection to the WhatsApp WebSocket is not established correctly and the connection is not found in the array, can you try to hit the /login API again?
Yes, I tried several times, always the same
and for the additional information currently WhatsApp Client version has been updated i think you also need to adjust it, otherwise sometime the connection is failed
but where to do it?
Changing the version to 0.4.2081 did not help :(
I just try the docker version and it seems normal, message got sent correctly
can you try the docker version or please check again your postman
it's using post method with x-www-url-encoded form and it has 2 required field msisdn as destination number and the message text
By the way i think you need to debug your JWT token since it's holding your connection ID, invalid connection means it can't found the websocket connection in the array with the spesifed ID in the JWT Token
Make sure you use same token from the /auth endpoint
The /auth endpoint will generate the JWT Token based on your Phone Number (without WhatsApp Postfix) and the Basic Auth password (the default one i think you already found it on the hlp/config.go)
Please make sure you already done it correctly, thanks
The /auth endpoint will generate the JWT Token based on your Phone Number (without WhatsApp Postfix) and the Basic Auth password (the default one i think you already found it on the hlp/config.go)
Please make sure you already done it correctly, thanks
Thanx,
I left only the phone number in Basic token, received JTW, I considered QR, I try to send a message - again an error. Also using docker :(
It's bad that I do not understand how to debug this :(
{"label":"http-access","level":"info","msg":"access method POST at URI /api/v1/whatsapp/login?timeout=90","service":"go-whatsapp-rest","time":"2020-05-11T16:38:32.096537389+07:00"}
{"label":"whatsapp","level":"info","msg":"whatsapp version 0.4.2081","service":"go-whatsapp-rest","time":"2020-05-11T16:38:32.563888941+07:00"}
..... healt
{"label":"http-access","level":"info","msg":"access method POST at URI /api/v1/whatsapp/send/text?msisdn=79143720232%40s.whatsapp.net\u0026message=test","service":"go-whatsapp-rest","time":"2020-05-11T16:39:21.08841389+07:00"}
{"label":"http-access","level":"error","msg":"connection is invalid","service":"go-whatsapp-rest","time":"2020-05-11T16:39:21.093491145+07:00"}
I don’t know why, but it worked, although I did not change anything in the code. Thank.