File tree Expand file tree Collapse file tree 2 files changed +80
-3
lines changed Expand file tree Collapse file tree 2 files changed +80
-3
lines changed Original file line number Diff line number Diff line change 1+ import app from "../../salesforge.app.mjs" ;
2+
3+ export default {
4+ key : "salesforge-create-contact" ,
5+ name : "Create Contact" ,
6+ description : "Create a new contact in Salesforge. [See the documentation](https://api.salesforge.ai/public/v2/swagger/index.html)" ,
7+ version : "0.0.1" ,
8+ type : "action" ,
9+ props : {
10+ app,
11+ workspaceId : {
12+ propDefinition : [
13+ app ,
14+ "workspaceId" ,
15+ ] ,
16+ } ,
17+ email : {
18+ type : "string" ,
19+ label : "Email" ,
20+ description : "The email address of the contact" ,
21+ } ,
22+ firstName : {
23+ type : "string" ,
24+ label : "First Name" ,
25+ description : "The first name of the contact" ,
26+ } ,
27+ lastName : {
28+ type : "string" ,
29+ label : "Last Name" ,
30+ description : "The last name of the contact" ,
31+ } ,
32+ company : {
33+ type : "string" ,
34+ label : "Company" ,
35+ description : "The company name of the contact" ,
36+ optional : true ,
37+ } ,
38+ linkedinUrl : {
39+ type : "string" ,
40+ label : "LinkedIn URL" ,
41+ description : "The LinkedIn profile URL of the contact" ,
42+ optional : true ,
43+ } ,
44+ tags : {
45+ type : "string[]" ,
46+ label : "Tags" ,
47+ description : "One or more tags to assign to the contact" ,
48+ optional : true ,
49+ } ,
50+ } ,
51+ async run ( { $ } ) {
52+ const {
53+ app, workspaceId, ...data
54+ } = this ;
55+
56+ const response = await app . createContact ( {
57+ workspaceId,
58+ data,
59+ } ) ;
60+
61+ $ . export ( "$summary" , `Successfully created contact (ID: ${ response . id } )` ) ;
62+ return response ;
63+ } ,
64+ } ;
Original file line number Diff line number Diff line change @@ -8,9 +8,13 @@ export default {
88 type : "string" ,
99 label : "Workspace ID" ,
1010 description : "Select a workspace or provide a workspace ID" ,
11- async options ( ) {
12- const workspaces = await this . listWorkspaces ( ) ;
13- return workspaces ?. map ( ( workspace ) => ( {
11+ async options ( { page } ) {
12+ const response = await this . listWorkspaces ( {
13+ params : {
14+ offset : page ,
15+ } ,
16+ } ) ;
17+ return response . data ?. map ( ( workspace ) => ( {
1418 label : workspace . name ,
1519 value : workspace . id ,
1620 } ) ) ;
@@ -58,5 +62,14 @@ export default {
5862 ...args ,
5963 } ) ;
6064 } ,
65+ async createContact ( {
66+ workspaceId, ...args
67+ } ) {
68+ return this . _makeRequest ( {
69+ path : `/workspaces/${ workspaceId } /contacts` ,
70+ method : "POST" ,
71+ ...args ,
72+ } ) ;
73+ } ,
6174 } ,
6275} ;
You can’t perform that action at this time.
0 commit comments