The News Reporter API is a microservices-based application for fetching and aggregating news according to user preferences. It supports sending notifications through different communication channels such as email, etc.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
-
Clone the repository:
git clone https://github.com/SubZeroX9/TheNewsReporter.git cd TheNewsReporter -
Change example.env in root to .env and update Variables
-
Set up Docker containers:
docker-compose up -d
-
Install the required .NET packages:
dotnet restore
-
Change
.env.examplefile in root to.envand update Variables -
Update
docker-compose.ymlwith your configurations. Examples: (Can Also Be found inappsettings.jsonof each service)- In AI Assistant Accessor
thenewsreporter.accessors.aiassistentservice: environment: - AIApiSettings__ApiKey=${AI_API_KEY} - AIApiSettings__ApiUrl="https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash-latest:generateContent?key="
- In User Preferences Accessor
thenewsreporter.accessors.userpreferencesservice: environment: - MongoDatabase__ConnectionString=mongodb://mongodb-service:27017 - MongoDatabase__DatabaseName="TheNewsReporter" - MongoDatabase__CollectionName="UserPreferences"
-
In News Aggregation Accessor
thenewsreporter.accessors.newsaggregationservice: environment: - NewsApiSettings__APIKey=${NEWS_API_KEY} - NewsApiSettings__BaseUrl="https://newsdata.io/api/1" - NewsApiSettings__PageSize=10
-
In NotificationApi Accessor
thenewsreporter.accessors.notificationservice: environment: - MailGunApiSettings__ApiKey=${MAILGUN_API_KEY} - MailGunApiSettings__BaseUrl="https://api.mailgun.net/v3" - MailGunApiSettings__Domain="sandboxcc3640df3a734f9281b2885ba77b09ce.mailgun.org" - MailGunApiSettings__DisplayName="The News Reporter"
-
Start the API:
dotnet run
-
Access the API documentation at
http://localhost:5006/using Swagger.
- GET /alluserpreferences: Get all user preferences.
- GET /{id}: Get User Preferences by ID.
- POST /setuserpreferencesqueue: Create new user preferences.
- PUT /updateuserpreferencesqueue: Update user preferences by ID.
- DELETE /deleteuser/{id}: Delete user preferences by ID.
- GET /api/NewsAggregation/latest-news: Get latest News.
- GET /api/NewsAggregation/latest-news-by-category: Get latest news by category.
- POST /sendnotification: Send a notification.(used by pubsub)
- POST /AIAssistant/recommend: Get recommended News articles based on preferences and articles from AI.
- POST /AIAssistant/summarize: Get summerized articles from provided articles by AI.
- POST /recommendandsummerizequeue: Get recommended and summerized News articles based on preferences and articles from AI.
- POST /api/NewsApi/setpreferences: Creates New Preferences for a user.
- PUT /api/NewsApi/updateprefes: Updates User Preferences.
- GET api/NewsApi/getnews/{id}: Get latest news for user id (based on preferences).
To get the latest news and process notifications for a user, make a GET request to:
curl -X GET "http://localhost:5006/api/newsaggregation/getnews/{id}" -H "accept: text/plain"The Gemini AI service is used for enhancing the news articles with additional AI-generated insights.
- Documentation: Gemini AI API Docs
MailGun is used for sending email notifications to users.
- Documentation: MailGun API Docs
NewsData.io is used for fetching the latest news articles.
- Documentation: NewsData.io API Docs
This project is licensed under the MIT License - see the LICENSE.md file for details.