=== Form Inquiries for bexio ===
Contributors: strainovicit
Tags: bexio, contact form 7, crm, switzerland, leads
Requires at least: 6.4
Tested up to: 7.1
Requires PHP: 8.1
Stable tag: 0.4.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Creates a bexio contact from every Contact Form 7 inquiry and saves the message as a note, so nobody has to retype inquiries.

== Description ==

Swiss small businesses using bexio receive inquiries through their website and retype them into bexio. This plugin removes that step:

* After a Contact Form 7 form is sent, the sender is looked up in bexio by email address
* Unknown senders become a new contact: a company contact when a company name was entered, otherwise a person
* The inquiry (subject, message, phone, address) is saved as a note on the contact; existing contacts get a new note, no duplicates
* A log in the WordPress admin shows the last 50 transfers with the result or the error message
* If bexio is unreachable, the form still works normally; the error is only logged
* Connect with one click ("Connect to bexio"), no app of your own in the bexio Developer Portal
* 30-day free trial per bexio company from the first connection; afterwards CHF 19 per month, billed annually. If the trial or subscription has expired, inquiries are kept and transferred after renewal

**Together with Strainovic UID Check Schweiz** (free, wordpress.org): add a text field named `uid` to the form, for example `[text* uid placeholder "CHE-123.456.789"]`. The UID check rejects unknown and deleted companies before the form is sent. For a new contact, company name and address come from the federal UID register when the form leaves them empty (entries in the form take precedence), and the UID is saved in the remarks (the bexio API has no UID field). The note on the contact contains the check result: UID, status, company name, legal form, address and VAT registration from the register, with the time of the check. Existing contacts are not changed. Without the UID check the plugin works as before.

Recognized field names: `your-name` (or `first-name` / `last-name`), `your-email`, `your-subject`, `your-message`, and optionally `company` / `firma`, `phone` / `telefon`, `address` / `strasse`, `zip` / `plz`, `city` / `ort`.

The plugin is available in English, German (Germany and Switzerland), French and Italian. The site language decides: German variants such as de_CH_informal or de_AT, French variants such as fr_BE or fr_CA and Italian variants use the matching translation, all other languages show English. Notes created in bexio use the site language as well.

This plugin is not affiliated with or endorsed by bexio AG. bexio is a trademark of bexio AG.

**On request:** WPForms, Gravity Forms and Elementor Forms, free field mapping, create a quote or order from form fields, assign contacts to a bexio user, follow-up tasks. More at https://www.strainovic-it.ch/bexio-formular-connector/

== External services ==

This plugin connects to bexio, the Swiss business software by bexio AG, on behalf of the site owner. The login runs through strainovic-connect, a service by Strainovic IT that holds the bexio app and the subscription status.

* strainovic-connect: https://connect.strainovic-it.ch. When the administrator clicks "Connect to bexio" the first time, the plugin registers the site (sent: site URL, administrator email, site language, product name) and receives a site ID and secret. Afterwards it is used to complete the login, to renew the bexio access token (sent: site ID, refresh token, signed timestamp) and once a day to read the trial or subscription status (sent: site ID, signed timestamp). Form contents are never sent to this service. Terms and privacy: https://www.strainovic-it.ch/datenschutz/
* bexio login: https://auth.bexio.com (OAuth 2.0 / OpenID Connect), opened in the browser through strainovic-connect when the administrator clicks "Connect to bexio".
* bexio API: https://api.bexio.com, each time a Contact Form 7 form was sent successfully. Sent: the name, company, email address, phone number, address, subject and message entered in the form, to look up or create the contact and to create the note; with Strainovic UID Check Schweiz also the UID and its check result from the UID register.
* bexio terms of service: https://www.bexio.com/de-CH/agb
* bexio privacy policy: https://www.bexio.com/de-CH/datenschutz

Site owners must mention the transfer to bexio in their own privacy policy. While the trial or subscription has expired or the site is not connected, inquiries wait in the WordPress database (at most 200) until they are transferred.

== Installation ==

1. Upload the ZIP under Plugins → Add New → Upload Plugin and activate it; Contact Form 7 must be installed and active.
2. Under Settings → Form Inquiries for bexio, click "Connect to bexio" and log in to bexio. The 30-day trial starts with the first connection.

== Frequently Asked Questions ==

= Do I need a bexio app of my own? =

No. The login runs through strainovic-connect; the plugin stores only a site ID and the bexio tokens. Form contents go directly from your website to your bexio account.

= What happens when the trial ends? =

The form keeps working and still sends its email. Inquiries are no longer transferred to bexio but kept; a notice in the WordPress admin links to "Request an invoice". After payment the waiting inquiries are transferred automatically.

= What happens with existing contacts? =

The plugin looks them up by email address. An existing contact is not changed; it only gets a new note with the inquiry.

= Which languages are supported? =

English, German (de_DE and de_CH), French and Italian. The admin screen, the log and the notes in bexio follow the language of the WordPress site.

== Changelog ==

= 0.4.0 =
* Together with Strainovic UID Check Schweiz 0.3.0 or later: the checked UID and the company data from the UID register go into the bexio contact and note, with the time of the check.

= 0.3.0 =
* Connection through strainovic-connect with "Connect to bexio"; the own bexio app (client ID and secret) is no longer needed.
* 30-day trial per bexio company; when it has expired, inquiries wait and are transferred after renewal.

= 0.2.0 =
* Translations: English source texts, German (Germany and Switzerland), French and Italian included; language variants such as de_CH_informal or fr_BE use the matching translation.

= 0.1.0 =
* First release: Contact Form 7 to bexio contact and note.
