Webhooks and telegram api in a function?

Right now I am using an express server locally to test a webhook for Telegram.

I am wondering if there is a way to do this right in my redwood app, maybe in a function, or if I should leave it isolated in the express app, and send requests to a shared database.

I want to just store certain things that get returned from the webhook in a database, such as a username and associated chat_id. This is all console logging for me now.

Ideally the webhook would just listen for certain parameters if it finds those store it in the database in the same row.

Something like

| username | chat_id |
| anderskitson | 1234. |

Then on my redwood db Model I would have a Product table that had username in it to find the correct chat_id in the other database or just another Table called telegram if I keep it all encapsulated in my redwood app.

This chat_id allows me to generate invite links to groups and channels via the bot api.

// Telegram API Configuration
const TELEGRAM_API = `https://api.telegram.org/bot${TELEGRAM_TOKEN}`;
const URI = `/webhook/${TELEGRAM_TOKEN}`;
const webhookURL = `${SERVER_URL}${URI}`;

// configuring the bot via Telegram API to use our route below as webhook
const setupWebhook = async () => {
  try {
    const { data } = await axios.get(
      `${TELEGRAM_API}/setWebhook?url=${webhookURL}&drop_pending_updates=true`
    );
    console.log(data);
  } catch (error) {
    return error;
  }
};

app.listen(PORT, async () => {
  // setting up our webhook url on server spinup
  try {
    console.log(`Server is up and Running at PORT : ${PORT}`);
    await setupWebhook();
  } catch (error) {
    console.log(error.message);
  }
});

From help in the discord, it looks like I can continue on the way I am doing it. Will just leave this here.