Skip to content

Commit 4a16c96

Browse files
Update the Readme with instructions
1 parent 06769e2 commit 4a16c96

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed

.env.sample

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
TELEGRAM_BOT_TOKEN=telegram_bot_token
2+
TELEGRAM_CHAT_ID=telegram_chat_id
3+
ACCOUNT_NO=desco_account_number

README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# DESCO Balance Bot Script
2+
3+
## Setting up Locally:
4+
5+
- You need `Python 3` installed on your computer
6+
7+
Install the following Python dependencies:
8+
9+
```bash
10+
pip install requests python-dotenv
11+
```
12+
13+
Rename the `.env.sample` file to `.env` file:
14+
15+
```bash
16+
mv .env.sample .env
17+
```
18+
19+
## Setting up the Telegram bot:
20+
21+
1. Open Botfather https://t.me/botfather and follow the instructions to create your bot (e.g, Desco Balance Bot). You will get a telegram bot token.
22+
2. Copy and add it to `TELEGRAM_BOT_TOKEN` in the `.env` file.
23+
3. Send a `hi/hello` chat to your new bot.
24+
4. Open this URL in your browser `https://api.telegram.org/bot{TELEGRAM_BOT_TOKEN}/getUpdates`
25+
5. Copy the chat `id` value and add it to the `TELEGRAM_CHAT_ID` in the `.env` file.
26+
27+
## Run the script:
28+
29+
```bash
30+
python check_balance.py
31+
```
32+
33+
Output:
34+
35+
```bash
36+
/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/urllib3/connectionpool.py:1097: InsecureRequestWarning: Unverified HTTPS request is being made to host 'prepaid.desco.org.bd'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings
37+
warnings.warn(
38+
39+
(True, 'Telegram sent')
40+
```
41+
42+
Ignore the SSL warning for now (I will update it later); you should see (True, 'Telegram sent`)
43+
44+
And receive a message in your Telegram app.
45+
46+
## Known issues:
47+
48+
It is possible that behind the scenes, DESCO is using multiple endpoints for quering various Meter types.
49+
50+
The endpoint this script is using is:
51+
52+
```text
53+
https://prepaid.desco.org.bd/api/unified/customer/getBalance?accountNo=
54+
```
55+
56+
So please test this endpoint with your DESCO account and first verify that this is working for your meter.

0 commit comments

Comments
 (0)