Answer the question
In order to leave comments, you need to log in
Get an array of all ids with whom there were dialogues in the community (vk api)?
Hello everyone, there is such a method https://vk.com/dev/messages.searchConversations
I need to one-time add everyone who has ever written to the bot in the database, exactly their id
How can this be implemented? I practically did not work with vk-api, maybe someone has a ready-made solution for my question?
Answer the question
In order to leave comments, you need to log in
<?php
$data = [
'access_token' => 'ключ_доступа_сообщества',
'v' => 5.95
];
$url = 'https://api.vk.com/method/messages.getConversations?' . http_build_query($data);
$data = file_get_contents($url);
$json = json_decode($data, true);
$users = [];
foreach ($json['response']['items'] as $item) {
$userId = $item['conversation']['peer']['id'];
$users[] = $userId;
}
print_r($users, true);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question