File tree Expand file tree Collapse file tree 5 files changed +118
-5
lines changed
actions/list-qualified-leads
sources/new-qualified-lead-created Expand file tree Collapse file tree 5 files changed +118
-5
lines changed Original file line number Diff line number Diff line change 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+ } ;
Original file line number Diff line number Diff line change 1+ import { axios } from "@pipedream/platform" ;
2+
13export 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} ;
Original file line number Diff line number Diff line change 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" : [
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+ }
Original file line number Diff line number Diff line change 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+ for ( const lead of leads ) {
42+ const ts = Date . parse ( lead . datetime ) ;
43+ if ( ts > lastTs ) {
44+ const meta = this . generateMeta ( lead ) ;
45+ this . $emit ( lead , meta ) ;
46+ maxTs = Math . max ( maxTs , ts ) ;
47+ }
48+ }
49+ this . _setLastTs ( maxTs ) ;
50+ } ,
51+ sampleEmit,
52+ } ;
Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments