Camden S.
Camden S.

Reputation: 2245

Zapier Webhooks Posting Json Array

I'm having trouble getting Zapier's webhooks to post a true JSON array.

I want the webhook post data to be like this:

{
    "attachments": [
    {
        "color": "danger",
        "fallback": "My fallback text is here", 
        "title": "My Title is here",
        "text":" foo"
    }
    ]
}

But all I can get is this (notice the missing "[", and "]"). How can I get a properly formatted JSON array from Zapier's webhooks?

{
"attachments": 
    {
    "color": "danger", 
    "text": "foo", 
    "fallback": "My fallback text is here", 
    "title": "My Title is here"
    }
}

Here is what my Zapier Webhook configuration looks like:

enter image description here

Upvotes: 6

Views: 8061

Answers (1)

Juan Vazquez
Juan Vazquez

Reputation: 543

The default Webhooks > "POST" action coerces the payload values (including those that look like arrays) to strings, so you can't send an array value this way.

Instead of the "POST" action, you should use the "Custom Request" action.

This action allows you to specify the raw JSON payload. You can insert fields from previous steps anywhere in the object literal as long as the JSON syntax is good.

Upvotes: 11

Related Questions