Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-ts-vk-api

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-ts-vk-api

## Basic Exaple

  • 1.0.4
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Simple Vk api for typescript

Basic Exaple

import pkg from 'node-ts-vk-api';
const {Bot} = pkg;

const bot = new Bot({
    token: 'YOUR TOKEN HERE'
});

bot.api.method('messages.send', { message: 'Hello World!', peer_id: 1 /* your vk id */});

Uploading Photos for Message

import pkg from 'node-ts-vk-api';
const {Bot} = pkg;
import { createReadStream } from "fs";

const user_id = 1; // id where do you want to send message with photo

const bot = new Bot({
    token: 'YOUR TOKEN HERE'
});

async function main(){
    const { id } = await bot.api.upload(createReadStream('./image.png'), user_id); //creating fs reading stream and uploading image to vk server
    await bot.api.method('messages.send', { message: 'Hello World!', peer_id: user_id, atachement: `photo${user_id}_${id}`});
}
main();

FAQs

Package last updated on 15 Aug 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc