如何通过Facebook Marketing API创建LeadGen表单时修复“法律内容缺失”错误

问题描述 投票:0回答:1

我正在尝试使用Python中的remote_create()创建LeadgenForm。我在LeadGenLegalContent中添加了隐私政策详细信息。但是根据给定的细节,未创建潜在客户生成表单。有关以下错误的任何线索?

状态:400响应:{“error”:{“code”:100,“is_transient”:false,“error_subcode”:1892075,“error_user_msg”:“需要指定legal_content_id或privacy_policy来创建LeadGen表单”, “error_user_title”:“法律内容缺失”,“消息”:“无效参数”,“类型”:“OAuthException”,“fbtrace_id”:“GNmKk1KZxmm”}}

我们的想法是使用API​​创建潜在客户广告。我可以为现有表单创建广告系列,广告集,广告素材和广告(使用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()
facebook-marketing-api
1个回答
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()
© www.soinside.com 2019 - 2024. All rights reserved.