A project by Casa Jasmina
This library allows you to host a Telegram Bot on your Arduino, and interact with telegram bot API.
It works on [Arduino/Genuino MKR1000] (http://www.arduino.cc/en/Main/ArduinoMKR1000), and on Arduino Zero with the WiFi shield 101.
The library can be installed from the library manager or added manually selecting the menu:
Sketch / include Library / Add .Zip library
You also have to install the ArduinoJson library written by Benoît Blanchon. Available here.
View the last released Telegram API documentation at: https://core.telegram.org/bots/api.
To generate your new Bot, you need an Access Token. Talk to BotFather and follow a few simple steps described here.
For full details, see "Bots: An introduction for developers".
TelegramBot(const char* token, Client &client);
String sendMessage(String chat_id, String my_text);
String sendMessage(String chat_id, String my_text, Keyboard keyboard, bool one_time_keyboard = true, bool resize_keyboard = true);
String postMessage(String msg);
message getUpdates();
struct message{
const char* text;
const char* chat_id;
const char* sender;
const char* date;
};
When the bot is included in a group it will be, by default, in privacy mode. Which means that it will receive only messages starting with "/", the so called commands. In order to disable the privacy mode you have to chat with BotFather and use this commands:
/mybots
@yourBot
Bot setting
Group privacy
Turn off
You can also create your own list of commands using /setcommands while chatting with the BotFather. This list will appear only in the mobile view, pressing the "/" icon.
In the long run we recommend to use a watchdog. If you are using the library Adafruit sleepy dog in its 1.1.1 (or later) version, you have also to download the Adafruit_ASFcore library.
You may copy, distribute and modify the software provided that modifications are described and licensed for free under LGPL-3. Derivatives works (including modifications or anything statically linked to the library) can only be redistributed under LGPL-3, but applications that use the library don't have to be.