Identifying which app fired a webhook
AnsweredI've got a script that I want to run from several webhooks in different apps. This means it will need to know the app ID of the item that fired the webhook so it can authenticate correctly. It's been suggested on a couple of questions in the Developer Forum that the best way to achieve this is to pass the app ID in the URL as a query string.
I've tried to implement this, setting the webhook URL for an app to include ?app_id=123456789
. However, when I try to access this using $_GET['app_id']
in PHP, the parameter is not there - I've also tried printing out the query string, and this is showing up as blank. It works fine if I run the script manually in the browser with the query string included in the URL, so it seems that Podio is stripping it out of the URL.
Is this URL stripping expected behaviour, and is there a better way that I should be doing this?
-
Jonathan,
You should look for $_POST['app_id']
Podio seems to convert all part's of the querystring to a POST request.
We had the same issue, and yes it would be nice if the web hooks always send the app_id as a part of the request, but there might be some good reason, for why they don't in some situations.
One last recommendation — Maybe you should call the app_id something different in the querystring to make sure it does not conflict with the app_id Podio is sending for some web hooks. We use "app" to make it "safe". app will also be a POST parameter in the end.
-
another solution I have used is to use PATH_INFO. Your web hook could be:
http://example.com/blah.php/123456789
This way, there is no chance it will conflict with the POST variables podio passes in.
For the example above, PATH_INFO will be '/123456789'
Please sign in to leave a comment.
Comments
3 comments