VkApi api = new VkApi();
api.Authorize(new ApiAuthParams() { Login = "+79*******", Password = "***", ApplicationId = 684***, Settings = Settings.All });
var dialogs = api.Messages.GetConversations(new GetConversationsParams());
var messages = api.Messages.GetHistory(new MessagesGetHistoryParams() {PeerId = dialogs.Items[0].Conversation.Peer.Id});
foreach (var msg in messages.Messages) { Console.WriteLine(msg.Text); }
api.Messages.Send(new MessagesSendParams() { // ну или подставить сюда ид из диалога PeerId = messages.Messages.First().Id, Message = "Test", RandomId = new Random().Next() });
VkApi api = new VkApi(); api.Authorize(new ApiAuthParams() { Login = "*", Password = "*", ApplicationId = *, Settings = Settings.All }); var dialogs = api.Messages.GetConversations(new GetConversationsParams()); var messages = api.Messages.GetHistory(new MessagesGetHistoryParams() {PeerId = dialogs.Items[0].Conversation.Peer.Id}); Console.OutputEncoding = Encoding.UTF8; foreach (var msg in messages.Messages) { Console.WriteLine(msg.Text); } api.Messages.Send(new MessagesSendParams() { PeerId = messages.Messages.First().Id, Message = "Test", RandomId = new Random().Next() });
Source: https://habr.com/ru/post/438874/