Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import heylibby from "../../heylibby.app.mjs";

export default {
key: "heylibby-list-qualified-leads",
name: "List Qualified Leads",
description: "List qualified leads.",
version: "0.0.1",
type: "action",
props: {
heylibby,
},
async run({ $ }) {
const response = await this.heylibby.listQualifiedLeads({
$,
});
$.export("$summary", `Successfully listed ${response.length} qualified lead${response.length === 1
? ""
: "s"}`);
return response;
},
};
22 changes: 19 additions & 3 deletions components/heylibby/heylibby.app.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
import { axios } from "@pipedream/platform";

export default {
type: "app",
app: "heylibby",
propDefinitions: {},
methods: {
// this.$auth contains connected account data
authKeys() {
console.log(Object.keys(this.$auth));
_baseUrl() {
return "https://3wsq3v2kgg.execute-api.us-east-1.amazonaws.com/prod/zapier/trigger";
},
_makeRequest({
$ = this, params = {}, ...opts
}) {
return axios($, {
url: this._baseUrl(),
params: {
...params,
zapierAPI: this.$auth.api_key,
},
...opts,
});
},
listQualifiedLeads(opts = {}) {
return this._makeRequest(opts);
},
},
};
7 changes: 5 additions & 2 deletions components/heylibby/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/heylibby",
"version": "0.0.1",
"version": "0.1.0",
"description": "Pipedream HeyLibby Components",
"main": "heylibby.app.mjs",
"keywords": [
Expand All @@ -11,5 +11,8 @@
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^3.1.0"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import heylibby from "../../heylibby.app.mjs";
import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform";
import sampleEmit from "./test-event.mjs";

export default {
key: "heylibby-new-qualified-lead-created",
name: "New Qualified Lead Created",
description: "Emit new event when a new qualified lead is created.",
version: "0.0.1",
type: "source",
dedupe: "unique",
props: {
heylibby,
db: "$.service.db",
timer: {
type: "$.interface.timer",
default: {
intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL,
},
},
},
methods: {
_getLastTs() {
return this.db.get("lastTs") || 0;
},
_setLastTs(ts) {
this.db.set("lastTs", ts);
},
generateMeta(lead) {
return {
id: lead.id,
summary: `New Lead ID: ${lead.id}`,
ts: Date.parse(lead.datetime),
};
},
},
async run() {
const lastTs = this._getLastTs();
let maxTs = lastTs;
const leads = await this.heylibby.listQualifiedLeads();
if (!leads?.length) {
return;
}
for (const lead of leads) {
const ts = Date.parse(lead.datetime);
if (ts > lastTs) {
const meta = this.generateMeta(lead);
this.$emit(lead, meta);
maxTs = Math.max(maxTs, ts);
}
}
this._setLastTs(maxTs);
},
sampleEmit,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
export default {
"id": "f5652b14-80aa-4cfb-82e9-688d7d373209",
"summary": "Not enough information for a summary.",
"name": null,
"email": null,
"phone": "",
"streetAddress": null,
"city": null,
"state": null,
"zipCode": null,
"country": null,
"qualification": "qualified",
"nextStep": "Recommend follow-up email",
"status": "New",
"htmlChat": "<ul><li>assistant: Hi, I'm the AI assistant.</li></ul>",
"chat": "• assistant: Hi, I'm the AI assistant.\n",
"datetime": "2025-06-05T19:52:54.388Z",
"channel": "phone",
"leftVoicemail": false,
"sentLinks": null
}
34 changes: 26 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading