File tree Expand file tree Collapse file tree 10 files changed +230
-6
lines changed Expand file tree Collapse file tree 10 files changed +230
-6
lines changed Original file line number Diff line number Diff line change 1+ import nextlead from "../../nextlead.app.mjs" ;
2+
3+ export default {
4+ key : "nextlead-search-leads" ,
5+ name : "Search Leads" ,
6+ description : "Search for leads by email in NextLead. [See the documentation](https://dashboard.nextlead.app/en/api-documentation#find)" ,
7+ version : "0.0.1" ,
8+ type : "action" ,
9+ props : {
10+ nextlead,
11+ email : {
12+ type : "string" ,
13+ label : "Email" ,
14+ description : "The email address to search for" ,
15+ } ,
16+ } ,
17+ async run ( { $ } ) {
18+ const response = await this . nextlead . searchLeads ( {
19+ $,
20+ data : {
21+ email : this . email ,
22+ } ,
23+ } ) ;
24+ $ . export ( "$summary" , `Found ${ response . length && response [ 0 ] . found
25+ ? response . length
26+ : 0 } lead(s) for email: ${ this . email } `) ;
27+ return response ;
28+ } ,
29+ } ;
Original file line number Diff line number Diff line change 1+ import { axios } from "@pipedream/platform" ;
2+
13export default {
24 type : "app" ,
35 app : "nextlead" ,
46 propDefinitions : { } ,
57 methods : {
6- // this.$auth contains connected account data
7- authKeys ( ) {
8- console . log ( Object . keys ( this . $auth ) ) ;
8+ _baseUrl ( ) {
9+ return this . $auth . api_url ;
10+ } ,
11+ _makeRequest ( {
12+ $ = this , path, ...opts
13+ } ) {
14+ return axios ( $ , {
15+ url : `${ this . _baseUrl ( ) } ${ path } ` ,
16+ headers : {
17+ Authorization : `Bearer ${ this . $auth . api_key } ` ,
18+ } ,
19+ ...opts ,
20+ } ) ;
21+ } ,
22+ searchLeads ( opts = { } ) {
23+ return this . _makeRequest ( {
24+ path : "/receive/contact/find-contact" ,
25+ method : "POST" ,
26+ ...opts ,
27+ } ) ;
28+ } ,
29+ getNewlyCreatedLeads ( opts = { } ) {
30+ return this . _makeRequest ( {
31+ path : "/polling/contact/user-created" ,
32+ ...opts ,
33+ } ) ;
34+ } ,
35+ getNewlyUpdatedLeads ( opts = { } ) {
36+ return this . _makeRequest ( {
37+ path : "/polling/contact/user-edited" ,
38+ ...opts ,
39+ } ) ;
40+ } ,
41+ getContactsAddedToList ( opts = { } ) {
42+ return this . _makeRequest ( {
43+ path : "/polling/email/added-to-list" ,
44+ ...opts ,
45+ } ) ;
946 } ,
1047 } ,
11- } ;
48+ } ;
Original file line number Diff line number Diff line change 11{
22 "name" : " @pipedream/nextlead" ,
3- "version" : " 0.0.1 " ,
3+ "version" : " 0.1.0 " ,
44 "description" : " Pipedream Nextlead Components" ,
55 "main" : " nextlead.app.mjs" ,
66 "keywords" : [
1111 "author" :
" Pipedream <[email protected] > (https://pipedream.com/)" ,
1212 "publishConfig" : {
1313 "access" : " public"
14+ },
15+ "dependencies" : {
16+ "@pipedream/platform" : " ^3.0.3"
1417 }
15- }
18+ }
Original file line number Diff line number Diff line change 1+ import nextlead from "../../nextlead.app.mjs" ;
2+ import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform" ;
3+
4+ export default {
5+ props : {
6+ nextlead,
7+ timer : {
8+ type : "$.interface.timer" ,
9+ default : {
10+ intervalSeconds : DEFAULT_POLLING_SOURCE_TIMER_INTERVAL ,
11+ } ,
12+ } ,
13+ } ,
14+ } ;
Original file line number Diff line number Diff line change 1+ import common from "../common/base.mjs" ;
2+ import sampleEmit from "./test-event.mjs" ;
3+
4+ export default {
5+ ...common ,
6+ key : "nextlead-new-lead-added-to-list" ,
7+ name : "New Lead Added to List" ,
8+ description : "Emit new event when a lead is added to a list in NextLead. [See the documentation](https://dashboard.nextlead.app/en/api-documentation#addedToList)" ,
9+ version : "0.0.1" ,
10+ type : "source" ,
11+ dedupe : "unique" ,
12+ methods : {
13+ generateMeta ( lead ) {
14+ return {
15+ id : lead . id ,
16+ summary : "Lead Added to List" ,
17+ ts : Date . parse ( lead . created_at ) ,
18+ } ;
19+ } ,
20+ } ,
21+ async run ( ) {
22+ const leads = await this . nextlead . getContactsAddedToList ( ) ;
23+ for ( const lead of leads ) {
24+ const meta = this . generateMeta ( lead ) ;
25+ this . $emit ( lead , meta ) ;
26+ }
27+ } ,
28+ sampleEmit,
29+ } ;
Original file line number Diff line number Diff line change 1+ export default {
2+ "id" : "cmay8b4jx0001ky04yb204e5b" ,
3+ "result" : {
4+ "created_at" : "2025-05-21T17:40:39.501Z" ,
5+ "organization_id" : "cmay3tgaa0002jr04l5tga7my" ,
6+ "email" : null ,
7+ "first_name" : "Jane" ,
8+ "last_name" : "Doe" ,
9+ "phone" : null ,
10+ "address" : null ,
11+ "civility" : "NEUTRAL" ,
12+ "status" : null ,
13+ "opt_in_marketing" : true ,
14+ "opt_in_newsletter" : true
15+ }
16+ }
Original file line number Diff line number Diff line change 1+ import common from "../common/base.mjs" ;
2+ import sampleEmit from "./test-event.mjs" ;
3+
4+ export default {
5+ ...common ,
6+ key : "nextlead-new-lead-created" ,
7+ name : "New Lead Created" ,
8+ description : "Emit new event when a new lead is captured in NextLead. [See the documentation](https://dashboard.nextlead.app/en/api-documentation#created)" ,
9+ version : "0.0.1" ,
10+ type : "source" ,
11+ dedupe : "unique" ,
12+ methods : {
13+ generateMeta ( lead ) {
14+ return {
15+ id : lead . id ,
16+ summary : "New Lead Created" ,
17+ ts : Date . parse ( lead . created_at ) ,
18+ } ;
19+ } ,
20+ } ,
21+ async run ( ) {
22+ const leads = await this . nextlead . getNewlyCreatedLeads ( ) ;
23+ for ( const lead of leads ) {
24+ const meta = this . generateMeta ( lead ) ;
25+ this . $emit ( lead , meta ) ;
26+ }
27+ } ,
28+ sampleEmit,
29+ } ;
Original file line number Diff line number Diff line change 1+ export default {
2+ "id" : "cmay7x5ou0001k10442mgpngp" ,
3+ "type" : "CLIENT" ,
4+ "civility" : "NEUTRAL" ,
5+ "first_name" : null ,
6+ "last_name" : null ,
7+ "birth_date" : null ,
8+ "sector" : null ,
9+ "activity" : null ,
10+ "status" : null ,
11+ "conversion_status" : null ,
12+ "lead_score" : null ,
13+ "phone" : null ,
14+ "mobile" : null ,
15+ "phone_pro" : null ,
16+ "email" : null ,
17+ "email2" : null ,
18+ "email_verified" : null
19+ }
Original file line number Diff line number Diff line change 1+ import common from "../common/base.mjs" ;
2+ import sampleEmit from "./test-event.mjs" ;
3+
4+ export default {
5+ ...common ,
6+ key : "nextlead-new-lead-updated" ,
7+ name : "New Lead Updated" ,
8+ description : "Emit new event when a lead is updated in NextLead. [See the documentation](https://dashboard.nextlead.app/en/api-documentation#edited)" ,
9+ version : "0.0.1" ,
10+ type : "source" ,
11+ dedupe : "unique" ,
12+ methods : {
13+ generateMeta ( lead ) {
14+ return {
15+ id : lead . id ,
16+ summary : "Lead Updated" ,
17+ ts : Date . parse ( lead . updated_at ) ,
18+ } ;
19+ } ,
20+ } ,
21+ async run ( ) {
22+ const leads = await this . nextlead . getNewlyUpdatedLeads ( ) ;
23+ for ( const lead of leads ) {
24+ const meta = this . generateMeta ( lead ) ;
25+ this . $emit ( lead , meta ) ;
26+ }
27+ } ,
28+ sampleEmit,
29+ } ;
Original file line number Diff line number Diff line change 1+ export default {
2+ "id" : "cmay7zwqw000fib046wynimr1" ,
3+ "type" : "CLIENT" ,
4+ "civility" : "NEUTRAL" ,
5+ "first_name" : "Jane" ,
6+ "last_name" : "Doe" ,
7+ "birth_date" : null ,
8+ "sector" : null ,
9+ "activity" : null ,
10+ "status" : null ,
11+ "conversion_status" : null ,
12+ "lead_score" : null ,
13+ "phone" : null ,
14+ "mobile" : null ,
15+ "phone_pro" : null ,
16+ "email" : null ,
17+ "email2" : null ,
18+ "email_verified" : null
19+ }
You can’t perform that action at this time.
0 commit comments