Z
Z
Zorgios2019-07-29 12:22:41
PHP
Zorgios, 2019-07-29 12:22:41

Why do I get the error "Access denied: no access to call this method" when I try to send a message via messages.send?

I'm trying to send a message using the messages.send method, but I get the error "Access denied: no access to call this method" (Error code - 15)
Although the received token implies the messages right
Code:

$request_params = array( 
    'message' => "test", 
    'user_id' => $user_id, 
    'access_token' => $token, 
              'random_id' => $random_id,
    'v' => '5.101' 
    ); 
  $get_params = http_build_query($request_params); 
  file_get_contents('https://api.vk.com/method/messages.send?'. $get_params);

Alternative
file_get_contents("https://api.vk.com/method/messages.send?message=test&access_token=$token&v=5.80&user_id=$user_id&random_id=$random_id");

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Serezha, 2019-07-29
@Zorgios

All methods in the messages section are disabled for custom tokens.

A
Alexander Aksentiev, 2019-07-29
@Sanasol

do you have standalone app?
If not, then messages cannot be sent.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question