Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
const express = require('express')
const app = express()
const port = 3000
const fs = require('fs')
const TelegramBot = require('node-telegram-bot-api')
const token = '<<<< PUT BOT TOKEN HERE >>>>>'
const bot = new TelegramBot(token, {polling: true})
// 1. go to the web version web.telegram.org
// 2. go to the channel
// 3. take the number from the url and put -100 in front of the number
const chatId = -100xxxxxxxx;
app.use(express.json())
app.post('/', (req, res) => {
bot.sendMessage(chatId, req.body.message+', '+req.body.url)
res.send('ok')
})
app.listen(port, () => {
console.log(`Example app listening at http://localhost:${port}`)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment