简体   繁体   English

如何在没有API详细信息的情况下获取潜在客户详细信息?

[英]How to get lead details without API details?

I followed the instructions here and getting real time updates. 我按照此处的说明进行操作并获得实时更新。 But problem is how can I get lead details using this code: 但是问题是如何使用以下代码获取潜在客户的详细信息:

use FacebookAds\Object\Lead;

$form = new Lead(<LEAD_ID>); 
$form->read();

When I am using Leadgen ID then getting error: Fatal error: Uncaught InvalidArgumentException: An Api instance must be provided as argument or set as instance in the... 当我使用Leadgen ID时,出现错误:致命错误:未捕获的InvalidArgumentException:必须将Api实例作为参数提供或设置为实例。

But if I use: 但是,如果我使用:

use FacebookAds\Api;
use FacebookAds\Object\Lead;

Api::init(
    'appid', 
    'secret_token',
    $_SESSION['facebook_access_token'] 
);

$form = new Lead('leadgenid');
$form->read();

Then I am getting data as I want: 然后,我可以根据需要获取数据:

{
    "created_time": "2015-02-28T08:49:14+0000", 
    "id": "<LEAD_ID>", 
    "ad_id": "<AD_ID>",
    "form_id": "<FORM_ID>",
    "field_data": [{
        "name": "car_make",
        "values": [
            "Honda"
        ]
    }, {
        "name": "full_name", 
        "values": [
            "Joe Example"
        ]
    }, {
        "name": "email", 
        "values": [
            "joe@example.com"
        ]
    }]
}

But user_access_token expired after 2 months(long_lived token) 但是user_access_token在2个月后过期(令牌的寿命很长)

what is the best way to setup an API on our Server which we connect via webhook to receive LeadAd data and store it in our database automatically? 在我们的服务器上设置API的最佳方法是什么,我们通过Webhook连接以接收LeadAd数据并将其自动存储在我们的数据库中? Do we have to create a new token every two month manually? 我们是否必须每两个月手动创建一个新令牌? is there any better way? 有什么更好的办法吗?

There is "system user" in facebook ads platform that should be the answer to your question. 在facebook广告平台中有一个“系统用户”,应该可以回答您的问题。 Please find its details below: https://developers.facebook.com/docs/marketing-api/businessmanager/systemuser/v2.5 请在下面找到其详细信息: https : //developers.facebook.com/docs/marketing-api/businessmanager/systemuser/v2.5

In brief, by using a system user, you will be able to generate a token that does not require user to sign in every certain period. 简而言之,通过使用系统用户,您将能够生成不需要用户在每个特定时间段内登录的令牌。 However, you will need to have an app that has standard access in order to be able to create a system user in your business manager. 但是,您将需要拥有一个具有标准访问权限的应用程序,以便能够在您的业务经理中创建系统用户。

Hope that it helps! 希望对您有所帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM