npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vk-to-telegram

v0.4.6

Published

Vk to telegram forwarder

Downloads

42

Readme

vk to telegram forwarder

NPM Version node

Installation

npm i vk-to-telegram --save

Example

const app = require('express')()
const bodyParser = require('body-parser')
const vkToTelegram = require('vk-to-telegram')
const vkToTg = new vkToTelegram({
  botToken: 'your bot token',
  chatName: 'telegram chat/channel name',
  ownerId: 'your telegram id', // number
  vkToken: 'your very long token from vk api',
  vkConfirmation: 'group confirmation'
})
app.use(bodyParser.json())
app.post('/', (req, res) => {
  vkToTg.send(req, res)
    .then(() => console.log('Done!'))
    .catch((err) => {
      console.log('Something went wrong')
      console.log(err)
    })
})

app.listen(80, ()=>{
  console.log('listening on port 80')
})

What is this

It is a tool for express which using VK callback api forwards posts from group in channel or chat in Telegram!

async/await

Here's example with koa2

app.use(bodyParser())
app.use(async ctx => {
  const result = await vkToTg.send(ctx)
  console.log(result)
})

Used by:

| | | | |
|-|-|-|-| | AlexandriA (AAR) | PanzerSofa | Олег Ливанов | ongoing research | | | | || | аниреакт | Otaku Squad | disgusting otaku | Fond SpeedWagona|

What content does it forward

| Content type | Works fully? |
| - | - |
| Photo(s) | Yes | | Video(s) | Yes |
| Document(s) | Yes | | Link | Yes |
| Application Content | Yes | | Poll | Yes | | Audio(s) | NO. Why? Read here. | | Album(s) | Yes | | Graffiti | Not tested. | | Wiki Page | Not tested. | | Market item | Not tested. | | Sticker | Not tested. |

Free usage

If you want to test this code, or use on a regular basis (via heroku), please contact me for setup.

Variables

|Variable|Type|Required|Description| |-|-|-|-| | token|String|Yes|Bot token from Botfather| | chatName|String | Yes | Telegram channel or group link, like '@tavernofheroes'| | ownerId|Number|Yes | Your telegram id for sending error if they are. U can get know it from @getidsbot| | vkConfirmation|String|Yes|Confirmation string from ur group callback api server: | | vkToken |String| Yes | Follow the instructions below:| ||||1. Create Standalone application here: https://vk.com/apps?act=manage | ||||2. Open settings in created application and copy application id | ||||3. Open this link with replace your application id: | ||||https://oauth.vk.com/authorize?client_id=YOUR APPLICATION ID&display=page&redirect_uri=http://vk.com/&scope=offline,video,docs&response_type=token&v=5.81| ||||4. Click allow all that need's and it's all! Your token is in query url, do not copy all link, only token without other params. | |chatId|Number|Optional|If you know your chat/channel id, put it here, it will replace chatName parameter| |fromId |Number| Optional | VK group id with '-'in start or nothing, if you don't need check. | |customVkButton|String|Optional|Title for button which will be added to each post to open it in VK| |customPollTitle|String|Optional|Custom template string in the title of button with URL to poll("Open poll" -> "Open poll - ${poll.question}")| |customLongPostText|String|Optional|Custom template string that replace full post text, because it's too long for Telegram(max 4096 characters) ("Too long post... [Read full]" -> "Too long post... <a href="https://vk.com/poll${poll.owner_id}_${poll.id}">Read full" and parse as HTML)| |signed|String|Optional|Custom template string that add post signer in the end of Telegram message ("Post By" -> "\n\nPost by <a href="https://vk.com/id${post.signer_id}">${signer.first_name} ${signer.last_name}" and parse as HTML) | |heroku|Boolean|Optional|Add filter that stops forwarder if detect that post repeats(Because of app sleeping)| |herokuTimeout|Number|Optional|Heroku post delay between same posts| |secret|String|Optional|Secret field from vk admin panel to verify that post has come from VK| |filterByWord|String|Optional|Filter posts by key word(s) (use ',' as separator) (use '-' in begin of word to invert)| |filterByHashtag|String|Optional|Filter posts by hashtag (use ',' as separator) (use '-' in begin of word to invert)| |ads|Boolean|Optional|Forward posts marked as ads? (By default true)| |repostAds|Boolean|Optional|Forward reposts marked as ads? (By default true)| |appendText|String|Optional|Append text to forwarded post (can be used for hashtags for channel navigation)| |prependText|String|Optional|Same as appendText but it's will prepend it in the start of post text| |repost|Boolean|Optional|Allow to forward post with repost (By default true)|
|sendNativePoll|Boolean|Optional|Use native Telegram poll instead of link to poll in VK, set false to use poll in VK| |criedHalfBea|Boolean|Optional|Use Z sized pictures as max. (Reduces pictures aliasing)|

  • DON'T forget to pick in your vk group api dashboard event type 'WALL POST - NEW'.
  • Recommend to use vk api v5.103

Contact

Telegram group, Telegram, Mail