我正在尝试在Python中使用remote_create()创建LeadgenForm。我已在LeadGenLegalContent中添加了隐私策略详细信息。但是使用给定的详细信息,未创建销售线索生成表单。关于以下错误有任何线索吗?
状态:400 响应: { “错误”:{ “代码”:100, “ is_transient”:否, “错误子代码”:1892075, “ error_user_msg”:“创建LeadGen表单需要指定legal_content_id或privacy_policy”, “ error_user_title”:“缺少法律内容”, “ message”:“无效的参数”, “ type”:“ OAuthException”, “ fbtrace_id”:“ GNmKk1KZxmm” } }
想法是使用API创建潜在客户广告。我可以为现有表单创建Campaign,Adset,Creative和Ad(使用lead_gen_form_id)。当我尝试使用LeadGenLegalContent创建新表单时,将显示上述消息。
leadgenquestion = LeadGenQuestion(parent_id = facebook_page_id)
leadgenquestion[LeadGenQuestion.Field.type] ='EMAIL'
leadgenquestion[LeadGenQuestion.Field.key] = 'question1'
leadgenlegalcontent = LeadGenLegalContent(parent_id = facebook_page_id)
leadgenlegalcontent[LeadGenLegalContent.Field.privacy_policy] = {'url': fbil_url, 'link_text' : 'Read the Privacy Policy'}
leadgenform = LeadgenForm(facebook_page_id)
leadgenform[LeadgenForm.Field.name] = 'Form Name'
leadgenform[LeadgenForm.Field.follow_up_action_url] = fbil_url
leadgenform[LeadgenForm.Field.questions] = leadgenquestion
leadgenform[LeadgenForm.Field.legal_content] = leadgenlegalcontent
leadgenform[LeadgenForm.Field.status] = LeadgenForm.Status.active
leadgenform[LeadgenForm.Field.privacy_policy_url] = fbil_url
leadgenform[LeadgenForm.Field.created_time] = str(datetime.datetime.now())
leadgenform[LeadgenForm.Field.locale] = 'EN_US'
leadgenform.remote_create()
答案 0 :(得分:0)
嗨,您需要legal_content_id。您可以通过以下方式获得它:
curl 'https://graph.facebook.com//v3.2/PAGE_ID/leadgen_legal_content?access_token=ACCESS_TOKEN'
您的访问令牌必须来自页面,因此在此之前:
curl -X GET 'https://graph.facebook.com//v3.2/PAGE_ID?fields=access_token&access_token=ACCESS_TOKEN'
其中第二个是用户访问令牌。
然后,我只需在新表单中添加一个简单的字段即可。就您而言,它必须像:
leadgenform["legal_content_id"] = "<legal_content_id>"
leadgenform.remote_create()