Lead generation: Get the name and email of people with 'job title' at 'company'. Use Mattermark and Hunter.io APIs

Hey Sales&Marketing folks!

Want to generate leads and find the right people in companies without manually searching LinkedIn? :cold_sweat:

It’s pretty easy with the Mattermark API. You search for company name and the job title you want, and it’ll give you the names of people. With the right names, you can use Hunter.io to get the right email address. :raised_hands:

This is how the app might look like:

Columns marked blue contain input cells. Here are the important steps:
1) Get company ID:

C4: =GET("https://api.mattermark.com/search?term="&A4&"&object_types=company&key="&$B$1)
D4: =PARSE(C4,"[0].object_id")

This is simply to identify the company for the next request. Note that depending on the clarity of the search term provided in A4, there might be more results, and the company you are looking for might not be the first hit, although Mattermark in general does a good ranking job. If you need the second or third result, you have to edit the “[0]” in the formula in D4.

2) Get employees in that company

E4: =GET("https://api.mattermark.com/companies/"&D4&"/people",'{"Authorization ": "Bearer '&$B$1&'"}')
F4: =PARSE(E4,'[*][?(@.title == "'&B4&'")]')

The response in cell E4 can contain a lot of employees with their “name”, “title”, and “path”, the latter being a LinkedIn link to their profile. Now you want to check for titles that match your search term in B4. Note that the PARSE in F4 checks for equal titles to the search term. This can still be extended for titles that include a certain search term, so that the value in F4, for instance, returns “Marketing Manager”, “Online Marketing Manager”, “Chief Marketing Officer”, etc. for the search term “Marketing”. If you want that, just adapt the formula in F4, using JSON Query Language, to =PARSE(E4,'[*][?(@.title =~ /.*'&B4&'.*/i)]').

3) Get employee name

G4: =PARSE(F4,"length()")
I4: =PARSE(F4,'['&H4&'].name')
J4: =LEFT(I4,FIND(" ",I4,1)-1)
K4: =RIGHT(I4,LEN(I4)-FIND(" ",I4,1))

The formula in G4 tells you how many employees match your search term in B4. You can manually go through the names in H4 (count starts on 0, so if there are 2 results in G4, you can select 0 and 1). I4 then displays the full name.

4) Get email address

L4: =PARSE(C4,"[0].company_domain")
N4: =PARSE(M4,"data.email")

Now, you want the email address for this person. For this, we use our Hunter.io integration. In L4, we still get the domain name for the company from the JSON in C4, which we need as an input. We send the request in M4 and parse the email address in N4. Easy! :triumph:

Alternatively, you can use GET to communicate with the Hunter.io API: