openai_enrichment
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in miliseconds.
index.ts
https://stevekrouse--c0a859303fd611f0aa5d76b3cceeab13.web.val.run
An HTTP endpoint that enriches person data using OpenAI's web search capabilities. Provide basic information about a person (email, name, etc.) and get back comprehensive research about them.
- Set your OpenAI API key as an environment variable:
OPENAI_API_KEY
- The API uses the
gpt-4o-search-preview
model with web search capabilities
- Method: POST
- Content-Type: multipart/form-data
The API accepts form data with the following fields:
email
(optional): Person's email addressname
(optional): Person's full namecompany
(optional): Company namelinkedin
(optional): LinkedIn profile URLtwitter
(optional): Twitter profile URLwebsite
(optional): Personal or company website URL
Note: At least one field is required. You can provide any combination of the above fields as form data.
{ "success": true, "data": { "summary": "Brief overview of the person", "professional_background": "Career history and education", "current_role": "Current position and responsibilities", "company_info": "Information about their company", "recent_activities": "Recent news and projects", "social_presence": "Online presence and thought leadership", "achievements": "Notable accomplishments", "sources": ["https://example.com", "LinkedIn profile", "..."] } }
{ "success": false, "error": "Error description" }
Common Error Cases:
405 Method Not Allowed
: Only POST requests are accepted400 Bad Request
: No identifiers provided (at least one field required)500 Internal Server Error
: OpenAI API error or processing failure
curl -X POST https://your-val-url.web.val.run \ -F "email=elon@tesla.com" \ -F "name=Elon Musk"
const formData = new FormData();
formData.append('email', 'person@example.com');
formData.append('name', 'John Doe');
const response = await fetch('https://your-val-url.web.val.run', {
method: 'POST',
body: formData
});
const data = await response.json();
console.log(data);
<form action="https://your-val-url.web.val.run" method="POST"> <input type="email" name="email" placeholder="Email address"> <input type="text" name="name" placeholder="Full name"> <input type="text" name="company" placeholder="Company"> <input type="url" name="linkedin" placeholder="LinkedIn URL"> <input type="url" name="twitter" placeholder="Twitter URL"> <input type="url" name="website" placeholder="Website URL"> <button type="submit">Research Person</button> </form>
- Web Search Integration: Uses OpenAI's
gpt-4o-search-preview
model with web search capabilities - Form Data Support: Accepts standard HTML form submissions and FormData objects
- Comprehensive Research: Provides structured information across multiple categories
- Flexible Input: Accepts various identifiers (email, name, social profiles, etc.)
- Source Attribution: Returns sources where information was found
- Error Handling: Graceful error handling with descriptive messages
- Method Validation: Only accepts POST requests for security
This tool is designed for legitimate business purposes such as:
- Sales prospecting and lead qualification
- Partnership research
- Due diligence for business relationships
- Professional networking
Please ensure you comply with:
- GDPR and other privacy regulations
- Your organization's data handling policies
- Ethical guidelines for data collection and use
- Terms of service of the platforms being researched
The API is subject to OpenAI's rate limits for the gpt-4o-search-preview
model. Consider implementing your own rate limiting if needed for production use.