
Documentation
Incoming webhooks
Send leads from your form, website or any other system straight into Kaptia's pipeline with a POST. Everything is here: creating the address, accepted fields, responses, code examples and step-by-step guides for Zapier, Make, WordPress and Google Forms.
- Each address is a secret URL: the form or system sends a POST with the lead and it lands in the pipeline right away.
- A phone or an email is enough. The rest (company, city, source, your own fields) goes on the card, and a repeated lead is not duplicated.
- Works with any form that sends a webhook, with Zapier, with Make, with WordPress and with Google Forms.
Overview
Incoming webhooks bring into Kaptia's pipeline the leads that arrive somewhere else: your website form, a landing page, a spreadsheet or any system that can make an HTTP request. Each address is a secret URL. When it receives a POST with the lead's data, Kaptia creates the card (or finds the existing one) right away, wherever you chose.
When to use it
- Your website's contact or quote form, on WordPress with Elementor, your own HTML or any builder that sends a webhook.
- Automation tools like Zapier and Make, which connect Kaptia to Typeform, Tally, Google Sheets and many other apps.
- Your own system: a sign-up, a checkout or an old CRM sending each new lead to Kaptia.
How it works
- You create an address in Kaptia and choose where the lead goes: stage, flow, tag and niche.
- You paste the URL into the form or the tool.
- Each submission sends the name, phone or email and whatever else the form has.
- The lead shows up in the pipeline right away, with a note saying where it came from, and enters the flow if you chose one.
A lead that arrives by webhook came to you: it doesn't enter automatic prospecting (the queue that reaches out to cold leads on its own). The flow you choose talks to them, or your team does.
Also need to read and change leads, move stages or get notified when something changes in Kaptia? That is the API with a key and the outgoing webhooks.
Create the address in Kaptia
Addresses are created by the account owner or a manager. Each account has up to 20: use one per form or system, so each has its own destination and its own log of what arrived.
- Sign in to Kaptia and open the More menu, then Integrations and Webhooks.
- Click New address and give it a name you'll recognize later, like "Website form".
- Choose the destination, all optional: the stage where the card is created (New by default), the flow the lead enters, the tag and the niche.
- If you like, set the rest in the same window: the field mapping, who gets the lead, the instant alert and the signature.
- Create it and copy the URL. It's already receiving.
- Click Send test lead on the address card. Kaptia simulates a sample lead with the field names you mapped and shows the card that would be created: name, masked contact, stage, owner, custom fields and note. Nothing is saved, no message goes out, nothing enters a flow or counts in the numbers. To test the real path, send with the cURL from the examples and check the card in the pipeline and the Received list.
After it's created
- Received: the latest submissions, accepted or rejected, with the reason. For 24 hours it also shows the values that came in, with phone and email masked (
+1 4••••-0100,a••@example.com), so you can get the mapping right. After that only the field names remain. The full lead stays on the card. - Turn off: the address answers
404and nothing gets in. Turn it back on whenever you like. - Generate new link: picks a new URL, and the old one stops working at once. Do this if the address leaked.
- Delete: the address is gone along with its log. Leads that already arrived stay in the pipeline.
Send a lead
One request per lead, with no login and no separate key: the secret is in the URL itself. If you want an extra proof, the address can require a signature.
https://usekaptia.com/api/webhooks/entrada/YOUR_TOKENMethod and URL
Use POST on the full URL Kaptia showed you, always with https. YOUR_TOKEN is the last part, a string of letters, numbers, - and _ that identifies the address.
Headers
| Header | Value | When |
|---|---|---|
Content-Type | application/json | JSON body. |
Content-Type | application/x-www-form-urlencoded | Form body: what Elementor, Zapier in form mode and a plain <form> send. |
X-Kaptia-Assinatura | sha256=<hex> | Only with the signature turned on: the HMAC-SHA256 of the body, keyed with the address secret. |
Authorization | Bearer <secret> | Only with the signature turned on, instead of X-Kaptia-Assinatura: for tools that can't compute an HMAC. |
With the signature off (the default), only Content-Type matters and an Authorization header is ignored.
JSON body
An object with the lead's fields (see Accepted fields). Values are text or numbers. An empty field (null, "" or only spaces) counts as missing: send it empty or leave it out. A known field holding a list, an object, true or false rejects the whole request with 422 dados_invalidos.
{
"name": "Alex Morgan",
"company": "Example Studio",
"phone": "+1 415 555 0100",
"email": "alex@example.com",
"message": "Please send me a quote for 50 pieces.",
"utm_source": "google"
}Form body
The same names in the name=value&name=value format, in UTF-8. Every value arrives as text, and for a repeated field the last one wins.
name=Alex+Morgan&company=Example+Studio&phone=%2B1+415+555+0100&email=alex%40example.com&message=Please+send+me+a+quote+for+50+pieces.&utm_source=googlemultipart/form-data isn't read: the body arrives empty and the request returns 422 sem_telefone_nem_email. Other types, like XML, return 415.
Limits
| Limit | Value |
|---|---|
| Body size | 16 KB per request. Above that, 413. |
| Requests | 30 per minute for each address, from the same IP. Above that, 429. |
| Addresses per account | 20. |
| Extra fields kept | Up to 20 per lead, with names up to 40 characters and values up to 300. |
| Fields in the mapping | 30 per address. |
| WhatsApp alerts | 12 messages per account in 24 h. |
| Long text | Cut to each field's size, without rejecting the request. |
Accepted fields
Kaptia reads the most common field names in English, Spanish and Portuguese. Case, accents and hyphens don't matter: Name, E-mail and Phone work as name, email and phone. At least one contact is required: phone or email.
| Data | Accepted names | Rule |
|---|---|---|
| Person's name | nome, name, nombre | Up to 160 characters. |
| Company | empresa, company | Up to 160. With a company, the card takes its name. |
| Phone | telefone, whatsapp, celular, phone, telefono | 8 to 15 digits. Spaces, dashes, parentheses and + are ignored. |
email, correo | Only counts if it looks like an email. Stored in lowercase. | |
| Message | mensagem, message, mensaje, observacao, notes | Up to 2,000 characters. Goes to the card's note. |
| City | cidade, city, ciudad | Up to 120. |
instagram | The username, with or without @. A link doesn't count. | |
| Website | site, website | Goes to the note as "site: ...". |
| Niche | nicho | The key or name of a niche in your account. No match means Other. |
| Source | origem, source | Up to 80. Shown in the timeline. |
| UTM | utm_source, utm_medium, utm_campaign | Become the source when none is sent. |
When several names exist for the same data, the first one in the list that has a value wins (telefone before phone, nome before name): an empty telefone doesn't hide the phone sent with it. Even so, send each piece of data in a single field. Does your form use other names? Link each one to a piece of data in the field mapping.
Phone
Send it with the country code: +1 415 555 0100, +55 11 91234-5678. The same Brazilian number with or without the ninth digit is the same lead.
Without the code, Kaptia reads the number in this order (a leading long distance 0, as in 031 3333-4444, is ignored):
- With
+or00in front, it's international and is kept as sent. - It has the shape of a national number in the account's country: it gets the account's country code. In the United States and Canada, 10 digits (
415 555 0100). In Brazil, an area code that exists and 10 or 11 digits (with 11, the mobile 9 in third position). In Chile, 9 digits: mobiles start with 9 and landlines with the area code (2 2345 6789). The other countries on the list follow their own numbering. - It already starts with the account's country code and the rest is a national number (
5531987654321, without the+): kept as sent. - It looks like a number from another country: kept as sent.
- Otherwise, it gets the account's country code.
| Account | Sent | Stored |
|---|---|---|
| United States | 415 555 0100 | +1 415 555 0100 |
| Brazil | 31 98765-4321 | +55 31 98765-4321 |
| Brazil | 031 3333-4444 | +55 31 3333-4444 |
| Brazil | 5531987654321 | +55 31 98765-4321 |
| Brazil | 56 9 1234 5678 | +56 9 1234 5678 (56 isn't a Brazilian area code: it's Chile) |
| Chile | 9 1234 5678 | +56 9 1234 5678 |
The code is only added for accounts in these countries: Brazil, Chile, Argentina, Uruguay, Paraguay, Colombia, Peru, Mexico, Portugal, Spain, the United States, Canada, Bolivia, Ecuador and Venezuela.
A number from another country (a Brazilian client in a US account) always goes with + and its country code: without them, a foreign number shaped like a national number of your account gets your account's code. Without the +, a national number of your account ((415) 555-0100 in a US account) already gets the account's code in Kaptia: the HTML form and Google Forms examples send the number as the visitor typed it.
Counts in the name@domain.com format. Anything else is ignored and, without a phone, the request returns 422 sem_telefone_nem_email.
Company and person
B2B forms usually send both. With company, the card takes the company name and the person's name becomes the greeting in messages (the flow's {nome}: "Hi, Alex Morgan!"). Without a company, the card takes the person's name. Without either, the phone or the email.
Extra fields
Any other field (quantity, deadline, occasion, utm_content...) isn't lost: it becomes a "field: value" line in the card's note and in the timeline. Up to 20 are kept, with simple values (text, number, true or false) up to 300 and names up to 40 characters: letters, numbers, space and the punctuation of form labels (_ . , : ; ! ? ¿ ¡ ( ) / ' º ª ° -), so "What's your plan?" and "No. of employees" work. An empty field is left out, and lists and objects in an extra field are ignored. A field named after a custom field goes to it, not to the note.
{
"name": "Alex Morgan",
"phone": "+1 415 555 0100",
"quantity": 50,
"deadline": "12/15",
"occasion": "Year end"
}That request creates the card "Alex Morgan" with the note quantity: 50, deadline: 12/15 and occasion: Year end, one per line.
Source and UTM
source (or origem) says where the lead came from and shows in parentheses in the timeline note. Without it, Kaptia joins utm_source, utm_medium and utm_campaign with " / ": google / holiday. utm_content and utm_term go to the note as extra fields, and all five UTMs are kept with the lead, together with the address it came through.
Custom lead fields
Your account creates its own fields in Settings, Lead fields (text, number, yes/no or options), and each one has a key (team_size). A field that arrives with a name Kaptia doesn't know and that is the key of a custom field, or turns into that key once accents, capitals and spaces are dropped ("Team size"), fills the field on its own, in its type:
- Number: the first number in the text ("we are 12" becomes
12). - Yes/no: accepts
sim,não,si,yes,no,true,false,1and0. - Options: only one of the field's options, ignoring case and accents.
- Text: as sent, up to 300 characters.
A value that doesn't fit the type ("many" in a number field) isn't lost: it goes to the note as an extra field. On an existing lead, only empty custom fields get a value: what your team wrote stays. Does the form use another name? Link it in the field mapping.
Field mapping
A form with labels Kaptia doesn't know ("Your WhatsApp", "Full name") doesn't need to change. In the window where you create or edit the address, link each field name from the form to a destination: name, company, phone, email, message, city, Instagram, website, source or a custom field.
- It applies before the usual reading: the mapped value wins over a known field name sent with it.
- An empty mapped value doesn't erase the other one: with
Your WhatsAppempty andphonefilled in,phonecounts. - Case, accents and hyphens don't matter in the field name.
- Up to 30 fields per address.
- After the first request, the window lists the names that came in so you can map them with one click, with a destination already suggested from the name.
What happens to the lead
New lead
- The card is created in the stage chosen on the address (New by default), at the top of the column.
- It gets the niche chosen on the address or, without one, the one sent in the
nichofield. - It gets the address's tag.
- It goes to the owner the address picks, if it assigns to your team.
- It gets the custom fields sent in the request.
- With a flow chosen and turned on, the lead enters it right away, even if the flow's trigger is a different one. With the chosen flow turned off, the lead stays on the card only and does not enter it later, when you turn it on. Without a chosen flow, the new card fires the active flows with the New lead created trigger.
Existing lead
If the account already has a card with the same phone (with or without the Brazilian ninth digit) or the same email, no new card is created. The existing one doesn't change stage, niche or owner. It gets the address's tag, the timeline note, the email if it didn't have one, the custom fields that were empty (what your team wrote stays), and enters the chosen flow if it isn't in another. The response is the same 202: the sender never learns whether the lead already existed.
Assign to your team
In the address window, choose who gets the new card:
- Nobody (the default): the address doesn't pick an owner.
- One fixed person: every new card goes to them.
- Round robin among the people you pick (none picked = everyone active in the account): it's the turn of whoever has gone longest without a lead from that address.
Only new cards are assigned: an existing lead keeps its owner. The card's timeline records who got it.
Instant alert
- Notification on phone and computer (push) for the owner, the managers and whoever got the new lead (the fixed person or the rotation's turn). On by default. Several leads in a row become a single notification ("2 leads from the webhook ...").
- WhatsApp message on the account's connected WhatsApp, in the "message yourself" chat. Off by default. The first lead goes out right away and those arriving in the next 5 minutes go together in a single message. At most 12 messages per account in 24 hours: the last one says the next leads will only be in Kaptia.
Both are turned on and off per address, in the create or edit window.
Timeline
Every accepted request leaves a note on the card: which address it came through, the source and the message with the extra fields. On a new card, the message and the extras also go to the card's note.
Out of automatic prospecting
The card is created with the site source, and automatic prospecting (the queue that reaches out to cold leads on its own) skips it: the lead came to you. The chosen flow or your team talks to them.
A lead on the do not contact list stays out of every flow, however it arrives.
Responses and errors
Every response is JSON. Success: {"ok":true}. Failure: {"erro":"code"}.
| Status | Body | When it happens | What to do |
|---|---|---|---|
202 | {"ok":true} | Received. New or existing lead: the response doesn't say. | Nothing. |
400 | {"erro":"requisicao_invalida"} | Broken JSON, or the body isn't UTF-8. | Check the JSON and the encoding. |
401 | {"erro":"assinatura_invalida"} | The address requires a signature and the request came without it, or with a wrong one. | Check the secret and sign the exact body you send. Don't resend it unchanged. |
404 | {"erro":"nao_encontrado"} | Wrong URL, link regenerated, address turned off or deleted, or account suspended. | Copy the URL again from the Webhooks screen and check it's turned on. |
409 | {"erro":"sem_funil"} | The account has no pipeline stage at all. | Set up the pipeline in Kaptia and send again. |
413 | {"erro":"FST_ERR_CTP_BODY_TOO_LARGE"} | Body larger than 16 KB. | Send less text. Files aren't accepted. |
415 | {"erro":"FST_ERR_CTP_INVALID_MEDIA_TYPE"} | A Content-Type that is neither JSON nor form. | Use application/json or application/x-www-form-urlencoded. |
422 | {"erro":"sem_telefone_nem_email"} | No valid phone and no valid email. | Send at least one of them, with the names from Accepted fields. |
422 | {"erro":"dados_invalidos"} | A known field came as a list, object, true or false, or the body isn't an object. | Send text or a number, or send the field empty or drop it. |
429 | {"erro":"requisicao_invalida"} | More than 30 requests per minute from the same IP to the same address. | Wait the seconds in the Retry-After header and send again. |
5xx | {"erro":"erro_interno"} | Something failed on our side. | Retry later, with increasing waits. |
Retrying
You can resend the same lead safely: the same phone or email never becomes another card. Retry on 429, on 5xx and when the connection drops. On 400, 401, 404, 409, 413, 415 and 422, the same body will fail again: fix it first.
Requests rejected because the address is off, or with 401, 409 or 422, also show up in the address's Received list, with the reason. It's the first place to look when a form "isn't arriving".
Code examples
The same lead in each language. Replace the URL with your address and, on the server, keep it in an environment variable (KAPTIA_WEBHOOK_URL).
curl -X POST "https://usekaptia.com/api/webhooks/entrada/YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Alex Morgan",
"company": "Example Studio",
"phone": "+1 415 555 0100",
"email": "alex@example.com",
"message": "Please send me a quote for 50 pieces.",
"utm_source": "google"
}'curl -X POST "https://usekaptia.com/api/webhooks/entrada/YOUR_TOKEN" \
--data-urlencode "name=Alex Morgan" \
--data-urlencode "company=Example Studio" \
--data-urlencode "phone=+1 415 555 0100" \
--data-urlencode "email=alex@example.com" \
--data-urlencode "message=Please send me a quote for 50 pieces." \
--data-urlencode "utm_source=google"// On your server, never in the browser: the URL is the address secret.
const KAPTIA_URL = process.env.KAPTIA_WEBHOOK_URL; // https://usekaptia.com/api/webhooks/entrada/YOUR_TOKEN
async function sendLead(lead) {
const response = await fetch(KAPTIA_URL, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(lead),
signal: AbortSignal.timeout(10000),
});
if (response.status === 202) return; // received
const body = await response.json().catch(() => ({}));
// 4xx: fix the request. 429 and 5xx: wait and send again.
throw new Error("Kaptia " + response.status + ": " + (body.erro || ""));
}
await sendLead({
"name": "Alex Morgan",
"company": "Example Studio",
"phone": "+1 415 555 0100",
"email": "alex@example.com",
"message": "Please send me a quote for 50 pieces.",
"utm_source": "google"
});<?php
// On your server, never in the browser: the URL is the address secret.
$url = getenv('KAPTIA_WEBHOOK_URL'); // https://usekaptia.com/api/webhooks/entrada/YOUR_TOKEN
$lead = [
'name' => 'Alex Morgan',
'company' => 'Example Studio',
'phone' => '+1 415 555 0100',
'email' => 'alex@example.com',
'message' => 'Please send me a quote for 50 pieces.',
'utm_source' => 'google',
];
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode($lead),
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 10,
]);
$body = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($status !== 202) {
// 4xx: fix the request. 429 and 5xx: wait and send again.
error_log("Kaptia $status: $body");
}import json
import os
import urllib.error
import urllib.request
# On your server, never in the browser: the URL is the address secret.
URL = os.environ["KAPTIA_WEBHOOK_URL"] # https://usekaptia.com/api/webhooks/entrada/YOUR_TOKEN
lead = {
"name": "Alex Morgan",
"company": "Example Studio",
"phone": "+1 415 555 0100",
"email": "alex@example.com",
"message": "Please send me a quote for 50 pieces.",
"utm_source": "google"
}
request = urllib.request.Request(
URL,
data=json.dumps(lead).encode("utf-8"),
headers={"Content-Type": "application/json"},
method="POST",
)
try:
with urllib.request.urlopen(request, timeout=10) as response:
print(response.status) # 202: received
except urllib.error.HTTPError as error:
# 4xx: fix the request. 429 and 5xx: wait and send again.
print(error.code, error.read().decode())HTML form
For a website without its own server. Browsers block JSON sent from another site (CORS), so the form sends as a form. The script sends without leaving the page and shows the thank you message; the number goes as the visitor typed it (Kaptia adds the account's country code to a national number). Without JavaScript the form still works, and the visitor sees the {"ok":true} response.
<form id="kaptia-form" method="post"
action="https://usekaptia.com/api/webhooks/entrada/YOUR_TOKEN">
<input name="name" placeholder="Your name" required>
<input name="company" placeholder="Company">
<input name="phone" type="tel" placeholder="Phone" required>
<input name="email" type="email" placeholder="Email">
<textarea name="message" placeholder="How can we help?"></textarea>
<button type="submit">Send</button>
<p id="kaptia-ok" hidden>Got it! We'll be in touch soon.</p>
</form>
<script>
// Sends without leaving the page. Another site can't read Kaptia's response, hence "no-cors".
document.getElementById("kaptia-form").addEventListener("submit", async (event) => {
event.preventDefault();
const form = event.currentTarget;
const data = new URLSearchParams(new FormData(form));
await fetch(form.action, { method: "POST", mode: "no-cors", body: data });
form.reset();
document.getElementById("kaptia-ok").hidden = false;
});
</script>In HTML the URL sits in the page's code: any visitor can copy it and send fake leads. See Security.
Integrations
Zapier
- In the Zap's action, choose Webhooks by Zapier and the POST event.
- In URL, paste the Kaptia address.
- In Payload Type, keep form or choose json: both work.
- In Data, one row per field: Kaptia's name on the left (
name,phone,email...), the trigger's data on the right. - Set Wrap Request In Array to No: a list in the body returns
422 dados_invalidos. - If the address requires a signature, in Headers put
Authorizationon the left and, on the right,Bearerfollowed by the secret. - Test the action. The lead shows up in the pipeline and in the address's Received list.
Make
- Add the HTTP module with the Make a request action.
- In URL, the Kaptia address. In Method, POST.
- In Body type, choose application/x-www-form-urlencoded and add one field per piece of data (
name,phone,email...), mapped from the previous module. - Prefer JSON? Use Raw with JSON (application/json) and build the body with the Create JSON module: hand-typed text breaks when a lead types quotes.
- If the address requires a signature, in Headers add
Authorizationwith the valueBearerfollowed by the secret. - Run it once and check for the
202response.
WordPress with Elementor
- In the Elementor Pro form, open Actions After Submit and add Webhook.
- In the Webhook section, paste the Kaptia address into Webhook URL.
- Leave Advanced Data off. When on, fields are sent nested and Kaptia can't read them.
- Give the fields labels Kaptia knows: Name, Email, Phone or WhatsApp, Company and Message. Elementor sends the label as the field name. A different label ("Your WhatsApp")? Link it in the address's field mapping.
- Send a test from your own site and check Received.
Elementor also sends submission data, such as the date, time, page URL, browser and the visitor's IP. They come in as extra fields in the card's note. Other form plugins (Contact Form 7, WPForms) send webhooks through their own add-ons or through Zapier and Make: use the same field names.
Google Forms
- In the form, open the three-dot menu and Apps Script.
- Delete what's there, paste the code below, change the URL and the question titles in
FIELDS, and save. - In Triggers (the clock), Add trigger: function
onFormSubmit, source From form, type On form submit. Authorize with your Google account. - Answer the form once and check the pipeline.
// The form's Apps Script. Then: Triggers > Add trigger > onFormSubmit, "From form", "On form submit".
const KAPTIA_URL = "https://usekaptia.com/api/webhooks/entrada/YOUR_TOKEN";
// Each question title and the field name in Kaptia.
const FIELDS = {
"Name": "name",
"Company": "company",
"Phone": "phone",
"Email": "email",
"Message": "message",
};
function onFormSubmit(e) {
const lead = {};
e.response.getItemResponses().forEach((item) => {
const title = item.getItem().getTitle();
lead[FIELDS[title] || title] = String(item.getResponse());
});
// With "Collect email addresses" on, the respondent's email.
const email = e.response.getRespondentEmail();
if (email && !lead.email) lead.email = email;
const response = UrlFetchApp.fetch(KAPTIA_URL, {
method: "post",
contentType: "application/json",
payload: JSON.stringify(lead),
muteHttpExceptions: true,
});
if (response.getResponseCode() !== 202) {
console.log(response.getResponseCode(), response.getContentText());
}
}A question that isn't in FIELDS goes with its title as the name: if it's a known name ("City"), it counts; if it's the key of a custom field, it fills that field; if not, it becomes an extra field (or link it in the field mapping). On the Webhooks screen, the Google Forms tab in How to use gives you this code with the URL and mapped fields of your address already in (and the secret, if signing is on).
Typeform, Tally and others
Typeform, Tally and other tools have their own webhooks, but they send JSON in their own format, with answers inside lists and question ids. Kaptia doesn't read that format. Connect the tool to Zapier or Make and send to Kaptia with the field names from this page.
Security
- The URL is the password. Anyone with the address can send leads to your account. Don't put it in a repository, a screenshot or a group chat.
- Want an extra proof? Require a signature. With it on, the URL alone isn't enough: every request has to prove it knows the address secret. See Signature.
- In the browser it's visible. An HTML form that calls Kaptia directly leaves the URL in the page's code. It works, but any visitor can copy it. When you can, send from your server or through Zapier and Make.
- Leaked? Generate another. With Generate new link, the old URL stops working at once. Paste the new one into the form.
- Turn off what you don't use. A turned-off address answers
404and creates nothing. - One address per source. With one per form you can rotate or turn one off without touching the others, and the log shows where each request came from.
- The log keeps little, and not for long. In Received, the values that came in stay only 24 hours, with phone and email masked. After that, a cleanup deletes them from the database and only the field names remain. The full lead stays on the card, like any lead in the account.
The token has 256 bits and is picked by Kaptia. The database keeps only its hash (to find the address) and an encrypted copy (to show the URL again to whoever manages the account).
Signature (optional)
By default, the URL is the only credential. To require an extra proof, turn on Require signature in the address window: Kaptia generates a 256-bit secret and shows it to whoever manages the account, with a copy button. Generate another secret replaces it, and the old one stops working at once.
With the signature on, every POST must carry one of these two headers:
| Header | Value | For |
|---|---|---|
X-Kaptia-Assinatura | sha256=<hex> | Developers. The HMAC-SHA256 of the exact bytes of the body you send, keyed with the secret, in hexadecimal (lowercase or uppercase). |
Authorization | Bearer <secret> | Tools that can't compute an HMAC, like the header fields in Zapier and Make. |
Without the proof, or with a wrong one, the response is 401 with {"erro":"assinatura_invalida"}, and the request shows in Received as rejected, with the signature as the reason. The comparison runs in constant time. It applies to JSON and form bodies. With the signature off, an Authorization header is ignored, as always.
Sign the same string you put in the body. Building the JSON, signing it and building it again to send (another field order, other spacing, other escaping of accents) changes the bytes, and the signature won't match.
How to sign
# Build the body ONCE and sign exactly that string.
BODY='{"name":"Alex Morgan","phone":"+1 415 555 0100"}'
SIG=$(printf '%s' "$BODY" | openssl dgst -sha256 -hmac "$KAPTIA_WEBHOOK_SEGREDO" | sed 's/^.* //')
curl -X POST "$KAPTIA_WEBHOOK_URL" \
-H "Content-Type: application/json" \
-H "X-Kaptia-Assinatura: sha256=$SIG" \
-d "$BODY"// On your server: the secret lives in an environment variable, never in the browser.
import crypto from "node:crypto";
const KAPTIA_URL = process.env.KAPTIA_WEBHOOK_URL;
const SECRET = process.env.KAPTIA_WEBHOOK_SEGREDO;
// Build the body ONCE and sign exactly that string.
const body = JSON.stringify({ name: "Alex Morgan", phone: "+1 415 555 0100" });
const signature = crypto.createHmac("sha256", SECRET).update(body).digest("hex");
const response = await fetch(KAPTIA_URL, {
method: "POST",
headers: { "Content-Type": "application/json", "X-Kaptia-Assinatura": "sha256=" + signature },
body,
signal: AbortSignal.timeout(10000),
});
// 202: received. 401: check the secret and that the body you sent is the one you signed.
console.log(response.status);<?php
// On your server: the secret lives in an environment variable, never in the browser.
$url = getenv('KAPTIA_WEBHOOK_URL');
$secret = getenv('KAPTIA_WEBHOOK_SEGREDO');
// Build the body ONCE and sign exactly that string.
$body = json_encode(['name' => 'Alex Morgan', 'phone' => '+1 415 555 0100']);
$signature = hash_hmac('sha256', $body, $secret);
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ['Content-Type: application/json', 'X-Kaptia-Assinatura: sha256=' . $signature],
CURLOPT_POSTFIELDS => $body,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 10,
]);
curl_exec($ch);
// 202: received. 401: check the secret and that the body you sent is the one you signed.
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);import hashlib
import hmac
import json
import os
import urllib.request
# On your server: the secret lives in an environment variable, never in the browser.
URL = os.environ["KAPTIA_WEBHOOK_URL"]
SECRET = os.environ["KAPTIA_WEBHOOK_SEGREDO"]
# Build the body ONCE and sign exactly those bytes.
body = json.dumps({"name": "Alex Morgan", "phone": "+1 415 555 0100"}).encode("utf-8")
signature = hmac.new(SECRET.encode(), body, hashlib.sha256).hexdigest()
request = urllib.request.Request(
URL,
data=body,
headers={"Content-Type": "application/json", "X-Kaptia-Assinatura": "sha256=" + signature},
method="POST",
)
# 202: received. A 401 raises HTTPError: check the secret and the signed body.
with urllib.request.urlopen(request, timeout=10) as response:
print(response.status)Elementor and a plain HTML form don't sign, and in the browser the secret would be visible. With the signature on, send from your server, through Zapier or through Make.
FAQ
Do I need an API key or a login?
No. The address URL is the credential. If you want an extra proof, turn on Require signature in the address window: then every request must carry the X-Kaptia-Assinatura header (the HMAC of the body with the secret) or Authorization: Bearer with the secret.
Can I send several leads in one request?
No. It's one lead per request, and a list in the body returns 422 dados_invalidos. For many leads at once, use Kaptia's spreadsheet import.
Does the lead enter the flow right away?
Yes, if the address has a chosen flow that is turned on: the lead enters at that moment, even if the flow's trigger is a different one. With the flow off, the lead just stays on the card. Without a chosen flow, the new card fires the flows with the New lead trigger.
Why didn't the lead show up?
Open the address's Received list: for 24 hours it also shows the values that came in, masked. Rejected for "no phone or email": the field names don't match the table (map yours in the address's field mapping), or the phone has fewer than 8 digits. Rejected for the signature: the address requires a signature and the request came without it, or with a wrong one. Nothing in the log: the URL is wrong, the link was regenerated, or the request got 400, 413, 415 or 429 before reaching the address (check the HTTP response in your tool).
What if the same person fills in the form twice?
It's still one card. The second submission shows as "Already existed" in Received and adds another note to the lead's timeline.
Can each form go to a different stage or tag?
Yes: create one address per form, each with its own destination. You get up to 20 addresses per account.
Does a webhook lead get the automatic outreach?
No. Automatic prospecting is for cold leads, and someone who arrives by webhook came to you. They only get what the chosen flow sends, or what your team writes.
Does it work with numbers from other countries?
Yes. Send the number with + and its country code (+55 11..., +56 9...) and it's kept as sent. Without the +, a number shaped like a number from the account's country gets the account's country code.
My form uses other field names. Do I have to change the form?
No. In the address window, link each field name from the form to a piece of Kaptia data (the field mapping): "Your WhatsApp" becomes phone, "Full name" becomes name. After the first request, the window lists the names that came in so you can map them with one click.
Integrate with your AI
Asking an AI to build the integration? Copy one of the prompts and paste it into Claude, ChatGPT or Cursor. They all point to this page, which the AI can read in full: it comes ready from the server, with no JavaScript needed.
https://usekaptia.com/en/docs/webhooksI want to send the leads from my form to Kaptia (a CRM) through its incoming webhook.
Read the whole documentation first: https://usekaptia.com/en/docs/webhooks
What matters:
- POST to my address URL, which is the credential (no login, no key): https://usekaptia.com/api/webhooks/entrada/YOUR_TOKEN
- JSON body (Content-Type: application/json) or form body (application/x-www-form-urlencoded).
- Fields: name, company, phone (with the country code, e.g. +1 415 555 0100), email, message, city, utm_source, utm_medium, utm_campaign. Other fields become a note on the card.
- Phone or email is required. Values are text or numbers. An empty field can be sent empty or left out; lists and objects reject the request.
- Optional signature: if the address requires it, send X-Kaptia-Assinatura: sha256=<HMAC-SHA256 of the exact body bytes, keyed with the secret> or Authorization: Bearer <secret>.
- 202 = received. 401 = missing or wrong signature. 422 = missing contact or wrong format. 404 = wrong or turned-off URL. 429 = wait for Retry-After and resend.
- One lead per request. Resending the same lead doesn't duplicate it.
My form or tool is: [describe it here: Elementor, Google Forms, a Next.js site, Zapier...]
Give me the steps and the code, mapping my form's fields to the names above.You'll help me connect a form to Kaptia, a CRM, through its incoming webhook.
Source of truth (read it first, the whole page): https://usekaptia.com/en/docs/webhooks
Summary:
- POST method, to the address URL Kaptia gave me: https://usekaptia.com/api/webhooks/entrada/YOUR_TOKEN
- The URL is the secret: there's no API key or login.
- Optional signature: if the address requires it, every request carries X-Kaptia-Assinatura: sha256=<HMAC-SHA256 of the exact body bytes, keyed with the secret> or Authorization: Bearer <secret>.
- JSON or application/x-www-form-urlencoded body, up to 16 KB, one lead per request.
- Field names: name, company, phone, email, message, city, instagram, website, nicho, source, utm_source, utm_medium, utm_campaign. Phone or email is required. An empty field can be sent empty or left out.
- Phone always with the country code.
- Responses: 202 received; 401, 404, 409, 413, 415 and 422 are errors to fix; 429 and 5xx can be retried.
Start by asking me where the form lives and which fields it has. Then guide me step by step and tell me how to test it.Integrate Kaptia's incoming webhook into this project: every new lead from the form must be sent to the CRM.
Full documentation (read it before writing code): https://usekaptia.com/en/docs/webhooks
Rules:
- Call it from the SERVER (API route, server action or function), never from the browser: the URL is a secret.
- Read the URL from the KAPTIA_WEBHOOK_URL environment variable (format: https://usekaptia.com/api/webhooks/entrada/YOUR_TOKEN) and add it to .env.example without the value.
- POST with Content-Type: application/json and one object per lead: name, company, phone (with +country code), email, message and the UTMs when present. Empty fields can be left out; never send a list or an object in a field.
- If the KAPTIA_WEBHOOK_SEGREDO environment variable exists, the address requires a signature: build the body once (JSON.stringify), compute the HMAC-SHA256 of those exact bytes with the secret and send it in the X-Kaptia-Assinatura: sha256=<hex> header, without serializing again. Add it to .env.example without the value.
- 202 is success. 400, 401, 404, 409, 413, 415 and 422: log the error and don't retry. 429 and 5xx: up to 3 retries, honoring Retry-After.
- 10 s timeout. If Kaptia fails, the visitor's form must not fail with it: log and move on.
- Show me where the call lives and how to test it with a sample lead.Or use Copy page as Markdown, at the top, and paste the whole doc along with your prompt.
Write to us. The people who built the system answer.
contato@usekaptia.comQuestions from people who use Kaptia: WhatsApp, flows, prospecting, plan and account.
