-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2a94bd8
commit 165e973
Showing
9 changed files
with
1,441 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
const { getMappingConfig } = require('../../util'); | ||
|
||
const BASE_ENDPOINT = 'https://api.intercom.io'; | ||
|
||
// track events | Track | ||
const TRACK_ENDPOINT = `${BASE_ENDPOINT}/events`; | ||
// Create, Update a user with a company | Identify | ||
const IDENTIFY_ENDPOINT = `${BASE_ENDPOINT}/users`; | ||
// create, update, delete a company | Group | ||
const GROUP_ENDPOINT = `${BASE_ENDPOINT}/companies`; | ||
|
||
const ConfigCategory = { | ||
TRACK: { | ||
endpoint: TRACK_ENDPOINT, | ||
name: 'INTERCOMTrackConfig', | ||
}, | ||
IDENTIFY: { | ||
endpoint: IDENTIFY_ENDPOINT, | ||
name: 'INTERCOMIdentifyConfig', | ||
}, | ||
GROUP: { | ||
endpoint: GROUP_ENDPOINT, | ||
name: 'INTERCOMGroupConfig', | ||
}, | ||
}; | ||
|
||
const MappingConfig = getMappingConfig(ConfigCategory, __dirname); | ||
|
||
const ReservedTraitsProperties = [ | ||
'userId', | ||
'email', | ||
'phone', | ||
'name', | ||
'createdAt', | ||
'firstName', | ||
'lastName', | ||
'firstname', | ||
'lastname', | ||
'company', | ||
]; | ||
|
||
const ReservedCompanyProperties = ['id', 'name', 'industry']; | ||
|
||
// ref:- https://developers.intercom.com/intercom-api-reference/v1.4/reference/event-metadata-types | ||
const MetadataTypes = { richLink: ['url', 'value'], monetaryAmount: ['amount', 'currency'] }; | ||
|
||
module.exports = { | ||
ConfigCategory, | ||
MappingConfig, | ||
ReservedCompanyProperties, | ||
ReservedTraitsProperties, | ||
MetadataTypes, | ||
}; |
53 changes: 53 additions & 0 deletions
53
src/v0/destinations/intercom/data/INTERCOMGroupConfig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
[ | ||
{ | ||
"destKey": "company_id", | ||
"sourceKeys": "groupId", | ||
"required": true | ||
}, | ||
{ | ||
"destKey": "name", | ||
"sourceKeys": "name", | ||
"sourceFromGenericMap": true, | ||
"required": false | ||
}, | ||
{ | ||
"destKey": "plan", | ||
"sourceKeys": ["traits.plan", "context.traits.plan"], | ||
"required": false | ||
}, | ||
{ | ||
"destKey": "size", | ||
"sourceKeys": ["traits.size", "context.traits.size"], | ||
"metadata": { | ||
"type": "toNumber" | ||
}, | ||
"required": false | ||
}, | ||
{ | ||
"destKey": "website", | ||
"sourceKeys": "website", | ||
"sourceFromGenericMap": true, | ||
"required": false | ||
}, | ||
{ | ||
"destKey": "industry", | ||
"sourceKeys": ["traits.industry", "context.traits.industry"], | ||
"required": false | ||
}, | ||
{ | ||
"destKey": "monthly_spend", | ||
"sourceKeys": ["traits.monthlySpend", "context.traits.monthlySpend"], | ||
"metadata": { | ||
"type": "toNumber" | ||
}, | ||
"required": false | ||
}, | ||
{ | ||
"destKey": "remote_created_at", | ||
"sourceKeys": ["traits.remoteCreatedAt", "context.traits.remoteCreatedAt"], | ||
"metadata": { | ||
"type": "toNumber" | ||
}, | ||
"required": false | ||
} | ||
] |
46 changes: 46 additions & 0 deletions
46
src/v0/destinations/intercom/data/INTERCOMIdentifyConfig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
[ | ||
{ | ||
"destKey": "user_id", | ||
"sourceKeys": [ | ||
"userId", | ||
"traits.userId", | ||
"traits.id", | ||
"context.traits.userId", | ||
"context.traits.id" | ||
], | ||
"required": false | ||
}, | ||
{ | ||
"destKey": "email", | ||
"sourceKeys": ["traits.email", "context.traits.email"], | ||
"required": false | ||
}, | ||
{ | ||
"destKey": "phone", | ||
"sourceKeys": ["traits.phone", "context.traits.phone"], | ||
"required": false | ||
}, | ||
{ | ||
"destKey": "name", | ||
"sourceKeys": ["traits.name", "context.traits.name"], | ||
"required": false | ||
}, | ||
{ | ||
"destKey": "signed_up_at", | ||
"sourceKeys": ["traits.createdAt", "context.traits.createdAt"], | ||
"required": false, | ||
"metadata": { | ||
"type": "secondTimestamp" | ||
} | ||
}, | ||
{ | ||
"destKey": "last_seen_user_agent", | ||
"sourceKeys": "context.userAgent", | ||
"required": false | ||
}, | ||
{ | ||
"destKey": "custom_attributes", | ||
"sourceKeys": ["traits", "context.traits"], | ||
"required": false | ||
} | ||
] |
36 changes: 36 additions & 0 deletions
36
src/v0/destinations/intercom/data/INTERCOMTrackConfig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
[ | ||
{ | ||
"destKey": "user_id", | ||
"sourceKeys": [ | ||
"userId", | ||
"traits.userId", | ||
"traits.id", | ||
"context.traits.userId", | ||
"context.traits.id" | ||
], | ||
"required": false | ||
}, | ||
{ | ||
"destKey": "email", | ||
"sourceKeys": ["traits.email", "context.traits.email"], | ||
"required": false | ||
}, | ||
{ | ||
"destKey": "event_name", | ||
"sourceKeys": "event", | ||
"required": true | ||
}, | ||
{ | ||
"destKey": "created", | ||
"sourceKeys": "timestamp", | ||
"sourceFromGenericMap": true, | ||
"required": true, | ||
"metadata": { | ||
"type": "secondTimestamp" | ||
} | ||
}, | ||
{ | ||
"destKey": "metadata", | ||
"sourceKeys": "properties" | ||
} | ||
] |
Oops, something went wrong.