Hi,
I am using webhook to call API, the problem is the URL value is cutting off if it contains '&' in it.
Example Json Template:
PersonId={{lead.Id:default=edit me}}&ContactCreated= {{lead.Created At:default=edit me}}&ContactModified= {{lead.Updated At:default=edit me}}&FormURL= {{lead.Form URL:default=edit me}}
URL value = https://www.abc.com/sampletext/?value1=xxxx&value2=yyy&value3=zzzz
In this URL, the value is cutting off after first Amberson occurs, like (https://www.abc.com/sampletext/?value1=xxxx).
Is there a solution to handle URL values.?
Solved! Go to Solution.
Thanks Sanford.
Updated request encoding to Form/URL and template format with double quotes. It was working Fine.
Please show screenshots of
- the full webhook definition (in Admin)
- the activity detail (click the activity ID to open the detail) for the Call Webhook activity in a lead's Activity Log
Make sure to capture the entire popup in the screenshot (expand or scroll as necessary).
In webhook payload request we are having the correct url, but when the request payload is passed to API, the payload is converted into class(object) where the url is cut off after '&' (Amberson).
PFB the screenshot of webhook and activity log
don't you have to 'escape' the character in json? I believe you just put /& instead?
You don't have to escape "&" in JSON. It's not JSON, though. It's being passed as Form/Url encoding (much like a query string).
what about just using HTML? & ?
Nope, not relevant in URL (URI) encoding. URL encoded ampersand is %26, but you should never be doing this yourself, just choose Form/Url in the webhook setup.
Question - I also have this same issue and changed the Set Request Encoding to Form/URL. The webhook failed and caused and error. I see there is mention of "double quotes" in the template area. Is this needed and if so, where exactly are these to be placed? Around what sections of the template code? Can someone post an example for me, please? Thanks.
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.
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?
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
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.
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!
Set Request Encoding to Form/URL, not JSON. Your payload is clearly not JSON.
Thanks Sanford.
Updated request encoding to Form/URL and template format with double quotes. It was working Fine.