# Webhook Template issue

**URL:** <https://community.particle.io/t/webhook-template-issue/57987>\
**Category:** Integrations\
**Tags:** argon\
**Created:** [October 7, 2020, 10:29pm UTC](https://community.particle.io/t/webhook-template-issue/57987 "2020-10-07T22:29:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jed](https://avatars.discourse-cdn.com/v4/letter/j/34f0e0/32.png) [@jed](https://community.particle.io/u/jed)\
**Post date:** [October 7, 2020, 10:29pm UTC](https://community.particle.io/t/webhook-template-issue/57987/1 "2020-10-07T22:29:00Z")

</div>

I am trying to set up a mustache template for a webhook. The issue seems to be that the data returned from the external API starts with an array:

```auto
[
 {
  "ParameterName":"Name1",
  "Data":"Value1",
  "Meta":"Meta1"
 },
 {
  "ParameterName":"Name2",
  "Data":"Value2",
  "Meta":"Meta1"
 }
]

```

With a tester, I was able to get this to work fine…

```auto
{{#.}}{{ParameterName}}:{{Data}}
{{/.}}

```

Which was outputting:

```auto
Name1:Value1
Name2:Value2

```

However, this causes an error on the Particle Webhook.

I can use {{0.ParameterName}}:{{0.Data}} and that works fine. But sometimes there are more or fewer values.

Am I doing something wrong?

---

<div class="post-metadata">

**Author:** ![particle7888](https://avatars.discourse-cdn.com/v4/letter/p/858c86/32.png) [@particle7888](https://community.particle.io/u/particle7888)\
**Post date:** [October 9, 2020, 7:08am UTC](https://community.particle.io/t/webhook-template-issue/57987/2 "2020-10-09T07:08:39Z")

</div>

Hi @jed,

Just to find out more details, could you elaborate on the commands used to input / perform the webhook? Please share your curl or API commands. Thanks.

KT  
Particle Technical Support

---

<div class="post-metadata">

**Author:** ![rickkas7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rickkas7/32/8681_2.png) [@rickkas7](https://community.particle.io/u/rickkas7)\
**Post date:** [October 9, 2020, 10:33am UTC](https://community.particle.io/t/webhook-template-issue/57987/3 "2020-10-09T10:33:26Z")

</div>

It appears that it is not possible to parse a top-level array that is returned in the message body of a webhook.

This syntax

```auto
{{#.}}{{ParameterName}}:{{Data}}
{{/.}}

```

is correct. However, I believe it fails to work because in addition to the variables in the webhook response, the built-in variables like `SPARK_EVENT_NAME` are also available, and they are mixed together using `Object.assign()`. This means the top-level is no longer an array, it’s an object, with a weird mix of key/value pairs and array elements. But since it’s no longer an actual array, it can’t be iterated using `{{#}}`.

I wasn’t able to think of a reasonable work-around to this.

---

<div class="post-metadata">

**Author:** ![jed](https://avatars.discourse-cdn.com/v4/letter/j/34f0e0/32.png) [@jed](https://community.particle.io/u/jed)\
**Post date:** [October 9, 2020, 7:13pm UTC](https://community.particle.io/t/webhook-template-issue/57987/4 "2020-10-09T19:13:47Z")

</div>

I figured it was something like that. Shoot.

It appears that it’s valid to start a JSON string with square brackets (and some other tokens besides curly brackets). Should this be reported as a bug?
