Commands-triggers-telegram has issues went I place msg.chat.id outside of bot.BlahBlah

The Problem

I placed const chatId = msg.chat.id outside of bot.insertMethodHere and Node.js fires up some syntax errors. Any help? My project is commands-triggers-telegram. I also tried to change msg.chat.id to bot.chat.id, the server is still going berserk.

The Code

# This code was derived from the project's bot.js, automatically required
# in server.js and index.js.

// Import the required packages
const TelegramBot = require('node-telegram-bot-api');
 
// Pull token from your deepest secrets
const token = process.env.TELEGRAM_BOT_TOKEN;
var webhookEndpoint = process.env.BASE_URL+"/bot"+process.env.TOKEN
const options = {
  port: process.env.PORT || 443
}
const bot = new TelegramBot(token, options);
const chatId = bot.chat.id;

bot.setWebHook(`${webhookEndpoint}`);

bot.onText(/\/start/, (msg) => {
  // 'msg' is the received Message from Telegram
  // 'match' is the result of executing the regexp above on the text content
  // of the message

  // send back the matched "whatever" to the chat
  if (chatId = -1001433048902){
    bot.sendMessage(chatId, "The bot is working here in this chat. Use /getID", {parse_mode: "MarkdownV2"});
  } else {
    bot.sendMessage(chatId, "*Hello, world!\n\nThis bot is*", {parse_mode: "MarkdownV2"});
  }
});

The Error Logs

/app/bot.js:11
const chatId = bot.chat.id;
                        ^
TypeError: Cannot read property 'id' of undefined
at Object.<anonymous> (/app/bot.js:11:25)
    at Module._compile (internal/modules/cjs/loader.js:701:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
    at Module.load (internal/modules/cjs/loader.js:600:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
    at Function.Module._load (internal/modules/cjs/loader.js:531:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (/app/server.js:5:1)
    at Module._compile (internal/modules/cjs/loader.js:701:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
    at Module.load (internal/modules/cjs/loader.js:600:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
    at Function.Module._load (internal/modules/cjs/loader.js:531:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (/app/index.js:8:1)
    at Module._compile (internal/modules/cjs/loader.js:701:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
    at Module.load (internal/modules/cjs/loader.js:600:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
    at Function.Module._load (internal/modules/cjs/loader.js:531:3)