ES EN
Home Guides Webhooks

How to connect a quiz to webhooks

If you use your own CRM, your own app, or a service we don't have an integration for yet, use a webhook: LeadForms sends the data of every new lead to the URL you specify.
Setup
In your dashboard, open the quiz → “Settings” → “Integrations” → the Webhooks card. Enter the URL that will receive the POST request.
For testing, you can use webhook.site.
Important: your receiver must respond with a success HTTP status (200, 204 and so on).
Request format
Method: POST
Header: Content-Type: application/json
Body: JSON
Existing fields stay as they are. New fields appear only when the lead has them, so integrations built for the earlier format keep working.
Full payload example
{
  "id": 12345,
  "quizId": 611,
  "answers": [
    {"q": "Question 1", "questionId": 10, "a": ["Option 2"]},
    {"q": "Question 2", "questionId": 11, "a": ["Option 3"]}
  ],
  "contacts": {
    "name": "John",
    "phone": "15551234567",
    "email": "example@gmail.com",
    "address": "Austin, 1 Example St",
    "text": "I would like a consultation",
    "messenger": {"type": "telegram", "value": "@username"},
    "messengerName": "John"
  },
  "created": "17.08.2019 22:41",
  "quizDurationSeconds": 95,
  "result": {
    "value": "15%",
    "title": "Your discount",
    "description": "Complete your request"
  },
  "extra": {
    "href": "https://example.com/page",
    "ref": "https://google.com",
    "utm": {"utm_source": "google"},
    "cookies": {
      "_ga": "GA1.2.477745229.1562102022",
      "_fbp": "fb.1.1562107156134.812542"
    }
  }
}
Top-level fields
FieldTypeDescription
answersarrayAnswers to the quiz questions
contactsobjectContact details
createdstringLead date in dd.mm.yyyy hh:mm format
extraobjectUTM tags, cookies, page URL, referrer and discount
resultobject | nullQuiz result (discount and similar)
idnumberLead ID in LeadForms new
quizIdnumberQuiz ID new
quizDurationSecondsnumberTime taken to complete the quiz, in seconds new
answers[] fields
FieldDescription
qQuestion text
questionIdQuestion ID
aArray of answers (strings)
contacts fields
FieldDescription
nameName
phonePhone
emailEmail
addressAddress new
textComment or free text new
messengerMessenger: {"type": "telegram", "value": "@username"} new
messengerNameName when the contact comes through a messenger new
messenger.type values: telegram, whatsapp, viber, vk, messenger, instagram, teams, max, wechat, phone.
result fields
FieldDescription
valueValue (for example, the discount amount)
titleTitle
descriptionDescription
extra fields
FieldDescription
hrefURL of the page the lead was sent from
refReferrer
utmUTM tags (object)
cookiesCookies (object)
discountDiscount, if the quiz has one set up
Two-step contact form
If the quiz has a two-step contact form:
• The webhook fires when the lead is complete, with all steps collected.
• If someone fills in only the first step and doesn't come back, the lead may be sent about 60 seconds later with partial data.
Sample receiver in PHP
<?php
$data = json_decode(file_get_contents('php://input'), true);

$answers = $data['answers'] ?? [];
$contacts = $data['contacts'] ?? [];

$phone = $contacts['phone'] ?? null;
$email = $contacts['email'] ?? null;
$name = $contacts['name'] ?? ($contacts['messengerName'] ?? null);
$messenger = $contacts['messenger'] ?? null; // ['type' => 'telegram', 'value' => '@username']
$address = $contacts['address'] ?? null;
$comment = $contacts['text'] ?? null;

$createdDate = strtotime($data['created'] ?? 'now');
$utm = $data['extra']['utm'] ?? [];
$result = $data['result'] ?? null;
$quizDurationSeconds = $data['quizDurationSeconds'] ?? null;
$leadId = $data['id'] ?? null;
$quizId = $data['quizId'] ?? null;

// Your processing logic...

http_response_code(200);
exit;
Backward compatibility
Integrations that only read answers, contacts.name/phone/email, created and extra keep working. Use the new fields (address, text, messenger, quizDurationSeconds, id, quizId, result) when you need them.

Still have questions? Write to us

Name *
* Required field
Email *
* Required field
Message
Write to us!
We reply within 30 seconds