# Webhook POST with deviceId parameter

**URL:** https://community.particle.io/t/webhook-post-with-deviceid-parameter/16748
**Category:** Cloud
**Created:** [October 21, 2015, 4:02pm UTC](https://community.particle.io/t/webhook-post-with-deviceid-parameter/16748 "2015-10-21T16:02:37Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![jlkalberer](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/jlkalberer/32/20735_2.png) [@jlkalberer](https://community.particle.io/u/jlkalberer)
#### Post date: [October 21, 2015, 4:02pm UTC](https://community.particle.io/t/webhook-post-with-deviceid-parameter/16748/1 "2015-10-21T16:02:37Z")

</div>

Hey, I’m not sure if this is expected or if it’s a bug but if I have a webhook that looks like this:

```
{
    "event": "test-hook",
    "url": "https://foobar.com/api/foo",
    "requestType": "POST",
    "json": {
    	"deviceId": "{{d}}",
            "token": "{{t}}"
    },
    "mydevices": true
}

```

It will set `deviceId` parameter to the actual particle ID instead of using the {{d}} parameter. I was scratching my head for a while trying to figure this one out.

---

<div class="post-metadata">

### Author: ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)
#### Post date: [October 21, 2015, 4:58pm UTC](https://community.particle.io/t/webhook-post-with-deviceid-parameter/16748/3 "2015-10-21T16:58:32Z")

</div>

@Dave, this sounds like you need to look at this 😉

---

<div class="post-metadata">

### Author: ![Dave](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/dave/32/181_2.png) [@Dave](https://community.particle.io/u/Dave)
#### Post date: [October 21, 2015, 5:17pm UTC](https://community.particle.io/t/webhook-post-with-deviceid-parameter/16748/4 "2015-10-21T17:17:21Z")

</div>

Hmm that seems weird, testing…

---

<div class="post-metadata">

### Author: ![jlkalberer](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/jlkalberer/32/20735_2.png) [@jlkalberer](https://community.particle.io/u/jlkalberer)
#### Post date: [October 21, 2015, 5:20pm UTC](https://community.particle.io/t/webhook-post-with-deviceid-parameter/16748/5 "2015-10-21T17:20:41Z")

</div>

Nope, I think I had an old webhook that was overriding my new one.

@peekay123 are you on here all day haha?

---

<div class="post-metadata">

### Author: ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)
#### Post date: [October 21, 2015, 5:22pm UTC](https://community.particle.io/t/webhook-post-with-deviceid-parameter/16748/6 "2015-10-21T17:22:25Z")

</div>

😛

---

<div class="post-metadata">

### Author: ![Dave](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/dave/32/181_2.png) [@Dave](https://community.particle.io/u/Dave)
#### Post date: [October 21, 2015, 5:24pm UTC](https://community.particle.io/t/webhook-post-with-deviceid-parameter/16748/7 "2015-10-21T17:24:48Z")

</div>

Haha, thanks all, glad you got it figured out! 🙂

---

<div class="post-metadata">

### Author: ![jlkalberer](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/jlkalberer/32/20735_2.png) [@jlkalberer](https://community.particle.io/u/jlkalberer)
#### Post date: [October 21, 2015, 5:37pm UTC](https://community.particle.io/t/webhook-post-with-deviceid-parameter/16748/8 "2015-10-21T17:37:19Z")

</div>

Well… I’m still running into issues.

Here is the updated webhook

```
{
    "event": "tappt_request-pour",
    "url": "https://tappt.io/api/authorizations/pour",
    "requestType": "POST",
    "json": {
    	"deviceId": "{{id}}",
    	"token": "{{tkn}}"
    },
    "mydevices": true
}

```

Here is the message body I’m getting on the server:

```
{
	"event":"tappt_request-pour",
	"data":"{\"id\":\"2\",\"tkn\":\"\u0002ena3f6N1HkJR0StIe1NI0rWvEyxsdteROCk9LiaLAN9g01\"}",
	"published_at":"2015-10-21T17:32:00.833Z",
	"coreid":"2c0022001647343337363432",
	"deviceId":"",
	"token":""
}

```

Looks like it’s not setting token because tkn is too long. I replaced that value with “foo” and it worked. What’s the length limit on the parameters?

---

<div class="post-metadata">

### Author: ![jlkalberer](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/jlkalberer/32/20735_2.png) [@jlkalberer](https://community.particle.io/u/jlkalberer)
#### Post date: [October 21, 2015, 5:51pm UTC](https://community.particle.io/t/webhook-post-with-deviceid-parameter/16748/9 "2015-10-21T17:51:06Z")

</div>

> [@jlkalberer](#):
>
> \u0002

Looks like that character is the culprit... Wow that was annoying

---

<div class="post-metadata">

### Author: ![Dave](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/dave/32/181_2.png) [@Dave](https://community.particle.io/u/Dave)
#### Post date: [October 23, 2015, 3:16pm UTC](https://community.particle.io/t/webhook-post-with-deviceid-parameter/16748/10 "2015-10-23T15:16:46Z")

</div>

Hi @jlkalberer,

Glad you got it working! I’m curious if there was anything we could have provided that would have made tracking that down easier / less frustrating?

Thanks!  
David

---

<div class="post-metadata">

### Author: ![jlkalberer](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/jlkalberer/32/20735_2.png) [@jlkalberer](https://community.particle.io/u/jlkalberer)
#### Post date: [October 23, 2015, 6:38pm UTC](https://community.particle.io/t/webhook-post-with-deviceid-parameter/16748/11 "2015-10-23T18:38:16Z")

</div>

Well, I think that when I use `particle webhook create something.json` it should output some warning/error text if there is already a webhook with the same name.

adding `particle webhook update something.json` would be a nice to have.

---

<div class="post-metadata">

### Author: ![Dave](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/dave/32/181_2.png) [@Dave](https://community.particle.io/u/Dave)
#### Post date: [October 23, 2015, 7:08pm UTC](https://community.particle.io/t/webhook-post-with-deviceid-parameter/16748/12 "2015-10-23T19:08:59Z")

</div>

Hi @jlkalberer,

Interesting, thanks for the idea! Sure, the CLI could warn you with a “Hey, this is allowed, but did you mean to add another one of these?” sort of warning? I threw an issue on the CLI for this here:

> <https://github.com/particle-iot/particle-cli/issues/161>

Thanks!  
David

---

<div class="post-metadata">

### Author: ![ctmorrison](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/ctmorrison/32/7396_2.png) [@ctmorrison](https://community.particle.io/u/ctmorrison)
#### Post date: [October 23, 2015, 7:10pm UTC](https://community.particle.io/t/webhook-post-with-deviceid-parameter/16748/13 "2015-10-23T19:10:10Z")

</div>

I concur. I was going nuts until I realized that creating a new version of a webhook merely added a new hook with the same name and they both/all get run, as I understand it. Once I learned this, I then deleted the current webhook and then did the create. I think having multiple webhooks with the same name could be advantageous in certain situations, so I would like to see that capability continue. As @jkalberer suggests, perhaps a warning would help the user be aware of the existence of older webhook(s) with the same name.
