Back to CRM

Integration guide

The form on your website reaches the CRM in a second

How to connect a contact form, Zapier or Make to FluxCRM: address, headers, fields, responses and a test.

A single POST request with the secret in a header creates an opportunity and records campaign attribution and GDPR consents.

How it works

A form on your website (or a Zapier or Make scenario) sends a POST /api/zgloszenie request with the contact details to the CRM. The CRM:

  1. checks the secret and the fields,
  2. creates an opportunity with the source Website, or adds a message to an existing one (the same person is recognised by email),
  3. records which campaign the customer came from (the utm_*, landing_page and referrer fields),
  4. records the GDPR consents given, together with proof,
  5. if a phone number was given and call alerts are on, rings an advisor in the Dzwonek app.

What you need

ItemWhere it comes from
Instance addressfor example https://crm.yourcompany.com
Webhook secretthe file named in [formularz] plik_sekretu; the administrator can renew it in Settings
Active source formularzturned on by the administrator (Settings, sources)

A note on the secret. The secret is a password for entering leads. Do not paste it into JavaScript that runs in visitors' browsers, because everyone could see it. Send the form from your site's own server (a Next.js route handler, a PHP script, a serverless function) or from a Zapier or Make scenario.

The request

POST https://crm.yourcompany.com/api/zgloszenie
Content-Type: application/json
x-fluxcrm-sekret: <secret>
{
  "email": "ewa.kowalska@example.com",
  "firma": "Ewa's Shop Ltd.",
  "telefon": "+48 600 100 200",
  "wiadomosc": "Hello, I would like a quote.",
  "landing_page": "https://yourcompany.com/contact",
  "utm_source": "google",
  "utm_medium": "cpc",
  "utm_campaign": "spring",
  "zgody": { "przetwarzanie": true, "marketing": false }
}

Fields

FieldRequiredMax. lengthNotes
emailyes254a valid address, the key used to recognise a person
firmano200company name
telefonno40with a number it triggers the call alert, if turned on
wiadomoscno5000the text of the enquiry
landing_page, referrerno500first-contact attribution
utm_source, utm_medium, utm_campaign, utm_term, utm_contentno200per-campaign report
zgodynoan object; only consents set to true are saved
polanocustom case fields, for example {"kwota_wnioskowana": 50000}; a bad value is skipped, the submission goes through

The whole request must not exceed 64 KB. Control characters are removed and the content is always treated as text (not as HTML).

GDPR consents with proof

The zgody object accepts the kinds przetwarzanie (processing), marketing and bik (credit bureau). Instead of true you can pass an object with the wording the customer accepted: {"bik": {"zgoda": true, "tresc": "I consent to a query to the credit bureau..."}}. The CRM saves the kind, the moment, the source (form), the wording and the page address as proof.

For a form that collects data, place an information clause next to the button. A ready template: information clause for forms.

Responses

CodeMeaningWhat to do
200{"ok": true, "lead_id": 123, "duplikat": false}; duplikat: true is a repeat submission by the same person within 10 minutesnothing
401missing or wrong secretcheck the x-fluxcrm-sekret header
403the formularz source is inactiveask the administrator to turn it on
415wrong Content-Typeset application/json
422invalid fields; the response lists them under polafix the fields indicated
429too many failed attempts from one addresswait (the Retry-After header)

Examples

curl

curl -sS -X POST https://crm.yourcompany.com/api/zgloszenie \
  -H 'Content-Type: application/json' \
  -H "x-fluxcrm-sekret: $SECRET" \
  -d '{"email":"test@example.com","wiadomosc":"Integration test"}'

Next.js (route handler, the secret stays on the server)

export async function POST(req: Request) {
  const dane = await req.json();
  const odp = await fetch(`${process.env.CRM_URL}/api/zgloszenie`, {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "x-fluxcrm-sekret": process.env.CRM_SEKRET!,
    },
    body: JSON.stringify({ email: dane.email, wiadomosc: dane.wiadomosc }),
  });
  return new Response(null, { status: odp.ok ? 204 : 502 });
}

Zapier and Make

Use the Webhooks, Custom request module (Zapier) or HTTP, Make a request (Make): method POST, the address above, the x-fluxcrm-sekret header and a JSON body with the form fields. Notifications in the other direction (from the CRM to Zapier) are described in a separate outgoing-webhooks guide in the repository (deploy/webhook.md).

Calling from a browser (CORS)

If, despite the warning, you must send the submission straight from a browser, the administrator enters your site's address in [formularz] dozwolone_originy. Without the entry the browser blocks the response.

Test

  1. Send a submission with curl.
  2. In the panel, a new opportunity with the source Website appears in the New column and in the Waiting for us bar.
  3. Open the card: the message, the campaign and the consents should be visible. A test opportunity can be marked as lost with the reason "test".

Portal listings

The same address accepts listings from portals other than Useme and Freelancehunt. Add "typ": "oferta_portalu" and the fields portal, numer, tytul, link, budzet, klient, opis. Submitting the same number again duplicates nothing.

Landing page and embedded form (marketing)

If you have no website with a form of your own, the CRM can host one. The administrator turns on [marketing] wlaczony = true and adres_publiczny, and in the Marketing window (the Landing pages tab) the owner adds a page: address, title, description, fields (phone, message, company), a default UTM campaign and, optionally, an instalment or creditworthiness calculator and a qualifying chatbot. The page lives under /m/lp/<address>; a submission follows the same path as the webhook (UTM attribution, GDPR consents, call alert, auto-reply), and the counter of views and submissions is visible on the landing page list.

The same form can be embedded on a customer's site: in the Marketing window you copy the code (a div tag with a data-fluxcrm-lp attribute and the embed.js script from the CRM address, with the data-slug and data-token attributes). The script does not contain the webhook secret. The token is the public key of the page, and the CRM accepts submissions only from the domains listed in the landing page's allowed embedding domains (CORS) and limits the number of submissions from one IP address. A site with its own CSP must allow the CRM address in script-src, style-src and connect-src (the Marketing window gives the exact directives). A suspicious token can be replaced with the Replace token button.

The instalment and creditworthiness calculator is a lead magnet: the customer sees the result at once, and after the form is sent it lands in the opportunity's messages. The chatbot asks the questions from [marketing] chatbot (or built-in ones), scores the answers by points or, when enabled, with a model, and creates an opportunity tagged chatbot-goracy (hot), chatbot-cieply (warm) or chatbot-zimny (cold).

In the opportunity card the Marketing section shows the source (UTM), the campaign cost and the lead cost, the customer's preferences (channel, hours, language), the "do not contact" exclusion, NPS surveys and a referral code with a reward. The Costs and ROI tab calculates the lead cost and ROI per campaign from manually entered costs. Campaigns and the newsletter go to the chosen segment through the CRM's mail queue: draft emails wait for the owner's approval and, once approved, are sent within the daily limit and during sending hours. Emails carry an unsubscribe link, and addresses without marketing consent, excluded ones or ones that bounced are skipped.