How to know which Facebook App is sending real-time updates

252 views Asked by At

I have one app that will be processing real-time updates for subscriptions of multiple Facebook applications. In the verify signature step, I need to know for which Facebook application Facebook is giving me updates (so I can use the correct app secret). I haven't seen a sample request that provides this information but I could be missing it. Is there a way to know which app the subscriptions are for (without iterating though my known apps and trying each secret until one works)?

One thought I had was to subscribe to Facebook and providing a callback URL that has the App ID in the path so I could parse it that way.

3

There are 3 answers

1
Faraz On

You can try setting the verify_token token parameter to the app id. And then on your callback file use the $_GET['hub_verify_token'] to check which app sent the update.

0
Shinhan On

Callback URL with App ID looks like the only way.

Especially since:

Note that the hub.mode, hub.challenge and hub.verify_token parameters are not sent again once the subscription has been confirmed.

from https://developers.facebook.com/docs/reference/api/realtime/

0
Kishor On

I know the post is bit old, but I am posting this because it may help others looking for this.

The best way to handle multiple app calls with single end point is to send get parameter with your app id.

Eg: Set the callbackurl as http://yoursite.com/callback.php?id=xxxxxxxxxxxx

You can capture the app id by using $_GET['id']. Simple, and works just fine.