Skip to content

Instantly share code, notes, and snippets.

@leenyburger
Last active August 28, 2025 07:51
Show Gist options
  • Select an option

  • Save leenyburger/a9af889bc798383372f8cbd52f9ead48 to your computer and use it in GitHub Desktop.

Select an option

Save leenyburger/a9af889bc798383372f8cbd52f9ead48 to your computer and use it in GitHub Desktop.
Pipedream code for Apollo enrichment + PB automated messages
import axios from "axios";
export default defineComponent({
async run({ steps, $ }) {
const { email, first_name, last_name, how_did_you_find_us } = steps.trigger.event;
if (!email) {
throw new Error("Missing email in request");
}
// Apollo enrichment
let linkedin_url = null;
let twitter_url = null;
let person = null;
try {
const apolloResp = await axios.post(
"https://api.apollo.io/api/v1/people/match",
{ email, first_name, last_name },
{
headers: {
"Content-Type": "application/json",
"X-Api-Key": process.env.APOLLO_API_KEY,
},
}
);
person = apolloResp.data?.person;
linkedin_url = person?.linkedin_url || null;
twitter_url = person?.twitter_url || null;
} catch (err) {
console.log("Apollo enrichment failed:", err.message);
}
// Trigger PhantomBuster if LinkedIn exists
if (linkedin_url) {
try {
await axios.post(
`https://api.phantombuster.com/api/v2/agents/launch`,
{
argument: {
inputType: "profileUrl",
profileUrl: linkedin_url,
message:
"Hey! Thanks for signing up for Simple File Upload. I'm the founder (and a real human) – if you ever need help, just let me know!",
sessionCookie: process.env.SESSION_COOKIE,
},
id: process.env.ID,
},
{
headers: {
"X-Phantombuster-Key-1": process.env.PHANTOMBUSTER_API_KEY,
accept: "application/json",
},
}
);
} catch (err) {
console.log("PhantomBuster error:", err.message);
}
}
// Always return status + any enrichment info
return {
status: "Processed",
email,
first_name,
last_name,
linkedin_url,
twitter_url,
how_did_you_find_us
};
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment