Socket
Socket
Sign inDemoInstall

telegram-message-send

Package Overview
Dependencies
3
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    telegram-message-send

Send message using telegram bot and api.


Version published
Weekly downloads
88
decreased by-36.23%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Telegram Message Send

Installation

With yarn
yarn add telegram-message-send
With NPM
npm install telegram-message-send

Getting Started

import {
  telegramSendMessage,
  telegramSendPhoto,
  telegramSendAudio,
  telegramSendDocument,
  telegramSendLocation,
  telegramSendContact,
  telegramSendPoll,
  telegramSendDice,
} from 'telegram-message-send'

const botKey = '#########'
const chatId = '#########'

telegramSendMessage(botKey, chatId, 'Hello World')
telegramSendPhoto(botKey, chatId, 'https://avatars.githubusercontent.com/u/100691616?s=200&v=4', 'Custom Caption')
telegramSendAudio(botKey, chatId, 'https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3', 'Custom Caption')
telegramSendDocument(
  botKey,
  chatId,
  'https://s2.q4cdn.com/175719177/files/doc_presentations/Placeholder-PDF.pdf',
  'Custom Caption',
)
telegramSendLocation(botKey, chatId, 41.084677113651814, 29.00455392606353)
telegramSendContact(botKey, chatId, 'Ilker Balcilar', '+905555555555')
telegramSendPoll(botKey, chatId, 'Which one would you prefer', ['Javascript', 'Typescript'])
telegramSendDice(botKey, chatId, 'dice')

Create a new Telegram bot with BotFather

Create a Telegram bot with BotFather before connecting your bot to Telegram.

  1. Start a new conversation with the BotFather.
  2. Send /newbot to create a new Telegram bot.
  3. When asked, enter a name for the bot.
  4. Copy and save the Telegram bot's access token for later steps.

Get your Get Your Telegram Chat ID

  1. In your Telegram account, search for “@myidbot” or open this link t.me/myidbot on your smartphone.
  2. Start a conversation with that bot and type /getid. You will get a reply back with your user ID.
  3. Note the user id.

In order to receive a message from the bot, you must first send a message to the bot and create a chat.

telegramSendMessage

PropRequiredTypeExample
botKeyyesstring#########
chatIdyesstring#########
textyesstringHello World

telegramSendMessage

PropRequiredTypeExample
botKeyyesstring#########
chatIdyesstring#########
photoURLyesstringhttps://avatars.githubusercontent.com/u/100691616?s=200&v=4
captionnostringCustom Caption

telegramSendAudio

PropRequiredTypeExample
botKeyyesstring#########
chatIdyesstring#########
audioURLyesstringhttps://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3
captionnostringCustom Caption

telegramSendDocument

PropRequiredTypeExample
botKeyyesstring#########
chatIdyesstring#########
documentURLyesstringhttps://s2.q4cdn.com/175719177/files/doc_presentations/Placeholder-PDF.pdf
captionnostringCustom Caption

telegramSendLocation

PropRequiredTypeExample
botKeyyesstring#########
chatIdyesstring#########
latitudeyesnumber41.084677113651814
longitudeyesnumber29.00455392606353

telegramSendContact

PropRequiredTypeExample
botKeyyesstring#########
chatIdyesstring#########
nameyesstringIlker Balcilar
phone_numberyesstring+905555555555

telegramSendPoll

PropRequiredTypeExample
botKeyyesstring#########
chatIdyesstring#########
questionyesstringWhich one would you prefer
optionsyesArray<string>["Javascript", "Typescript"]

telegramSendDice

PropRequiredTypeExample
botKeyyesstring#########
chatIdyesstring#########
typenostringdice / dart / bowling / basketball / football / slot

Keywords

FAQs

Last updated on 16 Feb 2023

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc