webhook icon indicating copy to clipboard operation
webhook copied to clipboard

"entire-payload" unmarshal array

Open alesysadmin75 opened this issue 3 years ago • 1 comments

Hello everyone,

After further investigation I changed my question. I'm using "entire-payload" in my webhook.conf in order to save any incoming request from SendGrid.

[
        {
        "id": "sendgrid",
        "execute-command": "echo",
        "pass-arguments-to-command":
[
        {
        "source": "entire-headers"
        },
        {
        "source": "entire-payload"
        }
]
        }
]

But I receive 'error parsing JSON payload json: cannot unmarshal array into Go value of type map[string]interface {}' so the result is null.

What am I doing wrong?

Raw content which I should see is something like this:

[
  {
    "email": "[email protected]",
    "event": "delivered",
    "ip": "208.117.55.133",
    "response": "250 2.0.0 Ok: queued as 02E07303458",
    "sg_event_id": "ZGVsaXZlcmVdAtMTk0NzA4MTEtT1d0eFQ0dG9SWnFwX1EybGV1WXJTUS0w",
    "sg_message_id": "OWtxT4toRZqp_Q2leuYrSQ.filterdrecv-8569859b9-kd4gr-1-63A17998-5F.0",
    "smtp-id": "<OWtxT4toRZqp_Q2leuYrSQ@geopod-ismtpd-4-0>",
    "timestamp": 1671526816,
    "tls": 1
  }
]

alesysadmin75 avatar Dec 18 '22 16:12 alesysadmin75

I hit the same problem. The version of webhook installed is 2.8.1. It seems that json payload decoding does not work in case of top-level json array (the common case for this ticket, #640 and my case).

Peter2121 avatar Jun 01 '23 12:06 Peter2121