How to 'chat' with a Telegram BOT using ESP8266 nodemcu

How do I ensure that a value entered in BOT Telegram is recognized by the code below and assigned to a String control ?

//https://github.com/GyverLibs/FastBot

#define WIFI_SSID "ABCD"
#define WIFI_PASS "1234"
#define BOT_TOKEN "56477697779:AA2NwXT1lDSKbu4Q1f3Cmo"
#define CHAT_ID "61123744745"

String control;

#include <FastBot.h>
FastBot bot(BOT_TOKEN);

void setup() {
  
  connectWiFi();

  bot.attach(newMsg);
  bot.setChatID(CHAT_ID);
}

void newMsg(FB_msg& msg) {
 
  Serial.println(msg.toString());

  if(msg.text == "control") {
     bot.sendMessage("enter the control value", CHAT_ID);
           ?????? If I enter a value in Telegram, say control1234, what guarantees it will be 
           assigned to the String control ?  
}

  
//  bot.editMessage(bot.lastBotMsg(), msg.text);

}

void loop() {
  bot.tick();
}

void connectWiFi() {
  delay(2000);
  Serial.begin(115200);
  Serial.println();

  WiFi.begin(WIFI_SSID, WIFI_PASS);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
    if (millis() > 15000) ESP.restart();
  }
  Serial.println("Connected");
}

,

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.