=== Connect Elementor Forms to RD Station ===
Contributors: wpintegrations
Tags: rd station, elementor, crm, leads, forms
Requires at least: 6.2
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 0.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Send Elementor form submissions to RD Station Marketing as conversion events, or straight into RD Station CRM as contacts.

== Description ==

**Connect Elementor Forms to RD Station** sends every Elementor Pro form submission to RD Station — automatically, and with the lead source attribution intact.

Each integration picks its destination:

* **RD Station Marketing** — the submission arrives as a conversion event, with LGPD consent and attribution cookies.
* **RD Station CRM** — the submission adds, or updates, a contact.

= Why this plugin =

* **Attribution preserved** — the visitor's RD Station tracking cookies (`_rdtrk`, `__trf.src`) are forwarded with each conversion, so your funnel and traffic source reports stay accurate, exactly like a native RD Station form.
* **Field mapping UI** — map your Elementor form fields to RD Station fields in a modern admin interface, custom fields from your own account included. Field names are suggested automatically after the first submission.
* **Never blocks your form** — delivery happens after the visitor already has their confirmation, so a slow RD Station never slows your form down.
* **No duplicates** — CRM contacts are matched on email, so a returning visitor updates the record they already have instead of creating another one. Map your form's email field to get this.
* **LGPD ready** — map your form's consent checkbox and the plugin sends the corresponding legal basis with each conversion.
* **Full delivery log** — see every request, response and failure. Nothing is silent.
* **Secure by design** — your OAuth tokens are stored encrypted, every admin endpoint requires administrator capability, and nothing is ever sent anywhere except RD Station's API.

= What this free version includes =

* One integration, sending to either RD Station Marketing or RD Station CRM
* Up to two mapped fields per integration
* Your account's real custom fields offered in the mapping screen, with field names suggested after the first submission
* LGPD consent mapping and RD Station attribution cookies forwarded with every conversion
* Email matching, so a returning visitor updates their CRM contact instead of duplicating it
* A delivery log with the full request and response for every send

= What the Pro version adds =

* Unlimited integrations, and unlimited mapped fields per integration
* Conversion identifiers, tags, funnel stage, lead owner and opportunity flag
* CRM companies and deals, alongside contacts
* A delivery queue that retries failed sends automatically

= Requirements =

* Elementor Pro (for the Forms widget)
* An app registered in the RD Station App Store, with the permissions for the product you are connecting (the free CRM plan works)

== External services ==

This plugin connects to the **RD Station APIs** (operated by RD Station, https://www.rdstation.com/). Nothing is sent until you create an integration, and then only when a mapped Elementor form is submitted.

**RD Station Marketing** — delivers your submissions as conversion events.

* **What is sent:** the form fields you explicitly map (such as name, email, phone), the conversion identifier, the page URL, and — if present — the visitor's RD Station tracking cookie values (`_rdtrk`, `__trf.src`) for lead attribution.
* **What is read:** your account's contact fields, so the mapping screen can offer your real custom fields instead of asking you to type identifiers.
* **Where:** `https://api.rd.services/platform/events` and `https://api.rd.services/platform/contacts/fields`, authenticated with the OAuth token from your own RD Station app.

**RD Station CRM** — writes your submissions in as contacts.

* **What is sent:** the form fields you explicitly map, such as name, email, phone and job title.
* **What is read:** your account's contact custom fields, including which of them are mandatory, so the mapping screen can offer your real values. The sales funnels list is read once when you test the connection.
* **Where:** `https://api.rd.services/crm/v2/` (the `contacts`, `custom_fields` and `pipelines` resources), authenticated with the OAuth token from your own RD Station app.

**RD Station authentication** — used only while connecting an account: `https://api.rd.services/auth/dialog`, `https://api.rd.services/auth/token`, `https://accounts.rdstation.com/oauth/authorize` and `https://api.rd.services/oauth2/token`.

No data is sent to WPIntegrations or any other third party. RD Station terms of service: https://legal.rdstation.com/ — privacy policy: https://legal.rdstation.com/privacy-policy/

== Installation ==

1. Install and activate the plugin.
2. Create an app in the RD Station App Store with the permissions for the product you want, register the callback URL shown on the plugin's Settings tab, then paste the app's Client ID and Client Secret there and connect.
3. Open the **Integrations** tab and create an integration: choose the destination, pick your Elementor form, then map the fields and save.

== Frequently Asked Questions ==

= Does it work with the free version of Elementor? =

The Forms widget is an Elementor Pro feature, so Elementor Pro is required.

= Which RD Station plans are supported? =

For Marketing, any plan with API access. For CRM, any plan including the free one — you only need to register your own app in the App Store and give it the CRM permissions.

= Do I need RD Station Marketing to use the CRM integration? =

No. The two are separate products with separate credentials, and a CRM integration talks only to the CRM.

= Will a returning visitor create a duplicate contact? =

No, as long as your form collects an email — that is what the CRM contact is matched on.

= Which fields do I have to map? =

The same ones RD Station itself marks as required on its own forms: an **email** for a Marketing conversion, and a **name** for a CRM contact. Any custom field your account marks mandatory is added to that list automatically. Everything else is optional.

= What happens if RD Station is temporarily unavailable? =

The submission is not delivered, and the failure is recorded in the Logs tab with the full response. This version does not retry; the Pro version queues each submission and retries automatically with increasing delays.

= Where do I see errors? =

The **Logs** tab shows every delivery with the full request and response.

== Changelog ==

= 0.1.0 =
* Initial release: Elementor Forms → RD Station Marketing conversion events and RD Station CRM contacts, field mapping with your account's custom fields, LGPD consent mapping, attribution cookies, delivery log, and encrypted credential storage.
