Integrations
WordPress Integration
🔧 Method
Webhook or REST API
📦 Requirements
WordPress 5.8+, PHP 7.4+
Connect Blogree to any WordPress site to automatically publish AI-generated posts as WordPress drafts or live posts. Blogree delivers content via signed webhook and supports Gutenberg block format, classic editor, and custom post types.
Method 1 — Blogree WordPress Plugin (Recommended)
Step 1: Install the Plugin
Install the official Blogree plugin from the WordPress plugin directory:
- Log in to your WordPress admin
- Go to Plugins → Add New Plugin
- Search for "Blogree"
- Click Install Now → Activate
Or install manually by uploading the plugin ZIP from the Blogree plugin page.
Step 2: Configure the Plugin
After activation, go to Settings → Blogree in your WordPress admin. You'll see the plugin configuration page:
WordPress Admin → Settings → Blogree
Fields to fill in:
Webhook Secret: [paste from Blogree Dashboard → Sites → your site → Settings]
Post Status: Draft | Published (choose what happens when post arrives)
Post Author: Select which WordPress user to assign posts to
Post Format: Gutenberg Blocks | Classic HTML
Categories: Auto-assign posts to specific categories
Click "Save Settings" → "Test Connection"
After saving, copy the Webhook URL shown at the top of the plugin settings page. It will look like:
https://yourwordpresssite.com/wp-json/blogree/v1/webhook
Step 3: Add Webhook URL to Blogree
Back in the Blogree dashboard, go to Sites → your site → Settings, paste the webhook URL, and click Save. Then click Test Delivery to confirm the connection. You should see a 200 OK response.
✅After a successful test, the plugin creates a draft post in WordPress titled "Blogree Test Post — [timestamp]". You can delete this test post from your WordPress Posts list.
Method 2 — Manual Webhook via functions.php
If you prefer not to use a plugin, you can add the webhook handler directly to your theme's functions.php or a custom plugin:
<?php
// Add to functions.php or a custom plugin file
add_action('rest_api_init', function() {
register_rest_route('blogree/v1', '/webhook', [
'methods' => 'POST',
'callback' => 'blogree_handle_webhook',
'permission_callback' => '__return_true',
]);
});
function blogree_handle_webhook(WP_REST_Request $request) {
// Verify HMAC signature
$raw_body = $request->get_body();
$signature = $request->get_header('x-blogree-signature');
$secret = defined('BLOGREE_WEBHOOK_SECRET') ? BLOGREE_WEBHOOK_SECRET : get_option('blogree_webhook_secret');
$expected = 'sha256=' . hash_hmac('sha256', $raw_body, $secret);
if (!hash_equals($expected, $signature)) {
return new WP_Error('unauthorized', 'Invalid signature', ['status' => 401]);
}
$payload = $request->get_json_params();
$post = $payload['post'];
// Create WordPress post
$post_id = wp_insert_post([
'post_title' => sanitize_text_field($post['title']),
'post_content' => wp_kses_post($post['body']['html']),
'post_excerpt' => sanitize_text_field($post['excerpt'] ?? ''),
'post_status' => 'publish', // or 'draft' for review
'post_author' => 1,
'post_name' => sanitize_title($post['slug']),
'tags_input' => $post['tags'] ?? [],
]);
if (is_wp_error($post_id)) {
return new WP_Error('create_failed', $post_id->get_error_message(), ['status' => 500]);
}
// Set SEO meta (works with Yoast, RankMath, AIOSEO)
if (!empty($post['meta']['title'])) {
update_post_meta($post_id, '_yoast_wpseo_title', $post['meta']['title']);
update_post_meta($post_id, 'rank_math_title', $post['meta']['title']);
}
if (!empty($post['meta']['description'])) {
update_post_meta($post_id, '_yoast_wpseo_metadesc', $post['meta']['description']);
update_post_meta($post_id, 'rank_math_description', $post['meta']['description']);
}
if (!empty($post['meta']['og_image'])) {
// Download and set as featured image
$image_id = media_sideload_image($post['meta']['og_image'], $post_id, null, 'id');
if (!is_wp_error($image_id)) {
set_post_thumbnail($post_id, $image_id);
}
}
return new WP_REST_Response(['success' => true, 'post_id' => $post_id], 200);
}
Define the secret in wp-config.php
// wp-config.php
define('BLOGREE_WEBHOOK_SECRET', 'whs_your_secret_here');
Your Webhook URL
https://yourwordpresssite.com/wp-json/blogree/v1/webhook
SEO Plugin Compatibility
Blogree automatically populates SEO fields for the most popular WordPress SEO plugins:
| SEO Plugin | Title Field | Description Field | Support |
|---|
| Yoast SEO | _yoast_wpseo_title | _yoast_wpseo_metadesc | ✓ Full support |
| RankMath | rank_math_title | rank_math_description | ✓ Full support |
| AIOSEO | _aioseo_title | _aioseo_description | ✓ Full support |
| SEOPress | _seopress_titles_title | _seopress_titles_desc | ✓ Full support |
| No SEO plugin | post_title (fallback) | post_excerpt (fallback) | ✓ Basic support |
Gutenberg Block Format
When using Gutenberg block editor, enable the Gutenberg Format option in the plugin settings. Blogree will convert the HTML post body into native Gutenberg blocks:
// Blogree converts:
<h2>Section Title</h2>
<p>Paragraph text here...</p>
<ul><li>Item 1</li><li>Item 2</li></ul>
// Into Gutenberg blocks:
<!-- wp:heading {"level":2} -->
<h2>Section Title</h2>
<!-- /wp:heading -->
<!-- wp:paragraph -->
<p>Paragraph text here...</p>
<!-- /wp:paragraph -->
<!-- wp:list -->
<ul><li>Item 1</li><li>Item 2</li></ul>
<!-- /wp:list -->
Troubleshooting
⚠️The most common WordPress issue is REST API authentication conflicts with security plugins like Wordfence or iThemes Security. If you get 401 or 403 errors, temporarily disable these plugins and test again.
403 Forbidden
Your security plugin is blocking the webhook endpoint. Whitelist the Blogree IP ranges in your security plugin settings, or add an exception for the /wp-json/blogree/ route.
401 Unauthorized
The webhook secret doesn't match. Go to Settings → Blogree in WordPress admin and verify the secret matches exactly what's shown in Blogree Dashboard → Sites → Settings → Webhook Secret.
Post created but empty
The HTML sanitization may be stripping content. Lower the wp_kses_post() restriction or use wp_unslash() before inserting. Check WordPress debug log at /wp-content/debug.log.
Images not importing
The media_sideload_image function requires allow_url_fopen to be enabled in php.ini, or an alternative HTTP library. Check your hosting's PHP configuration.