lads_build_lead_gen_form
LinkedIn Ads skill high risk
Part of the Lead Gen Agent.
What it does
Skill-tool that drafts a complete LinkedIn Lead Gen Form in one pass: form name (<=256 chars), headline (<=60 chars), privacy-policy/details text (offer detail <=160 chars; privacy explanation <=2,000 chars), the ordered field selection (prefilled standard fields plus up to 3 custom questions, each custom-question field <=100 chars), optional disclosure/consent checkboxes (up to 5; these do NOT count toward the field max), the confirmation/thank-you message, and the post-submit CTA. Hard caps: 12 total form fields (the 3 custom questions count toward the 12; disclosure checkboxes do not). It gates on the lawful basis and the privacy policy (no lawful_basis -> lawful_basis_required, no privacy_policy_url -> privacy_policy_required) and on the caps (any overrun -> invalid_argument), refuses a field or custom question that asks for gender (data_minimization_violation: Scalix policy, although LinkedIn offers GENDER), reminds you to keep only fields the lawful basis justifies (it detects no other protected or sensitive field: drop them), and stamps the LinkedIn retention obligations on the output (LinkedIn stores leads up to 365 days; member-derived data used only for the authorizing client; no enrichment/cross-account pooling; downstream profile data purge <=24h, social <=48h per platform policy). It produces a form definition only; it does NOT create the form. Applying routes through the separate preview->approve->commit create path (LinkedIn create-paused/draft lifecycle), and the form is attached to Sponsored Content. Reporting note: track form fill rate, abandonment, and cost/submit, and keep content-form leads separate from demo-intent leads (never blend lead types). Output: {success:true, data:{name:{fill,max_chars}, headline:{fill,max_chars}, details:{fill,max_chars}, privacy_text:{fill,max_chars,privacy_policy_url}, fields:[{name,type,prefill,required}], custom_questions:[{q,chars}], checkboxes, confirmation, cta, lawful_basis, lead_type, field_count, limits, retention_note, apply_with:'lads_create_lead_form', next_step:'preview_create_lead_form'}, warnings}. NOTE: the FIELD STRUCTURE (fields, field_count, caps, retention) is emitted concretely; the copy (name/headline/details/privacy_text/confirmation/cta) comes back as fill-slots for you (the model) to write, then apply via lads_create_lead_form.
When to use it
Use this skill whenever the user wants to create or revise a Lead Gen Form, capture leads from Sponsored Content, or asks what fields/questions/thank-you copy to use — even without saying 'skill'. It enforces the field caps (12 total incl. up to 3 custom questions @ <=100 chars; up to 5 disclosure checkboxes outside the cap), the lawful-basis/data-minimization gate, and the privacy-policy requirement you'd otherwise miss. It outputs a form definition only; create it via the preview/commit path (POST /rest/leadForms).
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
ad_account_id | string | yes | Sponsored account numeric id -> urn:li:sponsoredAccount:{id}. Tenant/RLS context, server-derived isolation. |
offer | string | yes | The gated offer (guide, demo, webinar). Grounds headline/details/CTA. |
fields | array<string> | no | Requested standard prefill fields (e.g. firstName, lastName, emailAddress, company, jobTitle). Enum-normalized to LinkedIn PredefinedField ids (FIRST_NAME, LAST_NAME, EMAIL, WORK_EMAIL, PHONE_NUMBER, WORK_PHONE_NUMBER, CITY, STATE, COUNTRY, ZIP_CODE, COMPANY_NAME, COMPANY_SIZE, INDUSTRY, JOB_TITLE, JOB_FUNCTION, SENIORITY, DEGREE, FIELD_OF_STUDY, SCHOOL, START_DATE, GRADUATION_DATE, LINKEDIN_PROFILE_LINK); anything else becomes a CUSTOM question. LinkedIn also offers GENDER, but a field that asks for gender is refused (data_minimization_violation, Scalix policy); first/last/email are pre-selected; total form fields capped at 12 (custom questions included). |
custom_questions | array<object> | no | Up to 3 custom questions (multiple-choice or single-line text); each custom-question field <=100 chars. More than 3, or one over 100 chars, is rejected (invalid_argument); one that asks for gender is refused (data_minimization_violation, Scalix policy). Each counts toward the 12-field max. |
checkboxes | array<object> | no | Optional disclosure/consent checkboxes, up to 5. These are NOT included in the 12-field maximum. Use for explicit consent statements where required. |
lawful_basis | string | yes | Stated lawful basis/purpose for the data collected (consent, legitimate interest, contract). Required gate (missing -> lawful_basis_required); keep only the fields it justifies. |
privacy_policy_url | string | yes | Client privacy policy URL shown on the form. Required by LinkedIn on every form (missing -> privacy_policy_required); use an https URL. |
confirmation_message | string | no | Thank-you text after submit. Default a compliant message referencing the offer. |
cta | string | no | Post-submit CTA / landing URL intent. Must be truthful and destination-supportable. |
lead_type | string | no | content | demo intent label, used so downstream reporting keeps lead types separate (never blended). |
Safeguards
Policy
Collect only fields the client has a lawful basis to use (data minimization); never request protected/sensitive attributes or data outside the stated purpose. A valid privacy policy URL is required on every form. Lead/member data is for the authorizing client only — no CRM enrichment, profile append/verify, or cross-account prospecting databases (LinkedIn Marketing API Terms). Honor retention: LinkedIn stores leads up to 365 days (do a one-time pull at integration setup); downstream member-derived profile data purged <=24h, social <=48h. Keep content-form vs demo-intent leads separate; never blend lead types. For employment/housing/education/credit offers, enforce anti-discrimination (no protected-attribute fields/targeting).
Reminder
Lead data is sensitive PII for this client only — minimize fields, require a privacy policy, obtain consent, and never enrich or pool it across accounts.
Errors
| Error class | Means | What to do | Retry |
|---|---|---|---|
LAWFUL_BASIS_REQUIRED | No lawful basis/purpose stated for the requested data collection. | Provide lawful_basis (consent/legitimate interest/contract) before building the form. | no |
PRIVACY_POLICY_REQUIRED | privacy_policy_url is missing; LinkedIn requires it on every Lead Gen Form. | Supply a valid https privacy policy URL and retry. | no |
INVALID_ARGUMENT | Field/question caps exceeded: >12 total fields (custom questions included), >3 custom questions, a custom question over 100 characters, or >5 checkboxes. Headline, details and privacy text are fill-slots you write within their max_chars, and an unknown field id becomes a CUSTOM question, so neither is refused. | Trim to the limits named in the message, then call again; surface the exact constraint, do not guess. | no |
DATA_MINIMIZATION_VIOLATION | A field or custom question asks for gender, which Scalix policy keeps off every lead form (no other protected or sensitive field is detected). | Remove the field or question the message names, then call again; collect only data the lawful basis justifies. | no |
TOKEN_REVOKED | LinkedIn OAuth token revoked/expired beyond refresh. | Re-authorize the LinkedIn connection (needs_reauth). | no |
PERMISSION_DENIED | Token missing ads/lead-gen scope or out-of-bearer-scope account (403). | Re-authorize with the required scope or use an authorized account; do not retry as-is. | no |
RATE_LIMITED | LinkedIn HTTP 429 (app/member daily throttle) during validation. | Honor X-RateLimit headers / Retry-After; exponential backoff and retry; alert at 75% of daily quota. | yes |
PLATFORM_UNAVAILABLE | LinkedIn API 5xx / transient error. | Retry once after short backoff; if persistent, report and stop. | yes |
Edge cases
- More than 12 total fields requested (custom questions count toward the 12): reject with INVALID_ARGUMENT naming the count over the cap.
- 4th custom question requested: reject; only 3 custom questions allowed.
- Custom question >100 chars: rejected with INVALID_ARGUMENT naming it; trim it (per-field max is 100 chars, not 1000).
- Disclosure/consent checkboxes: up to 5 allowed and they do NOT count toward the 12-field max; >5 is rejected.
- Gender requested (the GENDER field, or a custom question with the word): refused with data_minimization_violation (Scalix policy). Other sensitive fields (e.g. national id, health) are not detected: drop them and explain (data minimization).
- lead_type not set: warn that downstream reporting cannot separate content vs demo leads (which must never be blended).
- Form not yet attached to Sponsored Content: success; it serves only once a lead-gen creative references it.
- Retention note always attached: leads stored <=365 days on LinkedIn (one-time pull at setup); member-derived data purged <=24h profile / <=48h social; client-only use.
- Lead retrieval is out of scope here — direct the user to lead_sync (validated webhooks only since 2026-03-16).
- Page/Showcase-Page lead forms are no longer creatable per LinkedIn docs; only Sponsored Content lead forms via POST /rest/leadForms are supported.
- Generation is a no-op against the account: success with field_count even though nothing is created; next_step points to preview.