Skip to content

Commit 9824fda

Browse files
authored
New Components - heylibby (#17015)
* new components * pnpm-lock.yaml * update
1 parent 3761214 commit 9824fda

File tree

6 files changed

+126
-6
lines changed

6 files changed

+126
-6
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import heylibby from "../../heylibby.app.mjs";
2+
3+
export default {
4+
key: "heylibby-list-qualified-leads",
5+
name: "List Qualified Leads",
6+
description: "List qualified leads.",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
heylibby,
11+
},
12+
async run({ $ }) {
13+
const response = await this.heylibby.listQualifiedLeads({
14+
$,
15+
});
16+
$.export("$summary", `Successfully listed ${response.length} qualified lead${response.length === 1
17+
? ""
18+
: "s"}`);
19+
return response;
20+
},
21+
};

components/heylibby/heylibby.app.mjs

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,27 @@
1+
import { axios } from "@pipedream/platform";
2+
13
export default {
24
type: "app",
35
app: "heylibby",
46
propDefinitions: {},
57
methods: {
6-
// this.$auth contains connected account data
7-
authKeys() {
8-
console.log(Object.keys(this.$auth));
8+
_baseUrl() {
9+
return "https://3wsq3v2kgg.execute-api.us-east-1.amazonaws.com/prod/zapier/trigger";
10+
},
11+
_makeRequest({
12+
$ = this, params = {}, ...opts
13+
}) {
14+
return axios($, {
15+
url: this._baseUrl(),
16+
params: {
17+
...params,
18+
zapierAPI: this.$auth.api_key,
19+
},
20+
...opts,
21+
});
22+
},
23+
listQualifiedLeads(opts = {}) {
24+
return this._makeRequest(opts);
925
},
1026
},
1127
};

components/heylibby/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/heylibby",
3-
"version": "0.0.1",
3+
"version": "0.1.0",
44
"description": "Pipedream HeyLibby Components",
55
"main": "heylibby.app.mjs",
66
"keywords": [
@@ -11,5 +11,8 @@
1111
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
1212
"publishConfig": {
1313
"access": "public"
14+
},
15+
"dependencies": {
16+
"@pipedream/platform": "^3.1.0"
1417
}
15-
}
18+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import heylibby from "../../heylibby.app.mjs";
2+
import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform";
3+
import sampleEmit from "./test-event.mjs";
4+
5+
export default {
6+
key: "heylibby-new-qualified-lead-created",
7+
name: "New Qualified Lead Created",
8+
description: "Emit new event when a new qualified lead is created.",
9+
version: "0.0.1",
10+
type: "source",
11+
dedupe: "unique",
12+
props: {
13+
heylibby,
14+
db: "$.service.db",
15+
timer: {
16+
type: "$.interface.timer",
17+
default: {
18+
intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL,
19+
},
20+
},
21+
},
22+
methods: {
23+
_getLastTs() {
24+
return this.db.get("lastTs") || 0;
25+
},
26+
_setLastTs(ts) {
27+
this.db.set("lastTs", ts);
28+
},
29+
generateMeta(lead) {
30+
return {
31+
id: lead.id,
32+
summary: `New Lead ID: ${lead.id}`,
33+
ts: Date.parse(lead.datetime),
34+
};
35+
},
36+
},
37+
async run() {
38+
const lastTs = this._getLastTs();
39+
let maxTs = lastTs;
40+
const leads = await this.heylibby.listQualifiedLeads();
41+
if (!leads?.length) {
42+
return;
43+
}
44+
for (const lead of leads) {
45+
const ts = Date.parse(lead.datetime);
46+
if (ts > lastTs) {
47+
const meta = this.generateMeta(lead);
48+
this.$emit(lead, meta);
49+
maxTs = Math.max(maxTs, ts);
50+
}
51+
}
52+
this._setLastTs(maxTs);
53+
},
54+
sampleEmit,
55+
};
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
export default {
2+
"id": "f5652b14-80aa-4cfb-82e9-688d7d373209",
3+
"summary": "Not enough information for a summary.",
4+
"name": null,
5+
"email": null,
6+
"phone": "",
7+
"streetAddress": null,
8+
"city": null,
9+
"state": null,
10+
"zipCode": null,
11+
"country": null,
12+
"qualification": "qualified",
13+
"nextStep": "Recommend follow-up email",
14+
"status": "New",
15+
"htmlChat": "<ul><li>assistant: Hi, I'm the AI assistant.</li></ul>",
16+
"chat": "• assistant: Hi, I'm the AI assistant.\n",
17+
"datetime": "2025-06-05T19:52:54.388Z",
18+
"channel": "phone",
19+
"leftVoicemail": false,
20+
"sentLinks": null
21+
}

pnpm-lock.yaml

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)