Skip to content

Latest commit

 

History

History
46 lines (34 loc) · 941 Bytes

README.md

File metadata and controls

46 lines (34 loc) · 941 Bytes

ESP32-Telegram

A simple wrapper for Telegram Bot READ/SEND operations.

Installation

Example

#include <Arduino.h>
#include <Telegram.h>
#include <WiFi.h>

String chatId = "1234567890";
Telegram::Telegram telegram("3412604351:ABFopWfkL1fKu5_KmGfaA5DbRM9Gjey7uxs");

void setup()
{
  Serial.begin(9600);

  WiFi.begin("IoT", "");
  while (WiFi.status() != WL_CONNECTED)
  {
    delay(500);
    Serial.print(".");
  }

  telegram.sendMessage(chatId, "Starting up...");
}

void loop()
{
  vector<Telegram::Message> messages = telegram.readMessages();
  for (Telegram::Message message : messages)
  {
    Serial.println("[" + message.chat_id + "]: " + message.text);
  }

  delay(500);
}