A plugin for fetching and handling real-time news data through NewsAPI integration.
This plugin provides functionality to:
- Fetch latest news articles from NewsAPI
- Search news by specific topics or keywords
- Get article summaries including titles, descriptions, and URLs
- Limit results to most recent and relevant content
npm install @elizaos/plugin-news
The plugin requires the following environment variable:
NEWS_API_KEY=your_newsapi_key # Required for accessing NewsAPI
Import and register the plugin in your Eliza configuration:
import { newsPlugin } from "@elizaos/plugin-news";
export default {
plugins: [newsPlugin],
// ... other configuration
};
The plugin provides a CURRENT_NEWS
action that responds to various news-related queries:
// Example queries the action responds to:
"what's the latest news about <searchTerm>?"
"can you show me the latest news about <searchTerm>?"
"what's in the <searchTerm> news today?"
"show me current events about <searchTerm>?"
"what's going on in the world of <searchTerm>?"
"give me the latest headlines about <searchTerm>?"
"show me news updates about <searchTerm>?"
"what are today's top stories about <searchTerm>?"
The action returns up to 5 recent articles, including:
- Article title
- Description
- URL
- Content preview (up to 1000 characters)
npm run build
npm run dev
npm run lint
plugin-news/
├── src/
│ ├── actions/ # Action implementations
│ │ ├── news.ts # Current news action
│ │ └── index.ts # Action exports
│ └── index.ts # Main plugin export
├── package.json
└── tsconfig.json
@ai16z/eliza
: Core Eliza frameworktsup
: Build tool for TypeScript packages- Other standard dependencies listed in package.json
CURRENT_NEWS
: Main action for fetching news- Aliases:
["NEWS", "GET_NEWS", "GET_CURRENT_NEWS"]
- Automatically extracts search terms from user messages
- Returns formatted news articles with titles, descriptions, and URLs
- Aliases:
interface NewsResponse {
title: string;
description: string;
url: string;
content: string; // Limited to 1000 characters
}
-
Additional News Sources
- Integration with multiple news APIs
- RSS feed support
- Social media news aggregation
-
Content Analysis
- Sentiment analysis of news articles
- Topic categorization
- Trend detection
- Fact-checking integration
-
Customization Options
- User preferences for news sources
- Custom filtering rules
- Personalized news feeds
- Language preferences
-
Advanced Search
- Date range filtering
- Source filtering
- Category-based search
- Advanced query syntax
-
Performance Improvements
- Caching layer
- Rate limiting optimization
- Response compression
- Batch processing
We welcome community feedback and contributions to help prioritize these enhancements.
Contributions are welcome! Please see the CONTRIBUTING.md file for more information.
This plugin is part of the Eliza project. See the main project repository for license information.
This plugin integrates with and builds upon several key technologies:
- NewsAPI: News data provider
Plugin generated from Eliza coding tutorial Agent Dev School Part 2