Good morning everyone! I am very close to having my Hunter.io ready to go! WAHOO!
The pack will find the most likely email for a prospect given their first and last name and the domain of their employer.
Here is the API - Hunter's API Reference V2.
The GET request returns a good chunk of data but I am really only interested in the “email” and the “score.” I am currently just returning the response as a string but it is time to get into Schemas/Objects in Coda!
I have defined the Schema as this:
const EmailSchema = coda.makeObjectSchema({
properties: {
email: {
description: "Most likely email",
type: coda.ValueType.String,
codaType: coda.ValueHintType.Email,
},
score: {
description: "How certain we are.",
type: coda.ValueType.String,
},
},
displayProperty: "email",
});
I currently have the response formatted like this:
execute: async function ([first_name, last_name, domain,api_key], context) {
let url = coda.withQueryParams("https://api.hunter.io/v2/email-finder", {
domain: domain,
first_name: first_name,
last_name: last_name,
api_key: api_key,
});
let response = await context.fetcher.fetch({
method: "GET",
url: url,
});
return response.body;
},
resultType: coda.ValueType.String
});
My question is what is the most elegant way to only return both the “email” and “score” value?