Wolfram Language Paclet Repository
Community-contributed installable additions to the Wolfram Language
Telegram Bot API client for the Wolfram Language
Contributed by: Kirill Belov
Implementation of the client library for interacting with the Telegram Bots API in the Wolfram Language. With this package, you can execute methods that Telegram Bot API provides to users. In addition, the package has several common features, which provide an opportunity to create a telegram bot that will work in the current session in the long polling mode or deploy the bot to your wolfram cloud storage, where it will work constantly as long as you have enough credits.
To install this paclet in your Wolfram Language environment,
evaluate this code:
PacletInstall["KirillBelov/TelegramBot"]
To load the code after installation, evaluate this code:
Needs["KirillBelov`TelegramBot`"]
Import the package:
In[1]:= | ![]() |
Create the Bot:
In[2]:= | ![]() |
Out[2]= | ![]() |
Check that bot is available:
In[3]:= | ![]() |
Out[3]= | ![]() |
Another way to call methods is following:
In[4]:= | ![]() |
Out[4]= | ![]() |
Get last updates (before this I send to the bot the bot command '/start'):
In[5]:= | ![]() |
Out[5]= | ![]() |
Extract last received message:
In[6]:= | ![]() |
Out[6]= | ![]() |
Get username:
In[7]:= | ![]() |
Out[7]= | ![]() |
Get chat id:
In[8]:= | ![]() |
Out[8]= | ![]() |
Create reply text:
In[9]:= | ![]() |
Out[9]= | ![]() |
And let's send a message to me:
In[10]:= | ![]() |
Out[10]= | ![]() |
The result is:
All action by default saved in the bot history. You can get the history:
In[11]:= | ![]() |
Out[11]= | ![]() |
For example check last response body:
In[12]:= | ![]() |
Out[12]= | ![]() |
Wolfram Language Version 13