# Something wrong with create webhook, please help

**URL:** <https://forum.asana.com/t/something-wrong-with-create-webhook-please-help/147141>\
**Category:** API & Developers\
**Created:** [23 December 2021 10:29 UTC](https://forum.asana.com/t/something-wrong-with-create-webhook-please-help/147141 "2021-12-23T10:29:55Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Taras\_M](https://luna1.co/8d76cd.png) [@Taras\_M](https://forum.asana.com/u/Taras_M)\
**Post date:** [23 December 2021 10:29 UTC](https://forum.asana.com/t/something-wrong-with-create-webhook-please-help/147141/1 "2021-12-23T10:29:55Z")

</div>

Hi Asana,

I’m new in webhooks generally.

I have problem with CreateWebhook, i tried install Asan php sdk to Lumen framework (installed okay).  
Token created in console (created app and there created token) - looks ok

Did this steps:

$client = Client::accessToken(‘token’);  
$result = $client-\>webhooks-\>createWebhook([  
‘resourse’ =\> ‘xxxxx’, //project\_id got from url “app.asana .com/0/xxxxx/list”  
‘target’ =\> ‘mydomain/api/tasks’  
],  
[‘opt\_pretty’ =\> ‘true’]  
);  
But each time got error “Invalid Request”

For this start to checking/debug Requests inside SDK how it works and found answer on request “this message (“You should specify one of resource”)”

Also tried using just Curl also problem  
curl -H "Authorization: Bearer xxxxxxxxxxtoken  
-X POST [https://app.asana.com/api/1.0/webhooks](https://app.asana.com/api/1.0/webhooks)   
-d “resource=project\_id”   
-d “target=mydomian/api/tasks”

Error is:  
“message”: “The remote server which is intended to receive the webhook responded with an incorrect status code: 405”

What i need from webhooks

- Asana calls our system via webhook using “skinny” events (see Asana API docs).
- These events are put into a queue (a table you will create).
- We then pull the details (projects/tasks/assignments/status) of those queued skinny events using Asana REST API.
- Data is stored in the database.
- Events are CRUD on projects, tasks, users, etc.

What is wrong, what i do wrong, please help me with this…

p.s. sorry for my english

Thank you,  
Taras

---

<div class="post-metadata">

**Author:** ![Bastien\_Siebman](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/bastien_siebman/32/172354_2.png) [@Bastien\_Siebman](https://forum.asana.com/u/Bastien_Siebman)\
**Post date:** [24 December 2021 06:04 UTC](https://forum.asana.com/t/something-wrong-with-create-webhook-please-help/147141/2 "2021-12-24T06:04:23Z")

</div>

Hi,

In the documentation, did you read the part about the handshake mechanism? Your server might not be answering properly to the handshake Asana sends.

---

<div class="post-metadata">

**Author:** ![Taras\_M](https://luna1.co/8d76cd.png) [@Taras\_M](https://forum.asana.com/u/Taras_M)\
**Post date:** [3 January 2022 15:36 UTC](https://forum.asana.com/t/something-wrong-with-create-webhook-please-help/147141/3 "2022-01-03T15:36:40Z")

</div>

> [@Bastien\_Siebman](#):
>
> handshake

Hello Bastien\_Siebman,

Thank you for answer, sorry for long response.  
How I can check handshake mechanism from my server?  
Can you give some link to doc, will be good with some example?

Thank you,  
Taras

---

<div class="post-metadata">

**Author:** ![Bastien\_Siebman](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/bastien_siebman/32/172354_2.png) [@Bastien\_Siebman](https://forum.asana.com/u/Bastien_Siebman)\
**Post date:** [3 January 2022 16:01 UTC](https://forum.asana.com/t/something-wrong-with-create-webhook-please-help/147141/4 "2022-01-03T16:01:01Z")

</div>

Here you go [the official doc on handshake](https://developers.asana.com/docs/establish-a-webhook)

---

<div class="post-metadata">

**Author:** ![Taras\_M](https://luna1.co/8d76cd.png) [@Taras\_M](https://forum.asana.com/u/Taras_M)\
**Post date:** [3 January 2022 18:03 UTC](https://forum.asana.com/t/something-wrong-with-create-webhook-please-help/147141/5 "2022-01-03T18:03:44Z")

</div>

I found info that need send Hook-Secret back

I did it like that ( but i think request don’t come here and lost somewhere with error 405)  
“The remote server which is intended to receive the webhook responded with an incorrect status code: 405”

Maybe you give some advice about error 405?

$headers = apache\_request\_headers();

```
    // if headers contain X-Hook-Secret, we need to answer with 200

    if (array_key_exists('X-Hook-Secret', $headers)) {

        $xHookSecret = $headers['X-Hook-Secret'];

        // header needs to be resent

        header('X-Hook-Secret: ' . $xHookSecret);

        header("HTTP/1.1 200 OK");

        exit;

    }

```

---

<div class="post-metadata">

**Author:** ![Bastien\_Siebman](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/bastien_siebman/32/172354_2.png) [@Bastien\_Siebman](https://forum.asana.com/u/Bastien_Siebman)\
**Post date:** [4 January 2022 12:07 UTC](https://forum.asana.com/t/something-wrong-with-create-webhook-please-help/147141/6 "2022-01-04T12:07:35Z")

</div>

Did you try contacting your own server using Postman for example?

---

<div class="post-metadata">

**Author:** ![Taras\_M](https://luna1.co/8d76cd.png) [@Taras\_M](https://forum.asana.com/u/Taras_M)\
**Post date:** [11 February 2022 10:41 UTC](https://forum.asana.com/t/something-wrong-with-create-webhook-please-help/147141/7 "2022-02-11T10:41:29Z")

</div>

Hi Guys,

Sorry for delay, was some problems.

Yes tried with postman, same error 405  
What means 405?

In right side you can see full request

 ![image](https://us1.discourse-cdn.com/asana/original/3X/0/7/070d56f82f40c4dff16693eebe61030476e0c3ce.png)

---

<div class="post-metadata">

**Author:** ![Bastien\_Siebman](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/bastien_siebman/32/172354_2.png) [@Bastien\_Siebman](https://forum.asana.com/u/Bastien_Siebman)\
**Post date:** [11 February 2022 11:07 UTC](https://forum.asana.com/t/something-wrong-with-create-webhook-please-help/147141/8 "2022-02-11T11:07:33Z")

</div>

It looks like your own server answered 405 to Asana when they tried to initiate the discussion. Correct @Phil_Seeman ?

---

<div class="post-metadata">

**Author:** ![Taras\_M](https://luna1.co/8d76cd.png) [@Taras\_M](https://forum.asana.com/u/Taras_M)\
**Post date:** [11 February 2022 12:44 UTC](https://forum.asana.com/t/something-wrong-with-create-webhook-please-help/147141/9 "2022-02-11T12:44:35Z")

</div>

@Phil_Seeman  
@Bastien_Siebman

Guys help me please 🙂 any exampels or like this will be good

---

<div class="post-metadata">

**Author:** ![Bastien\_Siebman](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/bastien_siebman/32/172354_2.png) [@Bastien\_Siebman](https://forum.asana.com/u/Bastien_Siebman)\
**Post date:** [11 February 2022 14:23 UTC](https://forum.asana.com/t/something-wrong-with-create-webhook-please-help/147141/10 "2022-02-11T14:23:57Z")

</div>

I don’t have any example. Did you fully read the documentation?

---

<div class="post-metadata">

**Author:** ![Phil\_Seeman](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/phil_seeman/32/81525_2.png) [@Phil\_Seeman](https://forum.asana.com/u/Phil_Seeman)\
**Post date:** [11 February 2022 18:07 UTC](https://forum.asana.com/t/something-wrong-with-create-webhook-please-help/147141/11 "2022-02-11T18:07:05Z")

</div>

Yes, I concur with @Bastien_Siebman.

When you initiate the webhook creation request, Asana sends a handshake request to your designated endpoint (in your case, that’s the `asana.truetime.app`… URL). It seems that endpoint is not set up to be able to properly handle that request and so your server sends back a 405 response.

> The HyperText Transfer Protocol (HTTP) **`405 Method Not Allowed`** response status code indicates that the server knows the request method, but the target resource doesn’t support this method.

> **[405 Method Not Allowed - HTTP | MDN](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/405)**
>
> The HyperText Transfer Protocol (HTTP) 405 Method Not Allowed response status code indicates that the server knows the request method, but the target resource doesn't support this method.

I don’t code in PHP so I’m afraid I don’t have any specific example code I could supply you with.

---

<div class="post-metadata">

**Author:** ![Taras\_M](https://luna1.co/8d76cd.png) [@Taras\_M](https://forum.asana.com/u/Taras_M)\
**Post date:** [21 February 2022 15:35 UTC](https://forum.asana.com/t/something-wrong-with-create-webhook-please-help/147141/12 "2022-02-21T15:35:42Z")

</div>

Hi Guys,

Yes you are right problem was with server. Thank you for help.

Other question: I just added new task and assign new guy to this task. But webhook returned me 4 objects (also new task id not there, new task id is 1201860296330111 but not in this list).  
Can you help me understand how i should understand what was change and waht request send to API for get more details.  
I mean did two things but returned 4 objects.

Thank you very much

{  
“events”: [  
{  
“user”: {  
“gid”: “1201513736066267”,  
“resource\_type”: “user”  
},  
“created\_at”: “2022-02-21T15:05:34.763Z”,  
“action”: “added”,  
“parent”: {  
“gid”: “1201513888330921”,  
“resource\_type”: “project”  
},  
“resource”: {  
“gid”: “1201855282391067”,  
“resource\_type”: “task”,  
“resource\_subtype”: “default\_task”  
}  
},  
{  
“user”: {  
“gid”: “1201513736066267”,  
“resource\_type”: “user”  
},  
“created\_at”: “2022-02-21T15:05:35.030Z”,  
“action”: “changed”,  
“resource”: {  
“gid”: “1201855282391067”,  
“resource\_type”: “task”,  
“resource\_subtype”: “default\_task”  
},  
“parent”: null,  
“change”: {  
“field”: “followers”,  
“action”: “added”,  
“added\_value”: {  
“gid”: “1201513888300848”,  
“resource\_type”: “user”  
}  
}  
},  
{  
“user”: {  
“gid”: “1201513736066267”,  
“resource\_type”: “user”  
},  
“created\_at”: “2022-02-21T15:05:35.030Z”,  
“action”: “changed”,  
“resource”: {  
“gid”: “1201855282391067”,  
“resource\_type”: “task”,  
“resource\_subtype”: “default\_task”  
},  
“parent”: null,  
“change”: {  
“field”: “assignee”,  
“action”: “changed”,  
“new\_value”: {  
“gid”: “1201513888300848”,  
“resource\_type”: “user”  
}  
}  
},  
{  
“user”: {  
“gid”: “1201513736066267”,  
“resource\_type”: “user”  
},  
“created\_at”: “2022-02-21T15:05:35.046Z”,  
“action”: “added”,  
“resource”: {  
“gid”: “1201860394847802”,  
“resource\_type”: “story”,  
“resource\_subtype”: “assigned”  
},  
“parent”: {  
“gid”: “1201855282391067”,  
“resource\_type”: “task”,  
“resource\_subtype”: “default\_task”  
}  
}  
]  
}

---

<div class="post-metadata">

**Author:** ![Phil\_Seeman](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/phil_seeman/32/81525_2.png) [@Phil\_Seeman](https://forum.asana.com/u/Phil_Seeman)\
**Post date:** [21 February 2022 18:09 UTC](https://forum.asana.com/t/something-wrong-with-create-webhook-please-help/147141/13 "2022-02-21T18:09:37Z")

</div>

These events are about a different task, 1201855282391067 (are you sure 1201860296330111 is the right task ID #?). They’re telling you, in order:

- Task 1201855282391067 was added as a new task
- That task had a collaborator (follower) added to it (that being user 1201513736066267)
- That task was assigned to user 1201513888300848
- A story was added to that task, recording the task assignment

---

<div class="post-metadata">

**Author:** ![Taras\_M](https://luna1.co/8d76cd.png) [@Taras\_M](https://forum.asana.com/u/Taras_M)\
**Post date:** [21 February 2022 18:35 UTC](https://forum.asana.com/t/something-wrong-with-create-webhook-please-help/147141/14 "2022-02-21T18:35:12Z")

</div>

> [@Phil\_Seeman](#):
>
> 1201855282391067

Many thanks for answer.

1201855282391067 it’s task but it was created before (yesterday).

It’s was created new task 1201860296330111 (today) and assign user (btw i think it’s not a webhook issues, maybe i just can’t understand how it work all together)

maybe you have some real examples for understand how it work or something like that.

Sorry if boring just first time woking with Asana 🙂

Thank you,  
Taras

---

<div class="post-metadata">

**Author:** ![Taras\_M](https://luna1.co/8d76cd.png) [@Taras\_M](https://forum.asana.com/u/Taras_M)\
**Post date:** [23 February 2022 18:22 UTC](https://forum.asana.com/t/something-wrong-with-create-webhook-please-help/147141/15 "2022-02-23T18:22:34Z")

</div>

HI  
@Bastien_Siebman and @Phil_Seeman

How get only {“events”…} request from webhook?

For now my webhook return me full result like:

POST /api/addtasks HTTP/1.1  
Accept-Encoding: identity  
Authorization:  
Connection: close  
Content-Length: 867  
Content-Type: application/json  
Host: asana.truetime.app  
User-Agent: Asana  
X-Asana-Request-Signature: 3b84306b79be810c618fab1a82c2d026dc3af76dbabce8d7eb1b6ddb636f8841  
X-Hook-Signature: 3b84306b79be810c618fab1a82c2d026dc3af76dbabce8d7eb1b6ddb636f8841  
X-Https: 1

{“events”:[{“user”:{…

Thank you very much,  
Taras

---

<div class="post-metadata">

**Author:** ![Phil\_Seeman](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/phil_seeman/32/81525_2.png) [@Phil\_Seeman](https://forum.asana.com/u/Phil_Seeman)\
**Post date:** [24 February 2022 22:50 UTC](https://forum.asana.com/t/something-wrong-with-create-webhook-please-help/147141/16 "2022-02-24T22:50:06Z")

</div>

> [@Taras\_M](#):
>
> How get only {“events”…} request from webhook?

I’m not sure exactly what you’re asking…

The elements you show in your screenshot are HTTP headers, which are a core part of an HTTP request and response; there’s no way to not have them be there.

---

<div class="post-metadata">

**Author:** ![Taras\_M](https://luna1.co/8d76cd.png) [@Taras\_M](https://forum.asana.com/u/Taras_M)\
**Post date:** [25 February 2022 05:07 UTC](https://forum.asana.com/t/something-wrong-with-create-webhook-please-help/147141/17 "2022-02-25T05:07:27Z")

</div>

Okay, so how to work with json string?  
How a can get it from this full response?  
For me needs a json data only.

So i should somehow parse this response, remove http and get only json string?

My question how i can get only json string (http info before jdon not needed for me)

Sorry for boring

Thank you very much

---

<div class="post-metadata">

**Author:** ![Phil\_Seeman](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/phil_seeman/32/81525_2.png) [@Phil\_Seeman](https://forum.asana.com/u/Phil_Seeman)\
**Post date:** [25 February 2022 06:00 UTC](https://forum.asana.com/t/something-wrong-with-create-webhook-please-help/147141/18 "2022-02-25T06:00:37Z")

</div>

That aspect of it is dependent on php which I’m afraid I don’t know so can’t help you with that, sorry.

---

<div class="post-metadata">

**Author:** ![Taras\_M](https://luna1.co/8d76cd.png) [@Taras\_M](https://forum.asana.com/u/Taras_M)\
**Post date:** [25 February 2022 06:12 UTC](https://forum.asana.com/t/something-wrong-with-create-webhook-please-help/147141/19 "2022-02-25T06:12:57Z")

</div>

Okay will think about this.

But to be honest very weired, Api return just json format.

But webhook return this everything, if needs only json for work with data

---

<div class="post-metadata">

**Author:** ![Taras\_M](https://luna1.co/8d76cd.png) [@Taras\_M](https://forum.asana.com/u/Taras_M)\
**Post date:** [7 March 2022 14:28 UTC](https://forum.asana.com/t/something-wrong-with-create-webhook-please-help/147141/20 "2022-03-07T14:28:56Z")

</div>

Hi Guys,

@Phil_Seeman @Bastien_Siebman  
Can you please give doc url to handle webhook request, I mean what is story, section etc… ?

I need it to understand how to correctly check and save it to db (i mean i did one action, but webhook returned 2+ results)  
Api is okay, working well, just need to understand webhook answer.

Thank you,  
Taras

[Next page](https://forum.asana.com/t/something-wrong-with-create-webhook-please-help/147141.md?page=2)
