Skip to content

Commit 20351ae

Browse files
committed
Updating Readme with api
1 parent bda42a1 commit 20351ae

File tree

1 file changed

+27
-5
lines changed

1 file changed

+27
-5
lines changed

README.md

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ The downloaded code can be included as a new library into the IDE selecting the
2424

2525
Sketch / include Library / Add .Zip library
2626

27-
You also have to install the ArduinoJson library written by [Benoît Blanchon](https://github.com/bblanchon).
28-
Available [here](https://github.com/bblanchon/ArduinoJson).
27+
You also have to install the ArduinoJson library written by [Benoît Blanchon](https://github.com/bblanchon). Search for it on the Arduino Library manager or get it from [here](https://github.com/bblanchon/ArduinoJson).
2928

3029
Include UniversalTelegramBot in your project:
3130

@@ -34,7 +33,8 @@ Include UniversalTelegramBot in your project:
3433
and pass it a Bot token and a SSL Client (See the examples for more details)
3534

3635
#define BOTtoken "XXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
37-
WiFiClientSecure client;
36+
// WiFiSSLClient client; //For 101 boards
37+
WiFiClientSecure client; //For ESP8266 boards
3838
UniversalTelegramBot bot(BOTtoken, client);
3939

4040
*NOTE:* This library has not been tested with the 101 boards as I do not have a compatible board. If you can help please let me know!
@@ -47,6 +47,30 @@ To generate your new Bot, you need an Access Token. Talk to [BotFather](https://
4747

4848
For full details, see "[Bots: An introduction for developers](https://core.telegram.org/bots)".
4949

50+
## --- API ---
51+
52+
These are the main functions of the library
53+
54+
#### sendMessage
55+
56+
bool sendMessage(String chat_id, String text, String parse_mode);
57+
58+
Send a message to the specified chat_id. parse_mode can be left blank. Will return true if the message sends successfully.
59+
60+
#### sendMessageWithReplyKeyboard
61+
62+
bool sendMessageWithReplyKeyboard(String chat_id, String text,
63+
String parse_mode, String keyboard, bool resize = false,
64+
bool oneTime = false, bool selective = false);
65+
66+
Send a keyboard to the specified chat_id. parse_mode can be left blank. Will return true if the message sends successfully. See the CustomKeyboard example for more details.
67+
68+
#### getUpdates
69+
70+
int getUpdates(long offset);
71+
72+
Gets any pending messages from Telegram and stores them in bot.messages . Offset should be set to bot.last_message_recived + 1. Returns the numbers new messages received. See any of the examples for recommended usage.
73+
5074

5175
## Examples
5276

@@ -56,8 +80,6 @@ Here are listed some examples to help you to build your own Bot:
5680

5781
- FlashLedBot : Reacts to your command switching ON/OFF a GPIO.
5882

59-
- EchoBotWithPost : same as EchoBot but using post to commincate with Telegram.
60-
6183
- CustomKeyboard : Same as FlashLedBot but also uses a replyKeyboard
6284

6385

0 commit comments

Comments
 (0)