telegram-bot-api | First Telegram Bot API node.js library | Bot library

 by   mast JavaScript Version: 2.0.1 License: MIT

kandi X-RAY | telegram-bot-api Summary

kandi X-RAY | telegram-bot-api Summary

telegram-bot-api is a JavaScript library typically used in Automation, Bot, Nodejs applications. telegram-bot-api has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can install using 'npm i telegram-bot-api2' or download it from GitHub, npm.

This is first Node.js library for Telegram Bot API. This is not a framework! You will not get router or some advanced logic to simplify your bot development. But it will give you simple function to receive messages from your bot users and send them replies. Library doesn't validate any parameters, whatever you send to the library will be sent to Telegram servers. That means you will benefit of new parameters added by Telegram developers at first day, since update of library will not be required. Please refer to for API functions and parameters description.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              telegram-bot-api has a low active ecosystem.
              It has 213 star(s) with 57 fork(s). There are 19 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 9 open issues and 45 have been closed. On average issues are closed in 649 days. There are 2 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of telegram-bot-api is 2.0.1

            kandi-Quality Quality

              telegram-bot-api has 0 bugs and 0 code smells.

            kandi-Security Security

              telegram-bot-api has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              telegram-bot-api code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              telegram-bot-api is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              telegram-bot-api releases are available to install and integrate.
              Deployable package is available in npm.
              Installation instructions, examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of telegram-bot-api
            Get all kandi verified functions for this library.

            telegram-bot-api Key Features

            No Key Features are available at this moment for telegram-bot-api.

            telegram-bot-api Examples and Code Snippets

            No Code Snippets are available at this moment for telegram-bot-api.

            Community Discussions

            QUESTION

            Telegram Bots: Send lists of options
            Asked 2021-May-18 at 18:52

            Is it possible to format a message sent by a telegram bot as a list?

            I want to build a bot that presents the menu of a restaurant with about 20 options and sub-options (e.g., kind of meat) as a list:

            ...

            ANSWER

            Answered 2021-May-16 at 19:47

            Or can confirm that it is indeed not possible?

            The documentation you linked already confirmes that there are no special formatting options for (nested) lists supported by the Bot API.

            Source https://stackoverflow.com/questions/67559078

            QUESTION

            can't parse inline keyboard button: InlineKeyboardButton
            Asked 2021-Apr-27 at 12:06

            I'm using this package and I've created languages array and I'm trying to show them as buttons in my message but I receive this error

            ...

            ANSWER

            Answered 2021-Apr-27 at 11:52

            The inline_keyboard array expects object of type InlineKeyboardButton like these (not the same library, but you can see the structure).

            I can see you attempted to do that here:

            Source https://stackoverflow.com/questions/67282349

            QUESTION

            Go Telegram Bot API upload photo from local file
            Asked 2021-Apr-01 at 16:17

            I work with telegram using github.com/go-telegram-bot-api/telegram-bot-api Later I uploaded photos using external links: Simplified code is like this:

            ...

            ANSWER

            Answered 2021-Apr-01 at 16:17

            One way to upload a picture from local disk is to read the file, then passing the byte array to a FileBytes, wrap it with a Chattable like PhotoConfig and send it through bot.send:

            Source https://stackoverflow.com/questions/66907004

            QUESTION

            How can you check the message? node.js
            Asked 2021-Feb-23 at 20:27

            I am writing to the bot's telegram, how can you make it ignore such messages? "🤖 Manager", "🖥 Contracts", "🔔 Notifications" First comes some kind of emoticon and then text. I tried to do through regex I am using the library node-telegram-bot-api

            ...

            ANSWER

            Answered 2021-Feb-23 at 20:26

            You can filter all (or at least many) emojis and phrases following the given format using this regular expression:

            Source https://stackoverflow.com/questions/66340294

            QUESTION

            Telegram Bot sendDocument (php on hosted server)
            Asked 2021-Feb-17 at 16:49

            I have a Telegram bot with webhook setted on an third-party hosted server. I can use any URL query string and they work fine.

            Now I'm trying to make my bot send a text file. If I've understood correctly I need to make a POST request using multipart/form-data, and I'm struggling quite a lot to make it work on the hosting server.

            ...

            ANSWER

            Answered 2021-Feb-17 at 16:49
            • No need to set the content headers

            To send a local file, create a new CURLFile(), and add that to the CURL request;

            Source https://stackoverflow.com/questions/66244747

            QUESTION

            ETELEGRAM: 400 Bad Request: poll can't be stopped
            Asked 2020-Oct-03 at 00:30

            I am trying to invoke the telegramBot.stopPoll() function but I am getting error

            ...

            ANSWER

            Answered 2020-Oct-01 at 12:11

            I'm not sure but I believe it's a bug on Telegram Bot API's implementation when dealing with ForceReply markup (because the other reply_markup options like inline buttons work just fine). Remove that markup and it should work just fine.

            Source https://stackoverflow.com/questions/64062772

            QUESTION

            bind: The requested address is not valid in its context
            Asked 2020-Sep-07 at 14:13

            I develop a bot on golang. Started it on vds with ubuntu 20.01 OS and it works great, but it's a problem when I'm starting to debug my code. Because of it I decide to use my PC as a VDS: I have opened a 8443 port and etc. But when main.go is started I get an error:

            ...

            ANSWER

            Answered 2020-Sep-07 at 14:13

            The error bind: The requested address is not valid in its context. indicates that the address does not belong to a network interface on your machine. Likely, there is a router/load balancer/etc... with the actual public address and it is forwarding traffic to your machine.

            You need to split the addresses you use:

            • your local address (see ifconfig) or 0.0.0.0 for all interface as the address passed to http.ListenAndServeTLS
            • the public address as the callback address passed in NewWebhookWithCert

            Source https://stackoverflow.com/questions/63778826

            QUESTION

            How to repeat a function and handler untill the user gives a valid reply to telegram bot?
            Asked 2020-Sep-04 at 13:58

            I just got into learning to build telegram bot using telegram-bot-api-python module. I made three functions one /start command function to start converstaion and this function asks for user phone number and send it to other handler or function called reply_with_number where the reply of user will be vaidated using if else statements and if the user reply is valid then he will be sent to another handler or function called ask_link this is the last one and he will reply me with a link. Everything is fine but when the user enters some string like "thisstring" instead of phone number then the function reply_with_number should keep running or keep asking for valid phone number untill he types valid one. But mine is just getting out of that reply_with_number and running the next ask_link handler without waiting for reply. How can solve this problem ? My code:

            ...

            ANSWER

            Answered 2020-Sep-04 at 13:58

            You should use the ConversationHandler for this situation, and just return the proper message for the user to try again and the correct return so the bot knows the user still in the same step on the conversation handler, example:

            Source https://stackoverflow.com/questions/63424081

            QUESTION

            Why dialogflow bot stop responding in telegram if i create a telegram bot object with node-telegram-bot-api?
            Asked 2020-Aug-27 at 14:22

            I’ve build a dialogflow chatbot with telegram integration and i need to take paths of images sent by the user in telegram chat. As far as i know dialogflow bot doesn’t listen for images, so i use a telegram bot object for polling messages to get the images, but in this way the dialogflow bot stop responding, even after the polling of the telegram bot is stopped. There is some conflict between the two bot. The only way to “resuscitate” the dialogflow bot is to manually restarting the telegram integration in the dialogflow UI. There is a way to solve conflict between the two bot so the dialogflow bot continues responding after the telegram bot got the image? Here it is the code i wrote:

            ...

            ANSWER

            Answered 2020-Aug-27 at 14:22

            Solved. The problem is that webhook and polling are two mutually exclusive method of getting messages. So whereas dialogflow-telegram bot use webhook, the telegram bot object that i created use polling let telegramBot = new TG(token, {polling: true}); which automatically delete the webhook. To solve this problem in necessary to set again the webhook after stopping the polling: await bot.stopPolling(); bot.setWebHook("your webhook url").then(r => console.log("webhook response: "+r)).catch(err => console.log("webhook error: "+err.message));

            You can find here the webhook url which your dialogflow-telegram bot is using:

            https://api.telegram.org/botYourTelegramBotToken/getWebhookInfo

            Hope it helps someone.

            Source https://stackoverflow.com/questions/63578214

            QUESTION

            How should I download received files from telegram api
            Asked 2020-May-19 at 11:17

            I just want to download images received by my telegram bot with nodejs but I dont know witch method to use. I'm using node-telegram-bot-api and I tried this code :

            ...

            ANSWER

            Answered 2019-Dec-12 at 21:15
            bot.on('message', async (msg) => {
                if (msg.photo && msg.photo[0]) {
                    const image = await bot.getFile({ file_id: msg.photo[0].file_id });
                    console.log(image);
                }
            });
            

            Source https://stackoverflow.com/questions/59312499

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install telegram-bot-api

            You can use npm package to get module installed.

            Support

            For method parameters and description, please refer to official documentation https://core.telegram.org/bots/api. We try to add support of newly added methods as soon as possible, so you could assume that all methods are supported by library. Signature of API methods for all methods is the same. Method name matches method name from official API documentation, method accepts 1 parameter as JS object, and returns promise. Resolved promise will contain decoded result object returned by Telegram. JS object that you pass to API method should be composed in accordance with format accepted by the method. String, Boolean, Number and stream.Readable fields of this object will not be encoded by the library, all other types of fields will be encoded as JSON-string. stream.Readable fields can be used for sending files to API and will be uploaded properly.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/mast/telegram-bot-api.git

          • CLI

            gh repo clone mast/telegram-bot-api

          • sshUrl

            git@github.com:mast/telegram-bot-api.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link