File tree Expand file tree Collapse file tree 4 files changed +153
-7
lines changed
Expand file tree Collapse file tree 4 files changed +153
-7
lines changed Original file line number Diff line number Diff line change 1+ import gloriaAi from "../../gloria_ai.app.mjs" ;
2+
3+ export default {
4+ key : "gloria_ai-create-lead" ,
5+ name : "Create Lead" ,
6+ description : "Creates a new lead/contact in Gloria.ai. [See the documentation](https://api.iamgloria.com/api)." ,
7+ version : "0.0.1" ,
8+ type : "action" ,
9+ props : {
10+ gloriaAi,
11+ leadName : {
12+ propDefinition : [
13+ gloriaAi ,
14+ "leadName" ,
15+ ] ,
16+ } ,
17+ phone : {
18+ propDefinition : [
19+ gloriaAi ,
20+ "phone" ,
21+ ] ,
22+ } ,
23+ email : {
24+ propDefinition : [
25+ gloriaAi ,
26+ "email" ,
27+ ] ,
28+ } ,
29+ initiation : {
30+ propDefinition : [
31+ gloriaAi ,
32+ "initiation" ,
33+ ] ,
34+ } ,
35+ tags : {
36+ propDefinition : [
37+ gloriaAi ,
38+ "tags" ,
39+ ] ,
40+ } ,
41+ status : {
42+ propDefinition : [
43+ gloriaAi ,
44+ "status" ,
45+ ] ,
46+ } ,
47+ } ,
48+ async run ( { $ } ) {
49+ const response = await this . gloriaAi . createContact ( {
50+ $,
51+ data : {
52+ tenantId : this . gloriaAi . $auth . tenant_id ,
53+ createdAt : Date . now ( ) ,
54+ name : [
55+ this . leadName ,
56+ ] ,
57+ phone : this . phone && [
58+ this . phone ,
59+ ] ,
60+ email : this . email && [
61+ this . email ,
62+ ] ,
63+ origin : "api" ,
64+ initiation : this . initiation ,
65+ tags : this . tags ,
66+ status : this . status ,
67+ } ,
68+ } ) ;
69+ $ . export ( "$summary" , `Successfully created lead with ID: ${ response . id } ` ) ;
70+ return response ;
71+ } ,
72+ } ;
Original file line number Diff line number Diff line change 1+ import { axios } from "@pipedream/platform" ;
2+
13export default {
24 type : "app" ,
35 app : "gloria_ai" ,
4- propDefinitions : { } ,
6+ propDefinitions : {
7+ leadName : {
8+ type : "string" ,
9+ label : "Lead Name" ,
10+ description : "The name of the lead" ,
11+ } ,
12+ phone : {
13+ type : "string" ,
14+ label : "Phone" ,
15+ description : "Phone number of the lead" ,
16+ optional : true ,
17+ } ,
18+ email : {
19+ type : "string" ,
20+ label : "Email" ,
21+ description : "Email address of the lead" ,
22+ optional : true ,
23+ } ,
24+ initiation : {
25+ type : "string" ,
26+ label : "Initiation" ,
27+ description : "Initiation details for the lead" ,
28+ options : [
29+ "Inbound" ,
30+ "Outbound" ,
31+ ] ,
32+ optional : true ,
33+ } ,
34+ tags : {
35+ type : "string[]" ,
36+ label : "Tags" ,
37+ description : "Tags associated with the lead" ,
38+ optional : true ,
39+ } ,
40+ status : {
41+ type : "string" ,
42+ label : "Status" ,
43+ description : "Status of the lead" ,
44+ options : [
45+ "active" ,
46+ "archived" ,
47+ "favorite" ,
48+ ] ,
49+ optional : true ,
50+ } ,
51+ } ,
552 methods : {
6- // this.$auth contains connected account data
7- authKeys ( ) {
8- console . log ( Object . keys ( this . $auth ) ) ;
53+ _baseUrl ( ) {
54+ return "https://api.iamgloria.com/api/v1" ;
55+ } ,
56+ _makeRequest ( {
57+ $ = this ,
58+ path,
59+ ...otherOpts
60+ } ) {
61+ return axios ( $ , {
62+ ...otherOpts ,
63+ url : `${ this . _baseUrl ( ) } ${ path } ` ,
64+ headers : {
65+ "Authorization" : `Bearer ${ this . $auth . api_key } ` ,
66+ "tenant-id" : `${ this . $auth . tenant_id } ` ,
67+ } ,
68+ } ) ;
69+ } ,
70+ createContact ( opts = { } ) {
71+ return this . _makeRequest ( {
72+ method : "POST" ,
73+ path : "/contacts" ,
74+ ...opts ,
75+ } ) ;
976 } ,
1077 } ,
1178} ;
Original file line number Diff line number Diff line change 11{
22 "name" : " @pipedream/gloria_ai" ,
3- "version" : " 0.0.1 " ,
3+ "version" : " 0.1.0 " ,
44 "description" : " Pipedream Gloria AI Components" ,
55 "main" : " gloria_ai.app.mjs" ,
66 "keywords" : [
1111 "author" : " Pipedream <support@pipedream.com> (https://pipedream.com/)" ,
1212 "publishConfig" : {
1313 "access" : " public"
14+ },
15+ "dependencies" : {
16+ "@pipedream/platform" : " ^3.0.3"
1417 }
15- }
18+ }
You can’t perform that action at this time.
0 commit comments