Wolfram Language Paclet Repository

Community-contributed installable additions to the Wolfram Language

Primary Navigation

    • Cloud & Deployment
    • Core Language & Structure
    • Data Manipulation & Analysis
    • Engineering Data & Computation
    • External Interfaces & Connections
    • Financial Data & Computation
    • Geographic Data & Computation
    • Geometry
    • Graphs & Networks
    • Higher Mathematical Computation
    • Images
    • Knowledge Representation & Natural Language
    • Machine Learning
    • Notebook Documents & Presentation
    • Scientific and Medical Data & Computation
    • Social, Cultural & Linguistic Data
    • Strings & Text
    • Symbolic & Numeric Computation
    • System Operation & Setup
    • Time-Related Computation
    • User Interface Construction
    • Visualization & Graphics
    • Random Paclet
    • Alphabetical List
  • Using Paclets
    • Get Started
    • Download Definition Notebook
  • Learn More about Wolfram Language

TelegramBot

Guides

  • TelegramBot Guide

Symbols

  • CreateBotSession
  • DeployBotWebhook
  • getMe
  • getUpdates
  • HandleBotUpdates
  • ImportTelegramFile
  • Object
  • sendMessage
  • sendPhoto
  • TelegramBot
Webhooks
TelegramBot
bot object
setWebhook
set webhook
deleteWebhook
delete webhook
XXXX.
Import the package:
In[55]:=
<<KirillBelov`TelegramBot`
Create the bot:
In[56]:=
bot=
TelegramBot
["1247031088:AAGW73yzggrm4Tr7bldGCCaIrrwISNsdDzg"]
Out[56]=
TelegramBot
Name: WolframKernelBot
History Length: 4
Mode: LongPolling
Task: None
Webhook:

Let's create an event handler that will respond to all "Hello" messages:
In[57]:=
handlerHi[bot_TelegramBot,update_?AssociationQ]:=​​Module{chat},​​chat=update["message","chat","id"];​​
sendMessage
[bot,chat,"Hello"]​​
Add handler as the bot property:
In[58]:=
bot["UpdateHandler"]=handlerHi
Out[58]=
handlerHi
And create APIFunction in the Wolrfam Cloud:
In[59]:=
webhook=deployWebhook[bot,"webhook"]
Out[59]=
https://www.wolframcloud.com/obj/kirillbelovtest/webhook
Set webhook:
In[60]:=
bot@
setWebhook
[webhook]
Out[60]=
okTrue,resultTrue,descriptionWebhook was set
Go to the chat and let;s send to the bot "Hi"
RelatedGuides
▪
TelegramBot Guide
RelatedTechNotes
▪
LongPolling
""

Powered by the Wolfram Cloud More about Wolfram Technology

© 2022 Wolfram Research, Inc. All rights reserved. Terms of Use Privacy Contact Us