5. Get forms for the chosen Sponsored Account
GET {{baseUrl}}/leadForms?q=owner&owner=(sponsoredAccount:urn%3Ali%3AsponsoredAccount%3A{{sponsoredaccount_id}})&count=10&start=0
At this point, the user has picked the sponsored account they are trying to collect leads for and you have validated they have proper access to the ad account and associated company page. This step will retrieve the form(s) associated with the selected sponsored account.
6. Map Lead Gen Form fields to destination fields
Using the API response data from the previous step, your application should ask the user to map questions, consents, and hidden fields to the appropriate fields in the destination system (e.g. a CRM). All questions, consents, and hidden fields from the form should be mappable. predefinedField
fields may be mapped automatically for the user, but all others will require the user to map them manually. Optionally, allow the user to map the ad account id, ad account name, campaign id, campaign name, creative id, creative name, form id, and form name (this additional metadata can be pulled back via the leadFormResponses
endpoint in the next step). This additional metadata helps your customers with lead attribution.
Quick tip: When it comes to mapping the predefinedField
fields that are auto populated from the member’s profile, it's important to understand that the localized language of the form could be a language other than English. Due to this, you should use the predefinedField
field so the user doesn't have to map the same field in different form languages separately. For custom questions you will need to use the question
field as there is no predefinedField for custom questions.
Field | Language Information |
---|---|
name | This value will be translated to the localized language of the user who created the form (which could be different than the localized language of the form) |
predefinedField | ENUM for the pre-populated field |
question | This value will be translated to the localized form language |
Request Params
Key | Datatype | Required | Description |
---|---|---|---|
q | string | ||
owner | string | ||
count | number | ||
start | number |
HEADERS
Key | Datatype | Required | Description |
---|---|---|---|
LinkedIn-Version | string | ||
X-Restli-Protocol-Version | string |
RESPONSES
status: OK
{"paging":{"start":0,"count":10,"links":[],"total":4},"elements":[{"reviewInfo":{"rejectionReasons":[],"lastUpdated":1690422364241,"reviewStatus":"NEEDS_REVIEW"},"owner":{"sponsoredAccount":"urn:li:sponsoredAccount:1234567"},"hiddenFields":[],"versionId":1,"created":1691014589690,"creationLocale":{"country":"SE","language":"sv"},"name":"swedish - Jul 26, 2023","id":7992706,"lastModified":1691014589690,"state":"PUBLISHED","content":{"questions":[{"questionId":10107992706,"question":{"localized":{"sv_SE":"Förnamn"}},"responseEditable":true,"name":"First name","questionDetails":{"textQuestionDetails":{"maxResponseLength":300}},"predefinedField":"FIRST_NAME","responseRequired":true},{"questionId":10207992706,"question":{"localized":{"sv_SE":"Efternamn"}},"responseEditable":true,"name":"Last name","questionDetails":{"textQuestionDetails":{"maxResponseLength":300}},"predefinedField":"LAST_NAME","responseRequired":true},{"questionId":10307992706,"question":{"localized":{"sv_SE":"E-postadress"}},"responseEditable":true,"name":"Email address","questionDetails":{"textQuestionDetails":{"maxResponseLength":300}},"predefinedField":"EMAIL","responseRequired":true},{"questionId":10407992706,"question":{"localized":{"sv_SE":"Jobbtitel"}},"responseEditable":true,"name":"Job title","questionDetails":{"textQuestionDetails":{"maxResponseLength":300}},"predefinedField":"JOB_TITLE","responseRequired":true}],"description":{"localized":{"sv_SE":"testing swedish"}},"postSubmissionInfo":{"message":{"localized":{"sv_SE":"testing swedish"}},"callToAction":{"callToActionTarget":{"landingPageUrl":"https://www.linkedin.com"},"callToActionLabel":"VISIT_COMPANY_WEBSITE"}},"legalInfo":{"consents":[],"legalInfoId":1007992706,"privacyPolicyUrl":"http://example.com/privacy","legalDisclaimer":{"localized":{"sv_SE":"testing swedish"}}},"headline":{"localized":{"sv_SE":"testing swedish"}}}},{"reviewInfo":{"rejectionReasons":[],"lastUpdated":1677209409563,"reviewStatus":"NEEDS_REVIEW"},"owner":{"sponsoredAccount":"urn:li:sponsoredAccount:1234567"},"hiddenFields":[{"name":"hidden_field","value":"abc678"},{"name":"campo_escondido","value":"def789"}],"versionId":1,"created":1677209077832,"creationLocale":{"country":"ES","language":"es"},"name":"Form with written spanish","id":7234246,"lastModified":1677209424470,"state":"PUBLISHED","content":{"questions":[{"questionId":107234246,"question":{"localized":{"es_ES":"Nombre"}},"responseEditable":true,"name":"First name","questionDetails":{"textQuestionDetails":{"maxResponseLength":300}},"predefinedField":"FIRST_NAME","responseRequired":true},{"questionId":207234246,"question":{"localized":{"es_ES":"Apellidos"}},"responseEditable":true,"name":"Last name","questionDetails":{"textQuestionDetails":{"maxResponseLength":300}},"predefinedField":"LAST_NAME","responseRequired":true},{"questionId":307234246,"question":{"localized":{"es_ES":"Correo electrónico"}},"responseEditable":true,"name":"Email address","questionDetails":{"textQuestionDetails":{"maxResponseLength":300}},"predefinedField":"EMAIL","responseRequired":true},{"questionId":407234246,"question":{"localized":{"es_ES":"Cargo"}},"responseEditable":true,"name":"Job title","questionDetails":{"textQuestionDetails":{"maxResponseLength":300}},"predefinedField":"JOB_TITLE","responseRequired":true},{"questionId":507234246,"question":{"localized":{"es_ES":"Función"}},"responseEditable":true,"name":"Function","questionDetails":{"textQuestionDetails":{"maxResponseLength":300}},"predefinedField":"JOB_FUNCTION","responseRequired":true},{"questionId":607234246,"question":{"localized":{"es_ES":"Correo electrónico del trabajo"}},"responseEditable":true,"name":"Work email","questionDetails":{"textQuestionDetails":{"maxResponseLength":300}},"predefinedField":"WORK_EMAIL","responseRequired":true},{"name":"Custom question 0","questionDetails":{"multipleChoiceQuestionDetails":{"options":[{"text":{"localized":{"es_ES":"Rojo"}},"id":0},{"text":{"localized":{"es_ES":"Azul"}},"id":1}]}},"questionId":707234246,"question":{"localized":{"es_ES":"Cuál es tu color favorito"}},"responseEditable":true,"responseRequired":true},{"name":"Custom question 1","questionDetails":{"textQuestionDetails":{"maxResponseLength":300}},"questionId":807234246,"question":{"localized":{"es_ES":"¿Dónde creciste?"}},"responseEditable":true,"responseRequired":true}],"description":{"localized":{"es_ES":"Mis detalles de súper gran oferta!"}},"postSubmissionInfo":{"message":{"localized":{"es_ES":"muchas gracias!"}},"callToAction":{"callToActionTarget":{"landingPageUrl":"https://www.linkedin.com"},"callToActionLabel":"VISIT_COMPANY_WEBSITE"}},"legalInfo":{"consents":[{"consent":{"localized":{"es_ES":" marque mi casilla de verificación personalizada!"}},"checkRequired":true,"id":0}],"legalInfoId":107234246,"privacyPolicyUrl":"http://example.com/privacy","legalDisclaimer":{"localized":{"es_ES":"tanto texto de política"}}},"headline":{"localized":{"es_ES":"mi super gran titular"}}}},{"reviewInfo":{"rejectionReasons":[],"lastUpdated":1675881696317,"reviewStatus":"NEEDS_REVIEW"},"owner":{"sponsoredAccount":"urn:li:sponsoredAccount:1234567"},"hiddenFields":[],"versionId":1,"created":1675881726023,"creationLocale":{"country":"ES","language":"es"},"name":"spanish with custom questions and consent","id":7157016,"lastModified":1675881726023,"state":"PUBLISHED","content":{"questions":[{"questionId":107157016,"question":{"localized":{"es_ES":"Nombre"}},"responseEditable":true,"name":"First name","questionDetails":{"textQuestionDetails":{"maxResponseLength":300}},"predefinedField":"FIRST_NAME","responseRequired":true},{"questionId":207157016,"question":{"localized":{"es_ES":"Apellidos"}},"responseEditable":true,"name":"Last name","questionDetails":{"textQuestionDetails":{"maxResponseLength":300}},"predefinedField":"LAST_NAME","responseRequired":true},{"questionId":307157016,"question":{"localized":{"es_ES":"Correo electrónico"}},"responseEditable":true,"name":"Email address","questionDetails":{"textQuestionDetails":{"maxResponseLength":300}},"predefinedField":"EMAIL","responseRequired":true},{"questionId":407157016,"question":{"localized":{"es_ES":"Cargo"}},"responseEditable":true,"name":"Job title","questionDetails":{"textQuestionDetails":{"maxResponseLength":300}},"predefinedField":"JOB_TITLE","responseRequired":true},{"questionId":507157016,"question":{"localized":{"es_ES":"Función"}},"responseEditable":true,"name":"Function","questionDetails":{"textQuestionDetails":{"maxResponseLength":300}},"predefinedField":"JOB_FUNCTION","responseRequired":true},{"questionId":607157016,"question":{"localized":{"es_ES":"Correo electrónico del trabajo"}},"responseEditable":true,"name":"Work email","questionDetails":{"textQuestionDetails":{"maxResponseLength":300}},"predefinedField":"WORK_EMAIL","responseRequired":true},{"name":"Custom question 0","questionDetails":{"multipleChoiceQuestionDetails":{"options":[{"text":{"localized":{"es_ES":"red"}},"id":0},{"text":{"localized":{"es_ES":"blue"}},"id":1}]}},"questionId":707157016,"question":{"localized":{"es_ES":"What's your favorite color?"}},"responseEditable":true,"responseRequired":true},{"name":"Custom question 1","questionDetails":{"textQuestionDetails":{"maxResponseLength":300}},"questionId":807157016,"question":{"localized":{"es_ES":"Where did you grow up?"}},"responseEditable":true,"responseRequired":true}],"description":{"localized":{"es_ES":"My great offer detials"}},"postSubmissionInfo":{"message":{"localized":{"es_ES":"Thanks!"}},"callToAction":{"callToActionTarget":{"landingPageUrl":"https://www.linkedin.com"},"callToActionLabel":"VISIT_COMPANY_WEBSITE"}},"legalInfo":{"consents":[{"consent":{"localized":{"es_ES":"check my custom checkbox!"}},"checkRequired":true,"id":0}],"legalInfoId":107157016,"privacyPolicyUrl":"http://example.com/privacy","legalDisclaimer":{"localized":{"es_ES":"this is my policy text"}}},"headline":{"localized":{"es_ES":"A fabulous headline"}}}},{"reviewInfo":{"rejectionReasons":[],"lastUpdated":1675795969949,"reviewStatus":"NEEDS_REVIEW"},"owner":{"sponsoredAccount":"urn:li:sponsoredAccount:1234567"},"hiddenFields":[],"versionId":1,"created":1675795978299,"creationLocale":{"country":"US","language":"en"},"name":"custom questions","id":7149246,"lastModified":1675795978299,"state":"PUBLISHED","content":{"questions":[{"questionId":107149246,"question":{"localized":{"en_US":"First name"}},"responseEditable":true,"name":"First name","questionDetails":{"textQuestionDetails":{"maxResponseLength":300}},"predefinedField":"FIRST_NAME","responseRequired":true},{"questionId":207149246,"question":{"localized":{"en_US":"Last name"}},"responseEditable":true,"name":"Last name","questionDetails":{"textQuestionDetails":{"maxResponseLength":300}},"predefinedField":"LAST_NAME","responseRequired":true},{"questionId":307149246,"question":{"localized":{"en_US":"Email address"}},"responseEditable":true,"name":"Email address","questionDetails":{"textQuestionDetails":{"maxResponseLength":300}},"predefinedField":"EMAIL","responseRequired":true},{"questionId":407149246,"question":{"localized":{"en_US":"Seniority"}},"responseEditable":true,"name":"Seniority","questionDetails":{"textQuestionDetails":{"maxResponseLength":300}},"predefinedField":"SENIORITY","responseRequired":true},{"questionId":507149246,"question":{"localized":{"en_US":"Industry"}},"responseEditable":true,"name":"Industry","questionDetails":{"textQuestionDetails":{"maxResponseLength":300}},"predefinedField":"INDUSTRY","responseRequired":true},{"name":"Custom question 0","questionDetails":{"multipleChoiceQuestionDetails":{"options":[{"text":{"localized":{"en_US":"blue"}},"id":0},{"text":{"localized":{"en_US":"red"}},"id":1}]}},"questionId":607149246,"question":{"localized":{"en_US":"favorite color"}},"responseEditable":true,"responseRequired":true}],"description":{"localized":{"en_US":"offer"}},"postSubmissionInfo":{"message":{"localized":{"en_US":"thanks"}},"callToAction":{"callToActionTarget":{"landingPageUrl":"https://www.linkedin.com"},"callToActionLabel":"VISIT_COMPANY_WEBSITE"}},"legalInfo":{"consents":[],"legalInfoId":107149246,"privacyPolicyUrl":"http://example.com/privacy","legalDisclaimer":{"localized":{"en_US":"nada"}}},"headline":{"localized":{"en_US":"custom questions"}}}}]}