www.npmjs.com Open in urlscan Pro
2606:4700::6811:dfaf  Public Scan

URL: https://www.npmjs.com/package/messaging-api-telegram
Submission: On October 10 via api from US — Scanned from US

Form analysis 1 forms found in the DOM

GET /search

<form id="search" method="GET" action="/search" class="_13c93d41 relative flex bg-transparent ph3 ph2 pv2 ph0-ns pv0-ns bt b--black-10 bn-ns">
  <div class="e82b10fd relative dde91b96">
    <div class="_2f299eeb nowrap flex"><span class="_705cdf4f db fl pl3 pr1"><svg width="15px" height="15px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" aria-hidden="true">
          <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
            <g stroke="#777777" stroke-width="1.3">
              <g>
                <path d="M13.4044,7.0274 C13.4044,10.5494 10.5494,13.4044 7.0274,13.4044 C3.5054,13.4044 0.6504,10.5494 0.6504,7.0274 C0.6504,3.5054 3.5054,0.6504 7.0274,0.6504 C10.5494,0.6504 13.4044,3.5054 13.4044,7.0274 Z"></path>
                <path d="M11.4913,11.4913 L17.8683,17.8683"></path>
              </g>
            </g>
          </g>
        </svg></span><input type="search" role="combobox" name="q" hotkeys="[object Object]" placeholder="Search packages" aria-label="Search packages" aria-controls="typeahead-list-60544" aria-expanded="false" aria-activedescendant=""
        inputref="[object Object]" autocomplete="off" class="_390acbc5 f5 fw3 black relative" value="" element="input"></div>
  </div><button type="submit" class="_0da775bb bn pv2 ph4 f6 white pointer bn pv2 ph4 f6 white pointer" aria-label="Search">Search</button><input type="hidden" name="csrftoken" value="SQ703H_xQFc1WebUJCEcfY1fy29pbQ41r-ttMC2G4rD">
</form>

Text Content

skip to:contentpackage searchsign in
❤
 * Pro
 * Teams
 * Pricing
 * Documentation

npm


Search
Sign UpSign In


MESSAGING-API-TELEGRAM


1.1.0 • Public • Published 3 years ago
 * Readme
 * Code Beta
 * 8 Dependencies
 * 16 Dependents
 * 78 Versions


MESSAGING-API-TELEGRAM

> Messaging API client for Telegram




TABLE OF CONTENTS

 * Installation
 * Usage
 * API Reference
   * Webhook API
   * Send API
   * Get API
   * Updating API
   * Group API
   * Payments API
   * Inline Mode API
   * Game API
   * Others
 * Debug Tips
 * Testing


INSTALLATION

npm i --save messaging-api-telegram

or

yarn add messaging-api-telegram



USAGE


INITIALIZE

const { TelegramClient } = require('messaging-api-telegram');

// get accessToken from telegram [@BotFather](https://telegram.me/BotFather)
const client = new TelegramClient({
  accessToken: '12345678:AaBbCcDdwhatever',
});


ERROR HANDLING

messaging-api-telegram uses axios as HTTP client. We use axios-error package to
wrap API error instances for better formatting error messages. Directly calling
console.log with the error instance will return formatted message. If you'd like
to get the axios request, response, or config, you can still get them via those
keys on the error instance.

client.getWebhookInfo().catch((error) => {
  console.log(error); // formatted error message
  console.log(error.stack); // error stack trace
  console.log(error.config); // axios request config
  console.log(error.request); // HTTP request
  console.log(error.response); // HTTP response
});



API REFERENCE

All methods return a Promise.



WEBHOOK API

 * getWebhookInfo
 * getUpdates
 * setWebhook
 * deleteWebhook



SEND API - OFFICIAL DOCS

 * sendMessage
 * sendPhoto
 * sendAudio
 * sendDocument
 * sendSticker
 * sendVideo
 * sendVoice
 * sendVideoNote
 * sendMediaGroup
 * sendLocation
 * sendVenue
 * sendContact
 * sendChatAction



GET API

 * getMe
 * getUserProfilePhotos
 * getFile
 * getFileLink
 * getChat
 * getChatAdministrators
 * getChatMembersCount
 * getChatMember



UPDATING API

 * editMessageText
 * editMessageCaption
 * editMessageReplyMarkup
 * deleteMessage
 * editMessageLiveLocation
 * stopMessageLiveLocation



GROUP API

 * kickChatMember
 * unbanChatMember
 * restrictChatMember
 * promoteChatMember
 * exportChatInviteLink
 * deleteChatPhoto
 * setChatTitle
 * setChatDescription
 * setChatStickerSet
 * deleteChatStickerSet
 * pinChatMessage
 * unpinChatMessage
 * leaveChat



PAYMENTS API

 * sendInvoice
 * answerShippingQuery
 * answerPreCheckoutQuery



INLINE MODE API

 * answerInlineQuery



GAME API

 * sendGame
 * setGameScore
 * getGameHighScores



OTHERS

 * forwardMessage



DEBUG TIPS


LOG REQUESTS DETAILS

To enable default request debugger, use following DEBUG env variable:

DEBUG=messaging-api:request

If you want to use a custom request logging function, just provide your own
onRequest:

const client = new TelegramClient({
  accessToken: ACCESS_TOKEN,
  onRequest: ({ method, url, headers, body }) => {
    /* */
  },
});


TESTING


POINT REQUESTS TO YOUR DUMMY SERVER

To avoid sending requests to real Telegram server, specify the origin option
when constructing your client:

const { TelegramClient } = require('messaging-api-telegram');

const client = new TelegramClient({
  accessToken: ACCESS_TOKEN,
  origin: 'https://mydummytestserver.com',
});

> Warning: Don't do this on your production server.


README


KEYWORDS

 * bot
 * chatbot
 * messaging-apis
 * telegram








PACKAGE SIDEBAR


INSTALL

npm i messaging-api-telegram


REPOSITORY

Gitgithub.com/Yoctol/messaging-apis


HOMEPAGE

github.com/Yoctol/messaging-apis#readme


DOWNLOADSWEEKLY DOWNLOADS

1,938


VERSION

1.1.0


LICENSE

MIT


UNPACKED SIZE

558 kB


TOTAL FILES

29


ISSUES

10


PULL REQUESTS

4


LAST PUBLISH

3 years ago


COLLABORATORS

 * 
 * 
 * 
 * 
 * 

Try on RunKit
Report malware


FOOTER


SUPPORT

 * Help
 * Advisories
 * Status
 * Contact npm


COMPANY

 * About
 * Blog
 * Press


TERMS & POLICIES

 * Policies
 * Terms of Use
 * Code of Conduct
 * Privacy