Twilio offers a pretty awesome Lookup API to enrich phone numbers with metadata: it can distinguish mobile and landline numbers (Sales will thank you!), determine carrier (which has demographic significance, like it or not), and even do reverse Caller ID lookup.
It's reasonably priced, and if anyone knows this stuff, it's Twilio.
The weird thing is that even though the Lookup API is 100% webhook-compatible, their docs don't show it being called as a simple webhook request. They only show it in the context of Java, PHP, or other code.
Anyway, here's what's needed to call it as a webhook.
Lookup requests are authenticated using HTTP Basic Auth. Your Twilio Account SID is the username; your Account Token is the password.
So you just need to create an HTTP
Authorization header and then add it to the webhook definition in Marketo. (Marketo supports Basic Auth just fine, but it doesn't present you with distinct username and password boxes.)
Authorization header for Basic auth looks like
Authorization: Basic <base64(<username>:<password>)>
<base64(<username>:<password>)> means very simply
- concatenate the username and the password with a colon
- Base64-encode the concatenated string
You can Base64-encode easily in your browser's Dev Tools Console (F12) using the JS function
btoa (stands for "Binary to ASCII" if you don't know).
If my SID were
abc123 and my token were
def456, here's how to generate the Base64 string:
Then I take the result (it's
YWJjMTIzOmRlZjQ1Ng== by the way) and add it to a Custom Header when setting up the 'hook.
The Marketo Admin » New Webhook (or Edit Webhook) form:
And the Custom Header form (Webhooks Actions » Set Custom Header):
That's it. Now you can get some cool enrichment on your phone numbers (of course you have to add webhook Response Mappings… I'll leave that part to you!).