Webhook creation dosn't wok

Hi,

Here is the similar question API Webhook Create Not Working? - #2 by Eyal_Ronel but not exactly the same.

I couldn’t create the webhook at all. My steps are:

  1. I created Personal Access Token and use it to authentication.

  2. Send request to create hooks and receive the error message

  3. Resouce id is correct.

  4. Target is correct.

  5. SSL configured (not self-signed)

  6. On server log there is no request to target. Asana API doesn’t send handshake request. But receivehook.php has realized it.

  7. The response code from asana on create webhook​ request is 400 “Bad request” with error “Could not complete activation hadshake…”.

Please help me. Couldn’t understand what’s wrong.

Hey @Vasyl_Lupynis,

when you create the webhook asana will test the route making a POST request at the url you provided.

The handshake token of the request will be in ‘X-Hook-Secret’ header.

The rest webhook requests will be performed when an event happened at your resource in asana and you will see on these requests the ‘X-Hook-Signature’ header.

1 Like

Thank you for the reply.

When I create the webhook asana doesn’t make a POST request but return the
error :frowning:

Asana try a post request at your route. Are u sure that the url of your route is correctly specified as the target url?

Look at this thread also and ask the OP if he finally made it and how :slight_smile:

Thanks, I saw the thread but didn’t see the resolution. Looks like something is not good with this API. I’m sure that I do all steps described in the documentation in correct way.

Seems like the flow is right, however there might be an issue if you’re trying to post directly to a url with .php at the end. I remember a I seen issues similar to that a few years ago when I was using PHP. try using an index.php file inside a folder named “recievehook” so your target path ends up without the .php filename and see if that helps.

Thank you so much for the reply! I have tried without php at the end (
https://as.3w-masters.com/retrieve-hook/123) but it doesn’t help :frowning:

Hi @Vasyl_Lupynis

A few things I would suggest to check first:

  1. Are you able to access your target url yourself? from both local and an outside environment?

  2. Are your returning a 200 status code a long with the handshake token?

  3. Are you 100% you’re using a valid SSL certificate? if you’re developing locally I would suggest you give a try to ngrok or similar https tunnel service to make it easier to debug

I can access https://as.3w-masters.com/retrieve-hook/123 and looks like the certificate is valid…

@Matt_Bramlage maybe you can help with a genius idea?

VIA an HTTP(S) POST request? when you access it through your browser that’s a GET request

Indeed but at least the URL is accessible on the web, which is a good first step :slight_smile:

That’s actually not relevant…
you can have an endpoint available for GET requests, but not for POST request. I would suggest to make sure your code supports accepting POST request to that endpoint. then move forward with everything else :slight_smile:

Thank you Guys for the replies. I think that there are not documented limitations.

I have tried many different solutions but nothing.

  1. I used ngrok - nothing. There were no request from Asana.
  2. I tested POST method to my site. It’s working according to handshake process.

Interesting thing - we decided to use asana events api and I also got errors. Then I try premium account - and all get working. Looks like api doesn’t work well with free accounts.

I don’t think that this is possible :stuck_out_tongue: I hope so at least. I am using free
accounts and I never had such issues with the webhooks.

Hm, I changed only PAT, projectid and workspaseid and script works. Maybe I
need to configure some project settings but doesn’t think so.

I’m tallking about events. Didn’t try webhook. But I’ll do it to check the
result.

Hi @Vasyl_Lupynis, I’d love to know if you were able to get webhooks working here.

This may not be directly helpful for your php server, but I recently put together an example of this in nodejs on Glitch. You can check that out here: Glitch :・゚✧

At the very least this might let you troubleshoot working with your resource, access token, and Asana’s responses in a safe environment.

1 Like

Everything is working fine here using PHP and free account…