Map entire Webhook Response in Marketo Webhook

164 views Asked by At

I have a web-hook that calls an API that returns a single plain text response. The response isn't formatted in JSON or xml because the response is a single piece of data, not a map or array. I see plenty of examples of how to extract a field from a JSON response and store it in a marketo token but no example of how to store the whole response payload. Here is a sample response from the API:

alsdfjasdhfalksdhfalksdjalksdk

Note that the response is not anything like this:

{
"field":"alsdfjasdhfalksdhfalksdjalksdk"
}

Maybe some Marketo expert has done this and could share. I'd appreciate it, thanks.

1

There are 1 answers

0
Casey Grimes On

Marketo's parsing of XML and JSON is limited, to say the least--so your webhook does need to declare some sort of key-value pair so the response can be mapped. Given what you're describing, you could likely just hardcode in the surrounding JSON with the right MIME type and be fine.

Basically, Marketo can only handle the following for JSON webhook responses:

  • Key-value pair
  • Key can only be defined by placement (no XPath or similar--you'd be stuck with field[1] or similar)
  • Ideally no nesting, as Marketo doesn't do a great job of reading nested data--largely for the reason mentioned above