1

I tried to create a webhook for a task in Asana but the only response I'm getting is this:

{
  "errors": [
    {
      "message": "Could not complete activation handshake with target URL. Please ensure that the receiving server is accepting connections and supports SSL",
      "help": "For more information on API status codes and how to handle them, read the docs on errors: https://asana.com/developers/documentation/getting-started/errors"
    }
  ]
}

(Status: 400 Bad Request)

I am sending a POST Request via Postman to https://app.asana.com/api/1.0/webhooks with following content:

{
  "data": 
    {
      "resource": 123456789012345,
      "target": "https://example.com/asana.php"
    }
}

The asana.php looks something like this:

$headers = getallheaders();
$secret_token = $headers['X-Hook-Secret'];
header('X-Hook-Secret: ' . $secret_token);

What am I doing wrong? Am I missing something?

November
  • 11
  • 5

1 Answers1

0

According to the Asana API Reference (https://asana.com/developers/api-reference/webhooks),

The target must respond with a 200 OK and a matching X-Hook-Secret header to confirm that this webhook subscription is indeed expected.

When you send the header, do you know what response code is being sent? Perhaps you might want to have a look at the $http_response_code argument in http://php.net/manual/en/function.header.php

Mark Yao
  • 86
  • 5
  • I tested the script with Postman, it responds with 200 OK and the X-Hook-Secret. After testing it on another webserver (it worked!), it seems there's something with the one i use, so nothing code-related... – November Sep 13 '16 at 08:06