@segment/action-destinations 3.82.1-alpha.1 → 3.82.1-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/destinations/index.js +1 -0
- package/dist/destinations/index.js.map +1 -1
- package/dist/destinations/intercom/generated-types.d.ts +2 -0
- package/dist/destinations/intercom/generated-types.js +3 -0
- package/dist/destinations/intercom/generated-types.js.map +1 -0
- package/dist/destinations/intercom/groupIdentifyContact/generated-types.d.ts +14 -0
- package/dist/destinations/intercom/groupIdentifyContact/generated-types.js +3 -0
- package/dist/destinations/intercom/groupIdentifyContact/generated-types.js.map +1 -0
- package/dist/destinations/intercom/groupIdentifyContact/index.d.ts +5 -0
- package/dist/destinations/intercom/groupIdentifyContact/index.js +122 -0
- package/dist/destinations/intercom/groupIdentifyContact/index.js.map +1 -0
- package/dist/destinations/intercom/identifyContact/generated-types.d.ts +15 -0
- package/dist/destinations/intercom/identifyContact/generated-types.js +3 -0
- package/dist/destinations/intercom/identifyContact/generated-types.js.map +1 -0
- package/dist/destinations/intercom/identifyContact/index.d.ts +5 -0
- package/dist/destinations/intercom/identifyContact/index.js +153 -0
- package/dist/destinations/intercom/identifyContact/index.js.map +1 -0
- package/dist/destinations/intercom/index.d.ts +4 -0
- package/dist/destinations/intercom/index.js +37 -0
- package/dist/destinations/intercom/index.js.map +1 -0
- package/dist/destinations/pipedrive/pipedriveApi/pipedrive-client.js +8 -4
- package/dist/destinations/pipedrive/pipedriveApi/pipedrive-client.js.map +1 -1
- package/dist/destinations/salesforce/cases/generated-types.d.ts +0 -1
- package/dist/destinations/salesforce/cases/index.js +0 -26
- package/dist/destinations/salesforce/cases/index.js.map +1 -1
- package/package.json +4 -5
|
@@ -57,6 +57,7 @@ register('615cae349d109d6b7496a131', './tiktok-conversions');
|
|
|
57
57
|
register('602efa1f249b9a5e2bf8a813', './twilio');
|
|
58
58
|
register('614a3c7d791c91c41bae7599', './webhook');
|
|
59
59
|
register('61dc4e96894a6d7954cc6e45', './voyage');
|
|
60
|
+
register('62b5f2f40b10eaace2e12b23', './intercom');
|
|
60
61
|
function register(id, destinationPath) {
|
|
61
62
|
const definition = require(destinationPath).default;
|
|
62
63
|
const resolvedPath = require.resolve(destinationPath);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/destinations/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,wDAAmD;AACnD,gDAAuB;AAWV,QAAA,YAAY,GAA0C,EAAE,CAAA;AACxD,QAAA,QAAQ,GAAsC,EAAE,CAAA;AAU7D,QAAQ,CAAC,0BAA0B,EAAE,UAAU,CAAC,CAAA;AAChD,QAAQ,CAAC,0BAA0B,EAAE,gBAAgB,CAAC,CAAA;AACtD,QAAQ,CAAC,0BAA0B,EAAE,aAAa,CAAC,CAAA;AACnD,QAAQ,CAAC,0BAA0B,EAAE,SAAS,CAAC,CAAA;AAC/C,QAAQ,CAAC,0BAA0B,EAAE,aAAa,CAAC,CAAA;AACnD,QAAQ,CAAC,0BAA0B,EAAE,SAAS,CAAC,CAAA;AAC/C,QAAQ,CAAC,0BAA0B,EAAE,WAAW,CAAC,CAAA;AACjD,QAAQ,CAAC,0BAA0B,EAAE,oBAAoB,CAAC,CAAA;AAC1D,QAAQ,CAAC,0BAA0B,EAAE,cAAc,CAAC,CAAA;AACpD,QAAQ,CAAC,0BAA0B,EAAE,4BAA4B,CAAC,CAAA;AAClE,QAAQ,CAAC,0BAA0B,EAAE,aAAa,CAAC,CAAA;AACnD,QAAQ,CAAC,0BAA0B,EAAE,6BAA6B,CAAC,CAAA;AACnE,QAAQ,CAAC,0BAA0B,EAAE,sBAAsB,CAAC,CAAA;AAC5D,QAAQ,CAAC,0BAA0B,EAAE,+BAA+B,CAAC,CAAA;AACrE,QAAQ,CAAC,0BAA0B,EAAE,iBAAiB,CAAC,CAAA;AACvD,QAAQ,CAAC,0BAA0B,EAAE,gBAAg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U;IAC3C,MAAM,WAAW,GAAG,gBAAQ,CAAC,EAAE,CAAC,CAAA;IAEhC,IAAI,CAAC,WAAW,EAAE,UAAU,EAAE;QAC5B,OAAO,IAAI,CAAA;KACZ;IAED,OAAO,IAAI,0BAAW,CAAC,WAAW,CAAC,UAAU,CAAC,CAAA;AAChD,CAAC;AARD,gDAQC;AAEM,KAAK,UAAU,uBAAuB,CAAC,WAAmB;IAC/D,OAAO,kBAAkB,CAAC,WAAW,CAAC,IAAI,uBAAuB,CAAC,WAAW,CAAC,CAAA;AAChF,CAAC;AAFD,0DAEC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../src/destinations/intercom/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface Payload {
|
|
2
|
+
remote_created_at?: string | number;
|
|
3
|
+
company_id: string;
|
|
4
|
+
contact_id?: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
monthly_spend?: number;
|
|
7
|
+
plan?: string;
|
|
8
|
+
size?: number;
|
|
9
|
+
website?: string;
|
|
10
|
+
industry?: string;
|
|
11
|
+
custom_attributes?: {
|
|
12
|
+
[k: string]: unknown;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/intercom/groupIdentifyContact/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
4
|
+
const action = {
|
|
5
|
+
title: 'Group Identify Contact',
|
|
6
|
+
description: "Create or Update A Company. Note: Companies will be only visible in Intercom's Dashboard when there is at least one associated contact.",
|
|
7
|
+
defaultSubscription: 'type = "group"',
|
|
8
|
+
platform: 'web',
|
|
9
|
+
fields: {
|
|
10
|
+
remote_created_at: {
|
|
11
|
+
type: 'datetime',
|
|
12
|
+
description: 'The time the company was created by you.',
|
|
13
|
+
label: 'Remote Created At',
|
|
14
|
+
default: {
|
|
15
|
+
'@path': '$.traits.createdAt'
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
company_id: {
|
|
19
|
+
type: 'string',
|
|
20
|
+
description: "The unique identifier of the company. Can't be updated.",
|
|
21
|
+
label: 'Company ID',
|
|
22
|
+
required: true,
|
|
23
|
+
default: {
|
|
24
|
+
'@path': '$.groupId'
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
contact_id: {
|
|
28
|
+
type: 'string',
|
|
29
|
+
description: 'Attach this contact to the company. This ID is NOT the external_id or email; it is the Intercom unique identifier.',
|
|
30
|
+
label: 'Contact ID',
|
|
31
|
+
default: {
|
|
32
|
+
'@path': '$.userId'
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
name: {
|
|
36
|
+
type: 'string',
|
|
37
|
+
description: 'The name of the company.',
|
|
38
|
+
label: 'Name',
|
|
39
|
+
default: {
|
|
40
|
+
'@path': '$.traits.name'
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
monthly_spend: {
|
|
44
|
+
type: 'number',
|
|
45
|
+
description: 'The monthly spend of the company.',
|
|
46
|
+
label: 'Monthly Spend',
|
|
47
|
+
default: {
|
|
48
|
+
'@path': '$.traits.plan'
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
plan: {
|
|
52
|
+
type: 'string',
|
|
53
|
+
description: 'The plan of the company.',
|
|
54
|
+
label: 'Plan',
|
|
55
|
+
default: {
|
|
56
|
+
'@path': '$.traits.plan'
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
size: {
|
|
60
|
+
type: 'number',
|
|
61
|
+
description: 'The size of the company.',
|
|
62
|
+
label: 'Size',
|
|
63
|
+
default: {
|
|
64
|
+
'@path': '$.traits.employees'
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
website: {
|
|
68
|
+
type: 'string',
|
|
69
|
+
description: 'The website of the company.',
|
|
70
|
+
label: 'Website',
|
|
71
|
+
default: {
|
|
72
|
+
'@path': '$.traits.website'
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
industry: {
|
|
76
|
+
type: 'string',
|
|
77
|
+
description: 'The industry of the company.',
|
|
78
|
+
label: 'Industry',
|
|
79
|
+
default: {
|
|
80
|
+
'@path': '$.traits.industry'
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
custom_attributes: {
|
|
84
|
+
type: 'object',
|
|
85
|
+
description: 'Passing any traits not mapped to individual fields as Custom Attributes. Note: Will throw an error if you pass an attribute that isn`t explicitly defined.',
|
|
86
|
+
label: 'Custom Attributes'
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
perform: async (request, { payload }) => {
|
|
90
|
+
const contactId = payload.contact_id;
|
|
91
|
+
delete payload.contact_id;
|
|
92
|
+
const response = await createOrUpdateIntercomCompany(request, payload);
|
|
93
|
+
if (contactId) {
|
|
94
|
+
try {
|
|
95
|
+
const companyId = response.data.id;
|
|
96
|
+
return await attachContactToIntercomCompany(request, contactId, companyId);
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
if (error?.response?.status === 404) {
|
|
100
|
+
throw new actions_core_1.RetryableError(`Contact doesn't exist, retrying`);
|
|
101
|
+
}
|
|
102
|
+
throw error;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
function createOrUpdateIntercomCompany(request, payload) {
|
|
108
|
+
return request(`https://api.intercom.io/companies`, {
|
|
109
|
+
method: 'POST',
|
|
110
|
+
json: payload
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
function attachContactToIntercomCompany(request, contactId, companyId) {
|
|
114
|
+
return request(`https://api.intercom.io/contacts/${contactId}/companies`, {
|
|
115
|
+
method: 'POST',
|
|
116
|
+
json: {
|
|
117
|
+
id: companyId
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
exports.default = action;
|
|
122
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/intercom/groupIdentifyContact/index.ts"],"names":[],"mappings":";;AAAA,wDAAyG;AAQzG,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,wBAAwB;IAC/B,WAAW,EACT,yIAAyI;IAC3I,mBAAmB,EAAE,gBAAgB;IACrC,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE;QACN,iBAAiB,EAAE;YACjB,IAAI,EAAE,UAAU;YAChB,WAAW,EAAE,0CAA0C;YACvD,KAAK,EAAE,mBAAmB;YAC1B,OAAO,EAAE;gBACP,OAAO,EAAE,oBAAoB;aAC9B;SACF;QACD,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,yDAAyD;YACtE,KAAK,EAAE,YAAY;YACnB,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,WAAW;aACrB;SACF;QACD,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,oHAAoH;YACtH,KAAK,EAAE,YAAY;YACnB,OAAO,EAAE;gBACP,OAAO,EAAE,UAAU;aACpB;SACF;QACD,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,0BAA0B;YACvC,KAAK,EAAE,MAAM;YACb,OAAO,EAAE;gBACP,OAAO,EAAE,eAAe;aACzB;SACF;QACD,aAAa,EAAE;YACb,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,mCAAmC;YAChD,KAAK,EAAE,eAAe;YACtB,OAAO,EAAE;gBACP,OAAO,EAAE,eAAe;aACzB;SACF;QACD,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,0BAA0B;YACvC,KAAK,EAAE,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SAAS,6BAA6B,CACpC,OAAsB,EACtB,OAAgB;IAEhB,OAAO,OAAO,CAAC,mCAAmC,EAAE;QAClD,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,OAAO;KACd,CAAC,CAAA;AACJ,CAAC;AAED,SAAS,8BAA8B,CAAC,OAAsB,EAAE,SAAiB,EAAE,SAAiB;IAClG,OAAO,OAAO,CAAC,oCAAoC,SAAS,YAAY,EAAE;QACxE,MAAM,EAAE,MAAM;QACd,IAAI,EAAE;YACJ,EAAE,EAAE,SAAS;SACd;KACF,CAAC,CAAA;AACJ,CAAC;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface Payload {
|
|
2
|
+
role: string;
|
|
3
|
+
external_id?: string;
|
|
4
|
+
email?: string;
|
|
5
|
+
phone?: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
avatar?: string;
|
|
8
|
+
signed_up_at?: string | number;
|
|
9
|
+
last_seen_at?: string | number;
|
|
10
|
+
owner_id?: number;
|
|
11
|
+
unsubscribed_from_emails?: boolean;
|
|
12
|
+
custom_attributes?: {
|
|
13
|
+
[k: string]: unknown;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/intercom/identifyContact/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
4
|
+
const action = {
|
|
5
|
+
title: 'Identify Contact',
|
|
6
|
+
description: 'Create or Update a Contact.',
|
|
7
|
+
defaultSubscription: 'type = "identify"',
|
|
8
|
+
platform: 'web',
|
|
9
|
+
fields: {
|
|
10
|
+
role: {
|
|
11
|
+
type: 'string',
|
|
12
|
+
required: true,
|
|
13
|
+
description: 'The role of the contact. Accepted values are `user` or `lead`. Can only be updated if `lead`.',
|
|
14
|
+
label: 'Role',
|
|
15
|
+
default: 'lead'
|
|
16
|
+
},
|
|
17
|
+
external_id: {
|
|
18
|
+
type: 'string',
|
|
19
|
+
description: 'A unique identifier generated outside Intercom. Required if role=user and email is blank.',
|
|
20
|
+
label: 'External ID',
|
|
21
|
+
default: {
|
|
22
|
+
'@path': '$.userId'
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
email: {
|
|
26
|
+
type: 'string',
|
|
27
|
+
description: "The contact's email. Required if role=user and external_id is blank.",
|
|
28
|
+
label: 'Email',
|
|
29
|
+
format: 'email',
|
|
30
|
+
default: {
|
|
31
|
+
'@path': '$.traits.email'
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
phone: {
|
|
35
|
+
label: 'Phone Number',
|
|
36
|
+
description: "The contact's phone number.",
|
|
37
|
+
type: 'string',
|
|
38
|
+
default: {
|
|
39
|
+
'@path': '$.traits.phone'
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
name: {
|
|
43
|
+
type: 'string',
|
|
44
|
+
description: "The contact's name.",
|
|
45
|
+
label: 'Name',
|
|
46
|
+
default: {
|
|
47
|
+
'@path': '$.traits.name'
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
avatar: {
|
|
51
|
+
label: 'Avatar',
|
|
52
|
+
description: 'URL of image to be associated with contact profile.',
|
|
53
|
+
type: 'string',
|
|
54
|
+
format: 'uri',
|
|
55
|
+
default: {
|
|
56
|
+
'@path': '$.traits.avatar'
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
signed_up_at: {
|
|
60
|
+
label: 'Signed Up At',
|
|
61
|
+
type: 'datetime',
|
|
62
|
+
description: 'The timestamp when the contact was created.',
|
|
63
|
+
default: {
|
|
64
|
+
'@path': '$.createdAt'
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
last_seen_at: {
|
|
68
|
+
label: 'Timestamp',
|
|
69
|
+
type: 'datetime',
|
|
70
|
+
description: 'The timestamp the contact was last seen.',
|
|
71
|
+
default: {
|
|
72
|
+
'@path': '$.timestamp'
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
owner_id: {
|
|
76
|
+
label: 'Owner Id',
|
|
77
|
+
type: 'number',
|
|
78
|
+
description: 'The id of an admin that has been assigned account ownership of the contact.'
|
|
79
|
+
},
|
|
80
|
+
unsubscribed_from_emails: {
|
|
81
|
+
label: 'Unsubscribed From Emails',
|
|
82
|
+
type: 'boolean',
|
|
83
|
+
description: 'Whether the contact is unsubscribed from emails.'
|
|
84
|
+
},
|
|
85
|
+
custom_attributes: {
|
|
86
|
+
label: 'Custom Attributes',
|
|
87
|
+
description: 'The custom attributes which are set for the contact. Note: Will throw an error if the object has an attribute that isn`t explicitly defined on Intercom.',
|
|
88
|
+
type: 'object',
|
|
89
|
+
default: {
|
|
90
|
+
'@path': '$.traits.customAttributes'
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
perform: async (request, { payload }) => {
|
|
95
|
+
try {
|
|
96
|
+
const contact = await searchIntercomContact(request, payload);
|
|
97
|
+
if (contact) {
|
|
98
|
+
return updateIntercomContact(request, contact.id, payload);
|
|
99
|
+
}
|
|
100
|
+
return await createIntercomContact(request, payload);
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
if (error?.response?.status === 409) {
|
|
104
|
+
throw new actions_core_1.RetryableError('Contact was reported duplicated but could not be searched for, probably due to Intercom search cache not being updated');
|
|
105
|
+
}
|
|
106
|
+
throw error;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
async function createIntercomContact(request, payload) {
|
|
111
|
+
return request('https://api.intercom.io/contacts', {
|
|
112
|
+
method: 'POST',
|
|
113
|
+
json: payload
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
async function searchIntercomContact(request, payload) {
|
|
117
|
+
const searchFields = {
|
|
118
|
+
email: payload.email,
|
|
119
|
+
external_id: payload.external_id,
|
|
120
|
+
role: payload.role
|
|
121
|
+
};
|
|
122
|
+
const value = [];
|
|
123
|
+
for (const [key, fieldValue] of Object.entries(searchFields)) {
|
|
124
|
+
if (fieldValue) {
|
|
125
|
+
value.push({
|
|
126
|
+
field: key,
|
|
127
|
+
operator: '=',
|
|
128
|
+
value: fieldValue
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
const query = {
|
|
133
|
+
operator: 'AND',
|
|
134
|
+
value
|
|
135
|
+
};
|
|
136
|
+
const response = await request('https://api.intercom.io/contacts/search', {
|
|
137
|
+
method: 'POST',
|
|
138
|
+
json: { query }
|
|
139
|
+
});
|
|
140
|
+
if (response.data.total_count === 1) {
|
|
141
|
+
return response.data.data[0];
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
async function updateIntercomContact(request, contactId, payload) {
|
|
145
|
+
return request(`https://api.intercom.io/contacts/${contactId}`, {
|
|
146
|
+
method: 'PUT',
|
|
147
|
+
json: {
|
|
148
|
+
...payload
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
exports.default = action;
|
|
153
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/intercom/identifyContact/index.ts"],"names":[],"mappings":";;AAAA,wDAAyG;AAazG,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,kBAAkB;IACzB,WAAW,EAAE,6BAA6B;IAC1C,mBAAmB,EAAE,mBAAmB;IACxC,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE;QACN,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,+FAA+F;YAC5G,KAAK,EAAE,MAAM;YACb,OAAO,EAAE,MAAM;SAChB;QACD,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,WAAW,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AAE,GAAG;gBACV,QAAQ,EAAE,GAAG;gBACb,KAAK,EAAE,UAAU;aAClB,CAAC,CAAA;SACH;KACF;IAED,MAAM,KAAK,GAAG;QACZ,QAAQ,EAAE,KAAK;QACf,KAAK;KACN,CAAA;IAED,MAAM,QAAQ,GAAyC,MAAM,OAAO,CAAC,yCAAyC,EAAE;QAC9G,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,EAAE,KAAK,EAAE;KAChB,CAAC,CAAA;IAEF,IAAI,QAAQ,CAAC,IAAI,CAAC,WAAW,KAAK,CAAC,EAAE;QACnC,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;KAC7B;AACH,CAAC;AAED,KAAK,UAAU,qBAAqB,CAAC,OAAsB,EAAE,SAAiB,EAAE,OAAgB;IAC9F,OAAO,OAAO,CAAC,oCAAoC,SAAS,EAAE,EAAE;QAC9D,MAAM,EAAE,KAAK;QACb,IAAI,EAAE;YACJ,GAAG,OAAO;SACX;KACF,CAAC,CAAA;AACJ,CAAC;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const identifyContact_1 = __importDefault(require("./identifyContact"));
|
|
7
|
+
const groupIdentifyContact_1 = __importDefault(require("./groupIdentifyContact"));
|
|
8
|
+
const destination = {
|
|
9
|
+
name: 'Intercom (Actions)',
|
|
10
|
+
slug: 'actions-intercom',
|
|
11
|
+
mode: 'cloud',
|
|
12
|
+
authentication: {
|
|
13
|
+
scheme: 'oauth2',
|
|
14
|
+
fields: {},
|
|
15
|
+
testAuthentication: (request) => {
|
|
16
|
+
return request('https://api.intercom.io/admins');
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
extendRequest({ auth }) {
|
|
20
|
+
return {
|
|
21
|
+
headers: {
|
|
22
|
+
authorization: `Bearer ${auth?.accessToken}`
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
|
+
onDelete: async (request, { payload }) => {
|
|
27
|
+
return request(`https://api.intercom.io/contacts/${payload.userId}`, {
|
|
28
|
+
method: 'DELETE'
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
actions: {
|
|
32
|
+
identifyContact: identifyContact_1.default,
|
|
33
|
+
groupIdentifyContact: groupIdentifyContact_1.default
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
exports.default = destination;
|
|
37
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/intercom/index.ts"],"names":[],"mappings":";;;;;AAEA,wEAA+C;AAC/C,kFAAyD;AAEzD,MAAM,WAAW,GAAoC;IACnD,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE,kBAAkB;IACxB,IAAI,EAAE,OAAO;IAEb,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE,EAAE;QACV,kBAAkB,EAAE,CAAC,OAAO,EAAE,EAAE;YAG9B,OAAO,OAAO,CAAC,gCAAgC,CAAC,CAAA;QAClD,CAAC;KACF;IACD,aAAa,CAAC,EAAE,IAAI,EAAE;QACpB,OAAO;YACL,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,IAAI,EAAE,WAAW,EAAE;aAC7C;SACF,CAAA;IACH,CAAC;IAED,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACvC,OAAO,OAAO,CAAC,oCAAoC,OAAO,CAAC,MAAM,EAAE,EAAE;YACnE,MAAM,EAAE,QAAQ;SACjB,CAAC,CAAA;IACJ,CAAC;IAED,OAAO,EAAE;QACP,eAAe,EAAf,yBAAe;QACf,oBAAoB,EAApB,8BAAoB;KACrB;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
|
|
@@ -59,8 +59,10 @@ class PipedriveClient {
|
|
|
59
59
|
value: f.key
|
|
60
60
|
}));
|
|
61
61
|
const record = {
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
body: {
|
|
63
|
+
data: fields,
|
|
64
|
+
pagination: {}
|
|
65
|
+
}
|
|
64
66
|
};
|
|
65
67
|
cachedFields[item] = record;
|
|
66
68
|
return record;
|
|
@@ -73,8 +75,10 @@ class PipedriveClient {
|
|
|
73
75
|
value: f.key_string
|
|
74
76
|
}));
|
|
75
77
|
const record = {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
+
body: {
|
|
79
|
+
data: fields,
|
|
80
|
+
pagination: {}
|
|
81
|
+
}
|
|
78
82
|
};
|
|
79
83
|
return record;
|
|
80
84
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipedrive-client.js","sourceRoot":"","sources":["../../../../src/destinations/pipedrive/pipedriveApi/pipedrive-client.ts"],"names":[],"mappings":";;;;;AAEA,qDAA4B;AAa5B,MAAM,cAAc,GAAqB;IACvC,IAAI,EAAE,WAAW;IACjB,MAAM,EAAE,aAAa;IACrB,OAAO,EAAE,cAAc;IACvB,YAAY,EAAE,mBAAmB;CAClC,CAAA;AAOD,MAAM,iBAAiB,GAAwB;IAC7C,GAAG,cAAc;IACjB,QAAQ,EAAE,gBAAgB;IAC1B,IAAI,EAAE,YAAY;CACnB,CAAA;AASD,MAAM,KAAK,GAAG,EAAE,CAAA;AAEhB,MAAM,eAAe;IAInB,YAAY,QAAkB,EAAE,OAAsB;QACpD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAA;IACzB,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,IAAc,EAAE,SAAiB,EAAE,IAAa;QAC1D,IAAI,CAAC,IAAI,EAAE;YACT,OAAO,I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AED,MAAM,CAAC,YAAY,CAAC,SAAoC;QACtD,OAAO,KAAK,EAAE,OAAsB,EAAE,EAAE,QAAQ,EAAmC,EAAE,EAAE;YACrF,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;YACrD,OAAO,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,CAAA;QACpC,CAAC,CAAA;IACH,CAAC;CACF;AAED,kBAAe,eAAe,CAAA"}
|
|
@@ -11,12 +11,6 @@ const action = {
|
|
|
11
11
|
description: 'Represents a case, which is a customer issue or problem.',
|
|
12
12
|
fields: {
|
|
13
13
|
operation: sf_properties_1.operation,
|
|
14
|
-
test_dynamic_field: {
|
|
15
|
-
type: 'string',
|
|
16
|
-
label: 'Test Dynamic Field',
|
|
17
|
-
description: 'This is a test dynamic field.',
|
|
18
|
-
dynamic: true
|
|
19
|
-
},
|
|
20
14
|
enable_batching: sf_properties_1.enable_batching,
|
|
21
15
|
traits: sf_properties_1.traits,
|
|
22
16
|
bulkUpsertExternalId: sf_properties_1.bulkUpsertExternalId,
|
|
@@ -28,26 +22,6 @@ const action = {
|
|
|
28
22
|
},
|
|
29
23
|
customFields: sf_properties_1.customFields
|
|
30
24
|
},
|
|
31
|
-
dynamicFields: {
|
|
32
|
-
test_dynamic_field: async (request, _data) => {
|
|
33
|
-
const res = await request('https://test-dynamic-fields.nick-aguilar.workers.dev/', {
|
|
34
|
-
method: 'GET'
|
|
35
|
-
});
|
|
36
|
-
const arr = [];
|
|
37
|
-
const ret = res.content;
|
|
38
|
-
const items = ret.split(',');
|
|
39
|
-
items.forEach((item) => {
|
|
40
|
-
arr.push({
|
|
41
|
-
label: item,
|
|
42
|
-
value: item
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
return {
|
|
46
|
-
choices: arr,
|
|
47
|
-
nextPage: '2'
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
25
|
perform: async (request, { settings, payload }) => {
|
|
52
26
|
const sf = new sf_operations_1.default(settings.instanceUrl, request);
|
|
53
27
|
if (payload.operation === 'create') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/salesforce/cases/index.ts"],"names":[],"mappings":";;;;;AAGA,oDAQyB;AACzB,qEAAyC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/salesforce/cases/index.ts"],"names":[],"mappings":";;;;;AAGA,oDAQyB;AACzB,qEAAyC;AAEzC,MAAM,WAAW,GAAG,MAAM,CAAA;AAE1B,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,MAAM;IACb,WAAW,EAAE,0DAA0D;IACvE,MAAM,EAAE;QACN,SAAS,EAAE,yBAAS;QACpB,eAAe,EAAE,+BAAe;QAChC,MAAM,EAAE,sBAAM;QACd,oBAAoB,EAAE,oCAAoB;QAC1C,kBAAkB,EAAE,kCAAkB;QACtC,WAAW,EAAE;YACX,KAAK,EAAE,aAAa;YACpB,WAAW,EAAE,iCAAiC;YAC9C,IAAI,EAAE,QAAQ;SACf;QACD,YAAY,EAAE,4BAAY;KAC3B;IACD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE;QAChD,MAAM,EAAE,GAAe,IAAI,uBAAU,CAAC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC,CAAA;QAEpE,IAAI,OAAO,CAAC,SAAS,KAAK,QAAQ,EAAE;YAClC,OAAO,MAAM,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,WAAW,CAAC,CAAA;SACnD;QAED,8BAAc,CAAC,OAAO,CAAC,CAAA;QAEvB,IAAI,OAAO,CAAC,SAAS,KAAK,QAAQ,EAAE;YAClC,OAAO,MAAM,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,WAAW,CAAC,CAAA;SACnD;QAED,IAAI,OAAO,CAAC,SAAS,KAAK,QAAQ,EAAE;YAClC,OAAO,MAAM,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,WAAW,CAAC,CAAA;SACnD;IACH,CAAC;IACD,YAAY,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE;QACrD,MAAM,EAAE,GAAe,IAAI,uBAAU,CAAC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC,CAAA;QAEpE,OAAO,EAAE,CAAC,WAAW,CAAC,OAAO,EAAE,WAAW,CAAC,CAAA;IAC7C,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@segment/action-destinations",
|
|
3
3
|
"description": "Destination Actions engine and definitions.",
|
|
4
|
-
"version": "3.82.1-alpha.
|
|
4
|
+
"version": "3.82.1-alpha.2",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/segmentio/action-destinations",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@amplitude/ua-parser-js": "^0.7.25",
|
|
40
40
|
"@segment/a1-notation": "^2.1.4",
|
|
41
|
-
"@segment/actions-core": "^3.29.
|
|
42
|
-
"@segment/actions-shared": "^1.12.
|
|
41
|
+
"@segment/actions-core": "^3.29.0",
|
|
42
|
+
"@segment/actions-shared": "^1.12.0",
|
|
43
43
|
"cheerio": "^1.0.0-rc.10",
|
|
44
44
|
"dayjs": "^1.10.7",
|
|
45
45
|
"escape-goat": "^3",
|
|
@@ -64,6 +64,5 @@
|
|
|
64
64
|
"coverageReporters": [
|
|
65
65
|
"lcov"
|
|
66
66
|
]
|
|
67
|
-
}
|
|
68
|
-
"gitHead": "9bf18a5f5f4eb37f5bb41de1fb55615113888ba0"
|
|
67
|
+
}
|
|
69
68
|
}
|