Hi,
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 :
{“resource”:6.6579207086049e+14,“user”:2.0144296706915e+14,“type”:“story”,“action”:“added”,“created_at”:“2018-05-09T06:15:27.427Z”}
$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.