Skip to content

Commit

Permalink
Update README.md: Documentation including Setup Guide
Browse files Browse the repository at this point in the history
  • Loading branch information
bright-sd committed Oct 10, 2023
1 parent 7dad175 commit 650b79a
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 7 deletions.
59 changes: 57 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,57 @@
# mini-tech-news
Telegram Mini App to help users catch up on the latest tech news
# Mini Tech News

Telegram Mini App to help users catch up on the latest tech news.

## Overview

Mini Tech News is a Telegram Mini App that delivers the latest tech news directly to users. It offers a range of features to enhance the user's experience, including personalized greetings and message on closing the app.

## Features

- Accessible via bot menu and inline keyboard options.
- Delivers the latest tech news daily.
- Allows users to open news articles externally to access the source.
- Personalizes user interaction by greeting them with their first name.
- Sends a Telegram message to the user upon closing the app.
- Includes robust error handling.

## Technologies Used

- Flask
- Semantic UI
- requests (Telegram Bot API)

## Setup Guide

### Project Structure

- **Static**: Contains the CSS file for styling.
- **Templates**: Holds the Flask template file for the web app.
- **app.py**: Contains the application logic and routes for the web app.
- **config.py**: Loads environment variables required for the web app to run.
- **Utilities**: Includes various utility files, such as `emoji.py` for emoji constants and `news.py` for fetching tech news.

### News API

To fetch news articles, register and obtain an API key from [News API](https://newsapi.org/).

### Webhook

Set up a webhook to receive bot updates from Telegram. In `webhook.py`, replace the values of `bot_token` and `app_url`, then run the script. `app_url` should be the URL where bot updates will be received.

### Environment Variables

For the app to run, set the following environment variables:

- `FLASK_SECRET_KEY`: Flask secret key.
- `APP_URL`: Base URL of the app.
- `BOT_TOKEN`: Telegram bot token.
- `NEWS_API_KEY`: News API key obtained earlier.

### Deploying the App

You can deploy the app on various platforms, such as DigitalOcean Apps, Replit, Azure App Services, Google Cloud App Engine, or a virtual machine (VM). Choose the platform that suits your needs.

## License

MIT License
2 changes: 1 addition & 1 deletion templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<body>
<div class="ui menu">
<h4 class="ui header item blue">
<h4 class="ui header item">
<div class="content">
Mini Tech News {{ emoji.NEWSPAPER }}
</div>
Expand Down
8 changes: 4 additions & 4 deletions webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

import requests

bot_token = ""
app_url = ""
bot_token = "BOT_TOKEN"
app_url = "APP_URL"
set_webhook_url = f"https://api.telegram.org/bot{bot_token}/setWebHook?url={app_url}"
verify_webhook_url = f"https://api.telegram.org/bot{bot_token}/getWebhookInfo"


set_response = requests.get(set_webhook_url)
set_response_json = set_response.json()

json.dumps(set_response_json)
print(json.dumps(set_response_json))

verify_response = requests.get(verify_webhook_url)
verify_response_json = verify_response.json()

json.dumps(verify_response_json)
print(json.dumps(verify_response_json))

0 comments on commit 650b79a

Please sign in to comment.