=== DIMEDIAL Robbie – Social Media Assistant ===
Contributors: dimedial
Tags: social media, instagram, facebook, whatsapp, automation
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 8.0
Stable tag: 1.0.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Hands featured image and text of a post to the DIMEDIAL Robbie service; you approve the social post via WhatsApp before publishing.

== Description ==

**Your WordPress post. Now also on social media.**

You publish in WordPress as usual. This plugin hands the featured image and the post text to **DIMEDIAL Robbie**, an external service by DIMEDIAL Studio (Herford, Germany). Robbie designs a social media post from it – your original image with a written caption, or optionally, if separately ordered, your individual master layout – writes the caption and sends you a **preview on WhatsApp**. Nothing is ever published without your explicit approval.

**Two operating modes**

* **Automatic** – every post that is published for the first time (optionally only selected categories) is handed over to Robbie.
* **Manual** – you decide per post with the button "Jetzt auch auf Social Media" (also on draft posts: marked and handed over on publish).

**What the plugin does on your site**

* Adds a card to the post editor and a status column to the posts list (queued, waiting for WhatsApp approval, published, error).
* Keeps a small queue (WP-Cron, once a minute) so that only one draft at a time waits for your approval; posts over the API rate limit are retried with growing delays; edits, autosaves and re-publishing never create duplicate drafts.
* Stores your API key server-side only (option without autoload, or as a constant in `wp-config.php`); the key is never sent to the browser.

**External service – please read**

This plugin is a client for the external **DIMEDIAL Robbie Social API** (`https://dimedial.studio/api/integrations/social/…`). It only contacts the service after you have entered an API key from your DIMEDIAL customer account. When a post is handed over, the following data is transmitted to DIMEDIAL servers: the featured image file, the post title, the excerpt or the first 60 words of the content, the chosen format (feed/story), your site URL (as HTTP user agent) and an idempotency key derived from site URL and post ID. The connection check transmits only your API key. No data is sent for posts you do not hand over, and no tracking or analytics is included.

* Service provider: DIMEDIAL Studio, Herford (Germany) – https://dimedial.studio
* Terms of use: https://dimedial.studio/agb and https://dimedial.studio/social/bedingungen
* Privacy policy: https://dimedial.studio/datenschutz
* Service documentation and setup guide: https://dimedial.studio/social/wordpress

**Account and pricing (service, not plugin)**

The plugin itself is free and fully functional; all of its code is included here. The service requires a DIMEDIAL customer account with a verified WhatsApp number and a connected social channel. New accounts can test the service for **30 days free of charge, without payment details and without automatic renewal**. After the test, the DIMEDIAL social media plans apply (each handed-over post counts like an instant post against the monthly quota). An individual master layout is an optional, separately billed design service. Nothing is limited or unlocked inside the plugin itself.

**Deutsch (Kurzfassung)**

Dein WordPress-Beitrag. Jetzt auch auf Social Media. Das Plugin übergibt Beitragsbild und Text an den externen Dienst DIMEDIAL Robbie; Robbie gestaltet den Social-Beitrag und schickt dir die Vorschau per WhatsApp. Veröffentlicht wird nur nach deiner Freigabe. Plugin kostenlos; Dienst über dein DIMEDIAL-Konto (30 Tage kostenlos testen, ohne Zahlungsdaten, keine automatische Verlängerung). Ausführliche deutsche Anleitung: https://dimedial.studio/social/wordpress

== Installation ==

1. Upload the ZIP under *Plugins → Add New → Upload Plugin* and activate it. The welcome page opens automatically.
2. In your DIMEDIAL customer area (https://dimedial.studio/kunden) open *Social Media → Schnittstelle · API · WordPress* and create an API key.
3. Enter the key under *Settings → DIMEDIAL Robbie* – or define it in `wp-config.php`: `define('DIMEDIAL_ROBBIE_KEY', 'dsk_…');`
4. Choose the operating mode (automatic or manual) and publish a post with a featured image. The preview arrives on WhatsApp.

== Frequently Asked Questions ==

= Is anything published automatically? =

No. The plugin only hands over image and text. Robbie prepares a draft and sends you a WhatsApp preview. Only your explicit approval on WhatsApp publishes the post.

= Do I need an account? =

Yes. The service runs on your DIMEDIAL customer account (free 30-day test, no payment details, no automatic renewal). Without an API key the plugin does not contact any external server.

= What data is sent to DIMEDIAL? =

Only for posts you hand over: the featured image, the post title, the excerpt (or the first 60 words of the content), the format, your site URL and an idempotency key. See the "External service" section above and https://dimedial.studio/datenschutz.

= What does the post need? =

A featured image (JPEG, PNG or WebP, up to 10 MB). Without an image there is no social post – the plugin tells you directly in the editor.

= What happens if I edit the post afterwards? =

Nothing twice. Autosaves, corrections or re-publishing never create a second draft. If an approval is still pending, the plugin waits for it (every 10 minutes, up to 6 hours). On rate limits or server errors it retries with growing delays (up to 8 attempts) and shows the state per post.

= Where is my API key stored? =

Server-side only – in a WordPress option without autoload or as a constant in `wp-config.php`. It is never delivered to the browser and can be revoked at any time in your customer area.

= Is the master layout included? =

No. The master layout is an optional, separately billed design service of DIMEDIAL. Without it Robbie uses your original image with a written caption.

== Screenshots ==

1. Welcome page with the three setup steps.
2. Settings: connection check, API key, operating mode.
3. Editor card "Robbie · Social Media" with the state of the post.
4. Status column in the posts list.

== Changelog ==

= 1.0.2 =
* Editor card: actions ("Jetzt auch auf Social Media", pre-mark/unmark) now run via a nonce-protected admin-ajax request instead of a form inside the post form (nested forms are invalid HTML and could submit the wrong form). Verified by real clicks in the Classic Editor and in the Block Editor (draft pre-mark, unmark, published post).
* Honest wording: without a master layout Robbie uses the original image with a written caption; the master layout is an optional, separately billed service. Hand-over timing is described as depending on WP-Cron (no fixed "one minute" promise).

= 1.0.1 =
* 409 ("approval pending") now waits for the existing approval every 10 minutes (up to 6 hours) without consuming the error limit.
* The recurring queue event heals itself if it gets lost.
* Function, class, hook and transient names fully prefixed; output escaping, input sanitizing and nonce handling aligned with Plugin Check; uninstall.php added.
* Verified with controlled API responses (409/429/500/401, autosave, both modes, queue): 53 checks passed on WordPress 6.0 + PHP 8.0.30, WordPress 7.1.2 + PHP 8.0.30 and WordPress 7.1.2 + PHP 8.2.33.
* LICENSE.txt (GPLv2) and assets/ASSETS-LICENSE.txt (origin and release of the bundled Robbie artwork) added.

= 1.0.0 =
* First release.

== Upgrade Notice ==

= 1.0.2 =
Editor button works reliably in Classic and Block Editor (no nested form); clearer wording about master layout and timing.

= 1.0.1 =
Safer waiting on pending approvals, self-healing queue, full prefixing and cleanup on uninstall.
