L
L
Lenskii2021-03-13 05:29:51
Node.js
Lenskii, 2021-03-13 05:29:51

How to put a telegram bot on VDS node.js that works on webhook?

Hello, I’ve been sitting here for 3 hours already, I drank 4 mugs of coffee and google hard! The last thing I write here, because the problem is really urgent.
I have a bot that doesn't want to work with telegram at all. Is there somewhere on the Internet a guide for installing a node.js bot on a VPS / VDS server, or anywhere, as long as it works! Help me please!

const TeleBot = require('telebot');
const bot = new TeleBot({
    token: 'Токен', // Required. Telegram Bot API token.
    webhook: { // Optional. Use webhook instead of polling.
        url: 'https://vm1945277.nvme.had.yt', // HTTPS url to send updates to.
        host: 'localhost', // Webhook server host.
        port: 443, // Server port.
        maxConnections: 40 // Optional. Maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery
    }
});
bot.on('text', (msg) => msg.reply.text(msg.text));
bot.start();


What's wrong here?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaly, 2021-03-13
@vshvydky

webhook is the point where the telegram sends information to the endpoint, localhost is clearly invalid history.
There are two options, either write a real host for your VPS, or don't use webhooks and let the cart pull...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question