Telegram Bot Library

Host a Telegram Bot on your Arduino and chat with your brand new IoT device!

Mar 29, 2016

106123 views

67 respects

Components and supplies

1

Arduino MKR1000

Apps and platforms

1

Arduino Web Editor

Project description

Code

Comments

Only logged in users can leave comments

Immagine
Immagine

Anonymous user

2 years ago

Thank you for this! I run this code but I have this Error Arduino: 1.8.1 (Windows 7), Board: "Adafruit HUZZAH ESP8266, 80 MHz, 115200, 4M (3M SPIFFS)" recipe.preproc.macros pattern is missing Error compiling for board Adafruit HUZZAH ESP8266. This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences. I hope this helps

Immagine
Immagine

Anonymous user

2 years ago

how if i wanna make a water sensor project? if the water sensor detect water presence, arduino will send noti to tele bot? help me please

Immagine
Immagine

Anonymous user

2 years ago

someone can help me, i can't verfy this code because "client" cannot be declare And how to solve this ? Thanks before

Immagine
Immagine

Anonymous user

2 years ago

Hi, send to Brazil.

Immagine
Immagine

DrGruselglatz

2 years ago

Thank you for this! Just what I have been looking for :-)

Immagine
Immagine

albiovo

2 years ago

Awesome project! Thank you! But i still cannot compile the code without errors: "exit status 1 request for member 'equals' in 'm.message::text', which is of non-class type 'const char*' " Can you help me? P.S. I've already installed all the libraries

Immagine
Immagine

Mailow

2 years ago

How i can use this with W5100?

Immagine
Immagine

Anonymous user

2 years ago

Hello! I'm having issues on a MKR1000. The compiling is ok, wifi is ok, Bot was created, but I can't get a connection to the host in bot.begin().

Immagine
Immagine

Anonymous user

2 years ago

That helps a lot, thank you very much!

Immagine
Immagine

Anonymous user

2 years ago

After some tests, I was able to get something. Before all, you must upload "FirmwareUpdater" to your MKR1000, then launch tool/firmware update, add domain "api.telegram.org" and upload the certificate in the module. Then, I suggest to modify the getupdate function TelegramBot.cpp, with this string replacing the original String getRequest..etc : String getRequest = "GET /bot"+String(token)+"/getUpdates?offset="+String(last_message_recived)+"&limit=2 HTTP/1.1"; This limits the quantity of messages in queue that the program must process at once, and prevent inexplicable freezes.

Immagine
Immagine

Anonymous user

2 years ago

Hi im to try with wiznet 5100 eternet chip, but i dont get anything of your library: const char BotToken[] = "---------"; IPAddress ip(192, 168, 1, 177); EthernetClient client; TelegramBot bot (BotToken, client); and in setup function i have: if (Ethernet.begin(mac) == 0) Ethernet.begin(mac, ip); bot.begin(); so in loop function: message m = bot.getUpdates(); Serial.println(m.text); if ( m.chat_id != 0 ){ Serial.println(m.text); bot.sendMessage(m.chat_id, m.text); // Reply to the same chat with the same text } else { Serial.println("no new message"); } but i dont get any data :( it get some invalid data and after 5 sec, it will be stop. whats wrong?

Immagine
Immagine

Anonymous user

2 years ago

Hi , i get response only: coconnecting...connected HTTP/1.1 301 Moved Permanently Server: nginx/1.10.0 Date: Sat, 24 Dec 2016 11:32:31 GMT Content-Type: text/html Content-Length: 185 Location: https://api.telegram.org/bot<token>/getMe Connection: close <html> <head><title>301 Moved Permanently</title></head> <body bgcolor="white"> <center><h1>301 Moved Permanently</h1></center> <hr><center>nginx/1.10.0</center> </body> </html> disconnecting. ########## why?

Immagine
Immagine

Anonymous user

2 years ago

does it also work with the new mkr 1010 card

Immagine
Immagine

Anonymous user

2 years ago

Not work...Arduino connects itself to the wifi, but the commands not work... When I send On or Off to the bot nothing appear.

Immagine
Immagine

Anonymous user

2 years ago

The code as I see it posted here on May 13, 2016 needs to be tweaked just a little bit in order to compile without errors on the MKR1000. The changes include: - you don't need the WiFiSSLClient.h include (comment it out with // at the start of that line of code) - the lines that Initialize the Telegram BOT need to be changed so that instead of const String.... for each of those 3 lines of code change it to read const char BotToken[]=..... etc. After that, no problems! Nice example, thanks for sharing this!!

Immagine
Immagine

Anonymous user

2 years ago

Does it work with NodeMCU?

Immagine
Immagine

Anonymous user

2 years ago

Good day! Im using Arduino WiFi shield and I have a problem with connection...seems like it doesnt work with arduino wifi shield , only for wifi101? is there any available Telegram Bot library for Arduino WiFi shield ?

Immagine
Immagine

Anonymous user

2 years ago

Good night! Im using Arduino WiFi shield and I have a problem with connection...seems like it doesnt work with arduino wifi shield , only for wifi101? is there any available Telegram Bot library for Arduino WiFi shield ?

Immagine
Immagine

cecchellone

2 years ago

It will also be a version for Arduino yun?

Immagine
Immagine

Anonymous user

2 years ago

Это не будет работать! Во-первых библиотеку лучше использовать https://github.com/witnessmenow/Universal-Arduino-Telegram-Bot Та, что в статье заброшена. В библиотеке есть пример кода — он работает, если выполнены остальные условия Во-вторых библиотека JSON должна быть версии 5.13.5 НЕ ВЫШЕ! В-третьих в менеджере плат должна стоять версия 2.4.2 опять же НЕ ВЫШЕ! и В-четвёртых (для РФ) блокировка телеграмма должна быть обойдена на уровне роутера. This is not work! First, the library is better to use https://github.com/witnessmenow/Universal-Arduino-Telegram-Bot Library from article is abandoned. The library has sample code - it works if the other conditions are met Secondly, the JSON library should be version 5.13.5 NOT NEWER! Thirdly, version 2.4.2 should be in the board manager, NOT NEWER! and Fourth (for the Russian Federation) telegram blocking should be bypassed at the router level.

Immagine
Immagine

Myo_Myint_Naing

2 years ago

My Mkr 1000 keeps freezing after one message received. It turns on the light when i send "On". and then it freezes. any idea what might be wrong with my board. or any workaround to reset the board?

Immagine
Immagine

Anonymous user

2 years ago

Hi, I had the same issue as Albiovo. I have solved it by updating all my libraries. The versions that I use now are: wifi101 version 0.10.0 SPI version 1.0 Telegrambot version 1.2.1 ArduinoJson version 5.6.6 I hope this helps :)