=== IntentRank ===
Contributors: intentrank
Tags: content, automation, api, rest-api, articles, blogging, seo
Requires at least: 5.0
Tested up to: 6.9
Stable tag: 1.0.0
Requires PHP: 7.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Integrate IntentRank to automatically post articles to your WordPress blog via REST API.

== Description ==

A WordPress plugin that integrates with IntentRank to automatically post articles to your WordPress blog. The plugin provides a seamless integration that allows IntentRank to send articles directly to your WordPress site via REST API endpoints.

= Features =

* **Integration Key Authentication**: Secure API authentication using integration keys with multiple authentication methods
* **Flexible Post Modes**: Choose whether posts are published immediately or saved as drafts for review
* **Dual REST API Endpoints**: Modern `/articles` endpoint for bulk article processing (recommended) and legacy `/post` endpoint for backward compatibility
* **Test Endpoint**: Verify your integration configuration with the `/test` endpoint
* **Full Post Support**: Supports title, content (HTML/Markdown), excerpt, categories, tags, featured images, and custom slugs
* **SEO Integration**: Automatic focus keyword support for popular SEO plugins (Yoast SEO, Rank Math, SEOPress, The SEO Framework)
* **Automatic Category/Tag Creation**: Automatically creates categories and tags if they don't exist
* **Smart Image Handling**: Downloads featured images from external URLs (including S3), automatically inserts images into post content, and saves images to WordPress media library
* **Admin Interface**: Articles management page with unpublished article count, manual publish functionality for draft articles, bulk publish capability, and settings page with API endpoint information
* **Content Processing**: Automatically cleans HTML content (removes code block markers)
* **Custom Post Type**: Uses a dedicated post type to track IntentRank articles separately from regular posts

= Installation =

1. Upload the `intentrank-wordpress-plugin` folder to the `/wp-content/plugins/` directory
2. Activate the plugin through the 'Plugins' menu in WordPress
3. Navigate to Settings > IntentRank to configure your integration

= Configuration =

1. **Get Your Integration Key**: Log in to your IntentRank account, navigate to WordPress integration settings, and generate your Integration Key
2. **Configure Plugin Settings**: Go to IntentRank > Settings in your WordPress admin panel (or navigate to Settings > IntentRank)
3. **Paste your Integration Key** in the "Integration Key" field
4. **Select your Post Mode**:
   * **Save as Draft**: Posts will be saved as drafts in the IntentRank Articles section for review and manual publishing
   * **Post Directly**: Posts will be published immediately to your WordPress blog
5. Click "Save Settings"

= Managing Articles =

After configuration, you can manage incoming articles:

* **View Articles**: Go to IntentRank > Articles to see all received articles
* **Unpublished Count**: The menu shows a badge with the count of unpublished articles
* **Publish Articles**: Click "Publish" on individual articles or use "Bulk Publish" for multiple articles
* **Edit Articles**: Click on any article to edit it before publishing

= API Endpoints =

The settings page displays your API endpoints:

* **Articles Endpoint**: `/wp-json/intentrank/v1/articles` (recommended for new integrations)
* **Legacy Post Endpoint**: `/wp-json/intentrank/v1/post` (for backward compatibility)
* **Test Endpoint**: `/wp-json/intentrank/v1/test` (for verifying integration configuration)

Copy these URLs to configure in your IntentRank account.

== Frequently Asked Questions ==

= How do I get my Integration Key? =

Log in to your IntentRank account, navigate to WordPress integration settings, and generate your Integration Key. Copy the key and paste it into the plugin settings page.

= What are the API endpoints? =

The plugin provides three REST API endpoints:

* **Articles Endpoint** (Recommended): `/wp-json/intentrank/v1/articles` - Supports bulk article processing with the new payload format
* **Legacy Post Endpoint**: `/wp-json/intentrank/v1/post` - For backward compatibility with single post creation
* **Test Endpoint**: `/wp-json/intentrank/v1/test` - Verify your integration configuration and API key

= Can I review articles before publishing? =

Yes! Set the Post Mode to "Save as Draft" in the plugin settings. Articles will be saved in the IntentRank Articles section where you can review, edit, and publish them manually. You can also use the bulk publish feature to publish multiple articles at once.

= How does authentication work? =

The plugin supports multiple authentication methods for API requests:

* Authorization Header: `Authorization: Bearer YOUR_INTEGRATION_KEY`
* X-API-Key Header: `X-API-Key: YOUR_INTEGRATION_KEY`
* Query Parameter: `?api_key=YOUR_INTEGRATION_KEY`

= Does the plugin support SEO plugins? =

Yes! The plugin automatically saves focus keywords for popular SEO plugins:
* Yoast SEO
* Rank Math
* SEOPress
* The SEO Framework

Keywords are sent in the `keyword` field of the articles endpoint payload.

= How are images handled? =

Featured images are automatically downloaded from external URLs (including S3), saved to the WordPress media library, and inserted at the beginning of post content. WordPress automatically generates thumbnails and attachment metadata.

= What content formats are supported? =

The plugin supports HTML and Markdown content formats. HTML content is automatically sanitized and filtered to prevent XSS attacks. Code block markers are automatically removed from content.

== Screenshots ==

1. Settings page showing integration key configuration and API endpoints
2. Articles list page with unpublished articles count badge
3. Article management interface with publish and edit options

== Changelog ==

= 1.0.0 =
* Initial release
* Integration key authentication with multiple methods (Authorization header, X-API-Key header, query parameter)
* Draft and publish post modes
* Full post support (title, content, excerpt, categories, tags, featured images, slugs)
* Dual REST API endpoints (articles and legacy post)
* Test endpoint for integration verification
* SEO keyword support for Yoast SEO, Rank Math, SEOPress, and The SEO Framework
* Automatic image download and media library integration
* Content cleaning (removes code block markers)
* Admin interface with articles management
* Manual and bulk publish functionality
* Custom post type for IntentRank articles tracking

== Upgrade Notice ==

= 1.0.0 =
Initial release of IntentRank WordPress Plugin. Install and configure your integration key to start receiving articles from IntentRank.

