@@ -3,7 +3,7 @@ import app from "../../the_magic_drip.app.mjs";
33export default {
44 key : "the_magic_drip-add-lead-to-campaign" ,
55 name : "Add Lead to Campaign" ,
6- description : "Adds a single lead to a campaign. [See the documentation]()" ,
6+ description : "Add a lead to a campaign. [See the documentation](https://docs.themagicdrip.com/api-reference/endpoint/post-v1campaignleads )" ,
77 version : "0.0.{{ts}}" ,
88 type : "action" ,
99 props : {
@@ -14,30 +14,52 @@ export default {
1414 "campaignId" ,
1515 ] ,
1616 } ,
17+ firstName : {
18+ type : "string" ,
19+ label : "First Name" ,
20+ description : "First name of the lead" ,
21+ optional : true ,
22+ } ,
23+ lastName : {
24+ type : "string" ,
25+ label : "Last Name" ,
26+ description : "Last name of the lead" ,
27+ } ,
28+ linkedInPublicUrl : {
29+ type : "string" ,
30+ label : "LinkedIn Public URL" ,
31+ description : "LinkedIn public URL of the lead" ,
32+ optional : true ,
33+ } ,
1734 company : {
18- propDefinition : [
19- app ,
20- "company" ,
21- ] ,
35+ type : "string" ,
36+ label : "Company" ,
37+ description : "Company of the lead" ,
2238 optional : true ,
2339 } ,
24- linkedinUrl : {
25- propDefinition : [
26- app ,
27- "linkedinUrl" ,
28- ] ,
40+ companyLinkedInUrl : {
41+ type : "string" ,
42+ label : "Company LinkedIn URL" ,
43+ description : "LinkedIn URL of the company" ,
2944 optional : true ,
3045 } ,
3146 } ,
3247 async run ( { $ } ) {
33- const response = await this . app . addLeadToCampaign ( {
34- campaignId : this . campaignId ,
35- company : this . company ,
36- linkedinUrl : this . linkedinUrl ,
48+ const {
49+ app, campaignId, ...lead
50+ } = this ;
51+ const response = await app . addLeadToCampaign ( {
52+ $,
53+ campaignId,
54+ data : {
55+ leadsWithCustomVariables : [
56+ lead ,
57+ ] ,
58+ } ,
3759 } ) ;
3860 $ . export (
3961 "$summary" ,
40- `Added ${ response . totalLeadsAddedToWorkflow } lead(s) to campaign ${ this . campaignId } ` ,
62+ `Successfully added lead " ${ lead . lastName } " to campaign ${ campaignId } ` ,
4163 ) ;
4264 return response ;
4365 } ,
0 commit comments