
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
vk-to-telegram
Advanced tools
npm i vk-to-telegram --save
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')
})
It is a tool for express which using VK callback api forwards posts from group in channel or chat in Telegram!
Here's example with koa2
app.use(bodyParser())
app.use(async ctx => {
const result = await vkToTg.send(ctx)
console.log(result)
})
![]() | ![]() | ![]() | ![]() |
---|
Content type | Works fully? |
---|---|
Photo(s) | Yes |
Video(s) | Yes |
Document(s) | Yes |
Link | Yes |
Application Content | Yes |
Poll | Not yet, but forwarder will send link to poll. |
Audio(s) | NO. Why? Read here. |
Album(s) | Yes |
Graffiti | Not tested. |
Wiki Page | Not tested. |
Market item | Not tested. |
Sticker | Not tested. |
If you want to test this code, or to use on a regular basis(beta, works via heroku), please contact me for setup. It's simple ;)
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) |
filterByHashtah | 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 ) |
Here's a telegram group ¯\(ツ)/¯
Also u can write to me directly in Telegram,
VK or by mail
FAQs
Vk to telegram forwarder
We found that vk-to-telegram demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.