Pipedream Integration
Build serverless automation workflows with SearchHive and Pipedream. Create event-driven, scalable integrations that respond to web data changes in real-time.
Serverless Components
Pre-built SearchHive components for instant integration
Event-Driven Architecture
React to web data changes in real-time
Developer Experience
Code-first platform with powerful abstractions
What you'll build
Setup Instructions
Configure SearchHive as a custom app in Pipedream for reusable authentication and methods.
SearchHive App Configuration
// searchhive.app.mjs
export default {
type: "app",
app: "searchhive",
propDefinitions: {
query: {
type: "string",
label: "Search Query",
description: "Enter your search query",
},
maxResults: {
type: "integer",
label: "Max Results",
description: "Maximum number of results (1-50)",
min: 1,
max: 50,
default: 10,
}
},
methods: {
_baseUrl() {
return "https://www.searchhive.dev/api";
},
_headers() {
return {
"Authorization": "Bearer " + this.$auth.api_key,
"Content-Type": "application/json",
};
},
async _makeRequest({ $ = this, path, ...opts }) {
return await axios($, {
url: this._baseUrl() + path,
headers: this._headers(),
...opts,
});
},
async search(opts = {}) {
return await this._makeRequest({
method: "POST",
path: "/v1/swiftsearch",
...opts,
});
},
async scrape(opts = {}) {
return await this._makeRequest({
method: "POST",
path: "/v1/scrapeforge",
...opts,
});
},
async research(opts = {}) {
return await this._makeRequest({
method: "POST",
path: "/v1/deepdive",
...opts,
});
},
},
};
Authentication Setup:
- Create new app in Pipedream Apps directory
- Add API key authentication method
- Define reusable methods for all SearchHive APIs
- Test connection with sample requests
Create reusable components for each SearchHive API that can be used across workflows.
SwiftSearch Component
import { axios } from "@pipedream/platform";
export default defineComponent({
name: "SearchHive SwiftSearch",
description: "Search the web with enhanced results using SearchHive",
version: "0.1.0",
type: "action",
props: {
searchhive: {
type: "app",
app: "searchhive",
},
query: {
type: "string",
label: "Search Query",
description: "The search query to execute",
},
maxResults: {
type: "integer",
label: "Max Results",
description: "Maximum number of results to return",
default: 10,
min: 1,
max: 50,
},
autoScrape: {
type: "boolean",
label: "Auto Scrape",
description: "Automatically scrape result pages",
default: false,
},
extractContacts: {
type: "boolean",
label: "Extract Contacts",
description: "Extract contact information from results",
default: false,
},
},
async run({ steps, $ }) {
const { query, maxResults, autoScrape, extractContacts } = this;
const response = await axios($, {
method: "POST",
url: "https://www.searchhive.dev/api/v1/swiftsearch",
headers: {
"Authorization": "Bearer " + this.searchhive.$auth.api_key,
"Content-Type": "application/json",
},
data: {
query,
max_results: maxResults,
auto_scrape: autoScrape,
extract_contacts: extractContacts,
},
});
$.export("$summary", `Found ${response.data.search_results?.length || 0} results for "${query}"`);
return response.data;
},
});
Component Benefits
Reusable across workflows, built-in validation, consistent error handling, and shared authentication.
Publishing
Publish to Pipedream registry for community use or keep private for your organization.
SearchHive Component Library
Enhanced web search with real-time results.
Extract content from any webpage or document.
AI-powered research and analysis.
Advanced Workflow Example
Here's a complete serverless workflow that demonstrates intelligent lead generation with multiple SearchHive APIs.
Intelligent Lead Generation Pipeline
import { defineComponent } from "@pipedream/platform";
export default defineComponent({
name: "Lead Generation Pipeline",
description: "Automated lead discovery and CRM integration",
version: "0.1.0",
async run({ steps, $ }) {
// Step 1: Search for companies
const searchResults = await this.searchhive.search({
query: "construction companies Seattle",
maxResults: 20,
extractContacts: true,
});
// Step 2: Filter valid leads
const validLeads = searchResults.search_results.filter(result =>
result.contact_info?.email &&
!result.contact_info.email.includes('noreply')
);
// Step 3: Enrich with additional data
const enrichedLeads = await Promise.all(
validLeads.map(async (lead) => {
const scrapeResult = await this.searchhive.scrape({
url: lead.link,
extractOptions: ["title", "text", "metadata"]
});
return {
...lead,
company_size: this.extractCompanySize(scrapeResult.primary_content?.text),
technology_stack: this.extractTechStack(scrapeResult.primary_content?.text),
scraped_at: new Date().toISOString(),
};
})
);
// Step 4: Add to CRM
const crmResults = await Promise.all(
enrichedLeads.map(async (lead) => {
return await this.hubspot.createContact({
email: lead.contact_info.email,
company: lead.title,
website: lead.link,
phone: lead.contact_info.phone,
lead_source: "SearchHive Automation",
company_size: lead.company_size,
});
})
);
// Step 5: Send notification
await this.slack.sendMessage({
channel: "#sales",
text: `🎯 Found ${enrichedLeads.length} new qualified leads in construction industry`,
attachments: [{
color: "good",
fields: [
{
title: "Companies Found",
value: enrichedLeads.length.toString(),
short: true
},
{
title: "With Contact Info",
value: enrichedLeads.filter(l => l.contact_info?.email).length.toString(),
short: true
}
]
}]
});
$.export("$summary", `Processed ${enrichedLeads.length} leads successfully`);
return {
leads: enrichedLeads,
crm_results: crmResults,
processed_at: new Date().toISOString()
};
},
extractCompanySize(text) {
if (!text) return "Unknown";
const sizeIndicators = {
"startup": ["startup", "founded", "early stage"],
"small": ["small business", "10-50 employees", "team of"],
"medium": ["growing company", "50-200 employees", "established"],
"large": ["enterprise", "500+ employees", "fortune", "publicly traded"]
};
for (const [size, indicators] of Object.entries(sizeIndicators)) {
if (indicators.some(indicator => text.toLowerCase().includes(indicator))) {
return size;
}
}
return "Unknown";
},
extractTechStack(text) {
if (!text) return [];
const technologies = ["WordPress", "React", "Angular", "Vue", "Shopify", "Salesforce", "HubSpot"];
return technologies.filter(tech =>
text.toLowerCase().includes(tech.toLowerCase())
);
}
});
Serverless Benefits
Event-Driven Triggers
Create triggers that monitor web data and automatically execute workflows when conditions are met.
SearchHive Monitoring Trigger
export default defineComponent({
name: "SearchHive Webhook Trigger",
description: "Trigger workflow when SearchHive finds new results",
version: "0.1.0",
type: "source",
dedupe: "unique",
props: {
http: {
type: "$.interface.http",
customResponse: true,
},
searchhive: {
type: "app",
app: "searchhive",
},
query: {
type: "string",
label: "Search Query",
description: "Query to monitor for new results",
},
checkInterval: {
type: "integer",
label: "Check Interval (minutes)",
description: "How often to check for new results",
default: 60,
min: 5,
},
},
hooks: {
async activate() {
// Store the last check timestamp
this.db.set("lastCheck", Date.now());
},
},
async run({ body, headers }) {
const lastCheck = this.db.get("lastCheck") || 0;
const now = Date.now();
// Only run if enough time has passed
if (now - lastCheck < this.checkInterval * 60 * 1000) {
return;
}
try {
const results = await this.searchhive.search({
query: this.query,
maxResults: 20,
});
// Filter results newer than last check
const newResults = results.search_results.filter(result => {
const resultDate = new Date(result.date || 0).getTime();
return resultDate > lastCheck;
});
if (newResults.length > 0) {
this.db.set("lastCheck", now);
this.$emit({
query: this.query,
new_results: newResults,
total_found: newResults.length,
timestamp: new Date().toISOString(),
}, {
id: `${this.query}-${now}`,
summary: `Found ${newResults.length} new results for "${this.query}"`,
ts: now,
});
}
} catch (error) {
console.error("SearchHive trigger error:", error);
}
},
});