SOLVED

Webhook Json Value Cutoff Issue

Go to solution
SanfordWhiteman
Level 10 - Community Moderator

Re: Webhook Json Value Cutoff Issue

There's no one way to do this; it depends on what format/encoding the remote service (that the webhook connects to) supports.

What service are you calling?

If you post screenshots of the Activity Log Details (click the ActLog item ID, the first column) that will also show what you're sending and receiving.

Elizabeth_Rhode
Level 1

Re: Webhook Json Value Cutoff Issue

Its a RESTful wesbservice using JSON.  However Marketo is converting & in the company field.  I saw that a someone mentioned using double quotatons in the template area on the webhook.  Just wondered exactly where that should be placed.  Here is a screenshot of our template area on the webhook.  Would I just need to add quotations to everything that already has quotations in the code below?

pastedImage_0.png

SanfordWhiteman
Level 10 - Community Moderator

Re: Webhook Json Value Cutoff Issue

The payload you're showing here isn't a JSON (application/json) payload.

It's a Form/Url (x-www-form-urlencoded) payload that happens to have a single field (order) that contains stringified and URL-encoded JSON.

As such, you can't simply choose JSON as the request token encoding because the entire JSON block needs to be URL-encoded to transport data without error.

For example, if order is

{

  "OrderHeader" : {
     "CustomerID" : "xxx"

  }

}

then this is passed as

https://endpoint.example.com/username=VER&order=%7B%22OrderHeader%22%3A%7B%22CustomerID%22%3A%22xxx%...

You can't do this in a single step. You need to pass the fields to a separate 'hook and get back a single pre-JSON-encoded block, which you then store in a textarea field. Then you send that {{lead.textarea field}} in the payload to your real service, now using Form/Url encoding.

Elizabeth_Rhode
Level 1

Re: Webhook Json Value Cutoff Issue

Thank you for your response and help on this.  Sorry, if I am confusing in any way.  Just trying to gain an understanding here because I think the solution is very close at hand .  The 3rd party we are sending the webhook to has requested we URL encode the fields to accept special characters.  So, if I change the encoding to Form/URL that should fix it, right?  Or is something else needed in addition to the template code?  Thanks again!