There are many reasons why you would want to find someone's email address online.
May be you want to reach out, to secure a sale or even propose a partnership.
For This article we are going to find a LinkedIn user's email using Personal look up endpoint of Contact API provided by Proxycurl.
Note: Contact API is not intended for front-end use. To avoid
cors
policy, in this article we are going to use a middleman proxy server.
Content
- Prerequisite
- Get a Proxycurl API key
- Proxy server with node.js
- Fetch LinkedIn email from proxy server
- Conclusion
I. Prerequisite
To follow this article you need to be familiar with javascript ,Node js
and express
.
Plus, you must have a Proxycurl account to get an API key
.
II. Get a Proxycurl API key
To get a proxycurl API key we need first to create an account ,that is free, in addition Proxycurl will provide 10 free credits that can be used for testing.
II.1. Create Proxycurl account
To create create an account let's go to Proxycurl registration page and complete the form.
After completing the form click on continue, then confirm the email address.
II.2. Generate Proxycurl API key
After the registration process is well done, login, then click generate Key
III. Proxy server with node.js
Proxy servers act as middlemen, communicating your needs and requests without providing your information to the internet. Proxies can also allow you to bypass certain security blocks and allow you to access information that might otherwise be blocked. This is made possible through use a proxy server that does not reveal your personal IP address.
Find more about proxy server in node js here.
Now let's go ahead and create our server.
First, we must initialize our project to generate our package.json
file:
npm init
Next we must install two dependencies:
express
http-proxy-middleware
After, let's create a index.js
and emailFinder.proxy.js
file, our project structure looks like:
Project
|
|--- nodes_modules
|--- emailFinder.proxy.js
|--- index.js
|--- package-lock.json
|--- package.json
In index.js
let's write the following code:
const express = require("express");
const app = express();
const PORT = 4040;
app.listen(PORT, () => console.log("Proxy is running on PORT " + PORT));
Here we are initializing our server with express
, setting the port on 4040
.
To get the email from LinkedIn using Proxycurl's Contact API
we need :
- The API endpoint :
https://nubela.co/proxycurl/api/contact-api/personal-email
- The API key that we generated
- The LinkedIn profile url we want to have the email address
That noted, in emailFinder.proxy.js
let's write the following code as well :
const Router = require("express");
const { createProxyMiddleware } = require("http-proxy-middleware");
const router = Router();
const endpoint = "https://nubela.co/proxycurl/api/contact-api/personal-email"; // API endpoint
const api_key = "{api_key}"; // proxycurl api_key
const params = new URLSearchParams({
linkedin_profile_url: "https://www.linkedin.com/in/jonathan-z-0a40ab209", // linkedIn profile url that we're gonna find the email
});
router.get(
"/",
createProxyMiddleware({
target: endpoint + "?" + params,
changeOrigin: true,
onProxyReq: (proxyReq, req, res) => {
proxyReq.setHeader("Authorization", `Bearer ${api_key}`);
},
})
);
module.exports = router;
Finally , to run our server we need first to import the emailFinder.proxy.js
in index.js
and use it as a middleware.
The code in index.js
may look like :
const express = require("express");
const emailFinderProxy = require("./emailFinder.proxy");
const app = express();
app.use("/find/email", emailFinderProxy);
const PORT = 4040;
app.listen(PORT, () => console.log("Proxy is running on PORT " + PORT));
Here we are setting the endpoint that we are going to use in order to fetch the LinkedIn email.
Now the proxy server is ready, let's run it typing in terminal the following command
node index
IV. Fetch LinkedIn email from proxy server.
const enpoint = "http://localhost:4040/find/email";
fetch(enpoint, {
method: "GET",
headers: {
"Content-Type": "application/json",
accept: "application/json",
},
})
.then((res) => res.json())
.then((data) => console.log(data));
This is how the response looks like:
{
"emails": ["random@gmail.com", "random2@yahoo.com"]
}
Conclusion
Now we can find an email address from LinkedIn with only the LinkedIn profile url.
Top comments (0)