W
W
wargych2018-12-08 21:43:12
go
wargych, 2018-12-08 21:43:12

Error when sending message.send - invalid character, what is the reason?

I send a message like this from the server:

"https://api.vk.com/method/messages.send?peer_id=2000000176?message=myMsg&random_id=случайныйайди&access_token=mytoken&v=5.90

The message does not come, the answer from VK:
invalid character '<' looking for beginning of value

Message structure:
First name Last name: message text .
The message itself initially comes from the same chat via the Callback Api, upon request all the necessary information comes, when printed to the console it turns out:
▒<90>лек▒<81>ей▒<92>тагов: ▒<90>выва
I thought that this was only when the encoding display error was output to the console, but the error from the VK server indicates an invalid character "<" . Error 400, bad request.
Actually - is the error in the request itself or the encoding in which my server sends (written in go)?
Programming is a hobby for me, please do not judge strictly. The go tag was written for everyone, although this is hardly related to the topic.
UPD:
When I paste the resulting url into the address bar, I get:
{"error":{"error_code":10,"error_msg":"Internal server error","request_params":[{"key":"oauth","value":"1"},{"key":"method","value":"messages.send"},{"key":"peer_id","value":"2000000176"},{"key":"random_id","value":"567567458"},{"key":"v","value":"5.90"}]}}

If I change peer_id to user_id in the url and substitute my id, then I receive a message on behalf of the group.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question