0

I have a Facebook leadgen application with webhook setup

The app is written in PHP and this is how I collect the POST data:

$input = json_decode(file_get_contents("php://input"), true);

There are 2 accounts connected to the app, one of the accounts works properly and on any submission the server receive the following POST:

Array
(
    [entry] => Array
        (
            [0] => Array
                (
                    [changes] => Array
                        (
                            [0] => Array
                                (
                                    [field] => leadgen
                                    [value] => Array
                                        (
                                            [created_time] => 1520526325
                                            [page_id] => 1458754850856258
                                            [form_id] => 1958957004374169
                                            [leadgen_id] => 2068371616766040
                                        )

                            )

                    )

                [id] => 1458754850856258
                [time] => 1520526326
            )

    )

[object] => page
)

The second account also send webhook on submission just with empty values:

Array
(
    [entry] => Array
        (
            [0] => Array
                (
                    [changes] => Array
                        (
                            [0] => Array
                                (
                                    [field] => leadgen
                                    [value] => Array
                                        (
                                            [ad_id] => 
                                            [form_id] => 
                                            [leadgen_id] => 
                                            [created_time] => 
                                            [page_id] => 
                                            [adgroup_id] => 
                                        )

                                )

                        )

                    [id] => 1.4587548508563E+15
                    [time] => 1502766412
                )

        )

    [object] => page
)

What could be the reason for this issue, is it campaign settings?

As I do not have access to the Facebook account I cannot compare the setup on the accounts, and have no way to advise the second user what to do in order to resolve the issue, assuming the issue is on the campaign settings.

Thank you

Liranko
  • 76
  • 6
  • Maybe they did not grant your app the permission it needs to access this kind of data? Btw., you want to modify your code, look at the `id` value in the second example, that’s gotten mangled up. You want to use the flag that makes json_decode always parse such large numbers as strings. – CBroe Mar 19 '18 at 10:34
  • Thank you, added a flag and it did resolve the ID big int issue. When a user logs is to my app I ask for the required permissions using Facebook login SDK. so I have same permissions for both accounts – Liranko Mar 19 '18 at 12:17
  • The mere fact that you _asked_, does not necessarily mean you _got_. Suggest you debug the access tokens for both users to actually verify. – CBroe Mar 19 '18 at 12:21
  • @CBroe Thank you so much! Debugging the access token resolved my issue! I had missing permissions so requesting explicit permissions resolved the issue. – Liranko Mar 19 '18 at 15:11

0 Answers0