# node-ts-vk-api

> ## Basic Exaple

Latest version **1.0.4** (published 2020-08-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install node-ts-vk-api
pnpm add node-ts-vk-api
yarn add node-ts-vk-api
bun add node-ts-vk-api
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2020-08-15 |
| First published | 2020-08-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 93.3 KB |
| Known vulnerabilities | 0 (+25 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | loric |

## Links

- npm: https://www.npmjs.com/package/node-ts-vk-api
- npm.io page: https://npm.io/package/node-ts-vk-api

## Dependencies (2)

- [axios](https://npm.io/package/axios.md) ^0.19.2
- [form-data](https://npm.io/package/form-data.md) ^3.0.0

## Recent versions

- 1.0.4 (latest) — 2020-08-15
- 1.0.3 — 2020-08-15
- 1.0.2 — 2020-08-12
- 1.0.1 — 2020-08-12

## README

# Simple Vk api for typescript
## Basic Exaple

```ts
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

```ts
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();
```

---
_Source: https://npm.io/package/node-ts-vk-api · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
