This project fetches the FT (Fuel Tariff) value from the PEA (Provincial Electricity Authority) website and returns it as a JSON response.
-
Clone the repository:
git clone https://github.com/racksync/pea-ft.git cd pea-ft -
Install dependencies:
npm install
-
Create a
default.envfile and add your Telegram credentials:TELEGRAM_BOT_TOKEN=your_telegram_bot_token TELEGRAM_CHAT_ID=your_telegram_chat_id -
Rename
default.envto.env:mv default.env .env
-
Build the project:
npm run build
-
Run the project locally:
npm start
-
Install Wrangler CLI:
npm install -g wrangler
-
Login to Cloudflare:
wrangler login
-
Publish the Worker:
wrangler publish
To configure the worker schedule interval, update the wrangler.toml file. For example, to run the worker every 5 minutes, set the schedule as follows:
[triggers.crons]
schedule = "*/5 * * * *"Send a request to the endpoint to fetch the current FT value:
curl https://your-worker-subdomain.workers.devThis project is licensed under the MIT License.