Fun Fact Friday: GOTCHA! Webhooks and Revenge of the Rich Text

Michaela_Iery3
Marketo Employee
Marketo Employee

I recently encountered an issue where a webhook I was working with kept failing. The lead fields I was passing over in the webhook via tokens I knew were correct, yet the webhook continued to fail.

Here is part of the webhook payload:

&first_name={{lead.First Name}}&last_name={{lead.Last Name}}&country={{lead.Country}}&email={{lead.Email Address}}&parent_email={{lead.Parent’s Email}}

Did you spot the issue? It’s very, very subtle.

Okay, let me put it like this – do you see a difference between these two values?

lead.Parents Email

lead.Parent's Email

Yep, it’s that seemingly innocuous “curly” apostrophe in the first value. What Microsoft likes to call a “smart” apostrophe versus a straight one. Guess what? It’s a unique character compared with a straight quote, and one that many data systems can’t read/process. When the webhook was built, it had been built in a Word document and then copy/pasted into the webhook payload template in Marketo. And since it came from Word, Word automatically turned the apostrophe curly.

If you’re building webhooks, be sure to copy/paste from Notepad or a similar plain text program. Better yet? When it comes to data, apostrophes and punctuation is generally best avoided if you can.

1522
2
2 Comments
Grégoire_Miche2
Level 10

Visually, one can see that the interval is not exactly the same:

pastedImage_0.png

But honestly, if you had not pointed into the direction, I probably could have spent one hour and missed it

Thanks

Greg

SanfordWhiteman
Level 10 - Community Moderator

Like you said in your last sentence, the real error here was attempting to represent an apostrophe at all in the name of a field.

The straight quote (') is actually more problematic than the curly quote-as-apostrophe (’) in data processing scenarios, because the straight quote has a reserved use in many programming languages -- quoting literal values.

The curly quote is the correct way to represent an apostrophe (this is dictated in the Unicode standard):

pastedImage_3.png

So if the system supports Unicode for the value in question, the curly quote is correct and unambiguous, as no systems use curly quotes as reserved chars. In JavaScript, for example, this is a perfectly permissible property name:

     lead['My Parent’s Email']

And this ensures that you don't have to continually escape the quote:

     lead['My Parent\'s Email']

Of course the problem is that when repeatedly entering data you usually use an ASCII keyboard, so you want to choose something that is easy to type.  And so the problem recurs in perpetuity throughout the universe.

Just adding a little color for later readers.