To work with vk api I chose the vksdk package (module). Here is the link to the https://www.npmjs.com/package/vksdk package

I try to create a post in a group through a request, however, nothing happens, no post in the group is created. I have registered as a Standalone app and I have created Token for the community (Implicit flow).

Can you please tell me if I use the package functionality incorrectly or have the application not registered correctly (maybe the token is not the one created)?

var VK = require("vksdk"); var vk = new VK({ 'appSecret' : 6693739, 'appId' : 'VtfrleQIkcIxFOK13IAw', 'language' : 'ru' }); vk.setToken('****'); //vk.setSecureRequests(true); vk.request('wall.post', { 'owner_id' : -111, 'friends_only' : 0, 'from_group' : 1, 'message' : 'Hello World!' }, function(foo){ console.log('Request WALL.POST: '+ foo + '\n'); }) 

  • And what is the result / error coming out? - Let's say Pie
  • @ Let's say Pie No, no error gives out .... via try catch, too, nothing - Z. Vladimir
  • @ Z.Vladimir you did not exceed the limits there? They have a limit on the number of requests per second. - Suvitruf
  • @Suvitruf I'm new to this topic (node ​​js and vk api), but it’s not the first time I encountered programming and I can't see a hint that I send a request many times, if this is possible based on my current code - please tell me. Based on your question, I decided to experiment and pushed the request into the timer, but the result is still the same - nothing ... - Z. Vladimir

1 answer 1

I look at the code, and I see that it does not always return the answer in the callback .

Before calling vk.request write:

 vk.on('http-error', function(_e) { console.log("http-error: %o",_e); }); 

Almost 100% guarantee that there will be an error.

Well and at the same time on parse-error :

 vk.on('parse-error', function(_e) { console.log("parse-error: %o",_e); }); 
  • Yes, it is, brought an error http-error "connect ETIMEDOUT 87.240.129.75:443" - Z. Vladimir
  • @ Z.Vladimir do you have access to the Internet in your car? If yes, then try to turn to this ip curl'om. If it falls off on timeout, this ip is simply unavailable, and the problem has nothing to do with the library. - Suvitruf
  • c ip there were problems ... there is a problem, I found the sdk.js file in the vksdk package and changed the port there, but ip where I did not find it . Z. Vladimir
  • @ Z.Vladimir ip is resolved from the DNS domain by the server. - Suvitruf
  • yeah, i'm sort of starting to delve .... see the default was ip 87.240.129.75 (api.vk.com) and I changed it to the same as my website 127.0.0.1, right did it? but now it gives the error "socket hang up" - Z. Vladimir