How to get Task Details from WebHook


I have created webhook in PHP using php-asana library and I got the details of Task from Asana when I create the task in Asana.

Now I want to get full task details from Asana by calling one of the method findById under task. But when I call that method it gives me “Invalid Request” error.

And the reason is the when I got the JSON from Asana WebHook than I got exponential form of ID. I convert that ID to int and than try to get the details but it won’t work.

Can you please let me know that how to get the details of the task ?

Here is my sample code and response:

Response from Webhook :
$entries = json_decode(file_get_contents(‘php://input’), true);
$events = $entries[‘events’];
foreach ($events as $event) {
$taskId = number_format($event[‘resource’], 0, 0);
try {
$webhook = $client->tasks->findById(’$taskId’);
} catch (Exception $ex) {
$webhook = json_encode($ex->getMessage());

Please help me to solve this issue.


Hi there,

It looks like when you’re receiving the webhook and parsing it into JSON, it’s converting the ID, which is a large number, into exponential format. If you look closely, when it does this it’s truncating the last digit off of the number, which means you lose the original ID.

You can configure PHP to handle large numbers in a few different ways (see the second answer on this StackOverflow post). Can you try one of these solutions to see if the JSON you get back keeps the number as either a string or as a longer, non-exponential number?