first commit
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,381 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const companyOperations: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['company'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
description: 'Create a new company',
|
||||
action: 'Create a company',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Get data of a company',
|
||||
action: 'Get a company',
|
||||
},
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
description: 'Get data of many companies',
|
||||
action: 'Get many companies',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
description: 'Update a company',
|
||||
action: 'Update a company',
|
||||
},
|
||||
{
|
||||
name: 'Users',
|
||||
value: 'users',
|
||||
description: "List company's users",
|
||||
action: 'List users of a company',
|
||||
},
|
||||
],
|
||||
default: 'create',
|
||||
},
|
||||
];
|
||||
|
||||
export const companyFields: INodeProperties[] = [
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* company:users */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'List By',
|
||||
name: 'listBy',
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['company'],
|
||||
operation: ['users'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'ID',
|
||||
value: 'id',
|
||||
description: 'The Intercom defined ID representing the company',
|
||||
},
|
||||
{
|
||||
name: 'Company ID',
|
||||
value: 'companyId',
|
||||
description: 'The company_id you have given to the company',
|
||||
},
|
||||
],
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Value',
|
||||
name: 'value',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['company'],
|
||||
operation: ['users'],
|
||||
},
|
||||
},
|
||||
description: 'View by value',
|
||||
},
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['company'],
|
||||
operation: ['users'],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
description: 'Whether to return all results or only up to a given limit',
|
||||
},
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['company'],
|
||||
operation: ['users'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
maxValue: 60,
|
||||
},
|
||||
default: 50,
|
||||
description: 'Max number of results to return',
|
||||
},
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* company:getAll */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['company'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
description: 'Whether to return all results or only up to a given limit',
|
||||
},
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['company'],
|
||||
operation: ['getAll'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
maxValue: 60,
|
||||
},
|
||||
default: 50,
|
||||
description: 'Max number of results to return',
|
||||
},
|
||||
{
|
||||
displayName: 'Filters',
|
||||
name: 'filters',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Filter',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['company'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Segment ID',
|
||||
name: 'segment_id',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Segment representing the Lead',
|
||||
},
|
||||
{
|
||||
displayName: 'Tag ID',
|
||||
name: 'tag_id',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Tag representing the Lead',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* company:get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Select By',
|
||||
name: 'selectBy',
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['company'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Company ID',
|
||||
value: 'companyId',
|
||||
description: 'The company_id you have given to the company',
|
||||
},
|
||||
{
|
||||
name: 'ID',
|
||||
value: 'id',
|
||||
description: 'The Intercom defined ID representing the company',
|
||||
},
|
||||
{
|
||||
name: 'Name',
|
||||
value: 'name',
|
||||
description: 'The name of the company',
|
||||
},
|
||||
],
|
||||
default: '',
|
||||
description: 'What property to use to query the company',
|
||||
},
|
||||
{
|
||||
displayName: 'Value',
|
||||
name: 'value',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['company'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
description: 'View by value',
|
||||
},
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* company:create/update */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Company ID',
|
||||
name: 'companyId',
|
||||
type: 'string',
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['company'],
|
||||
operation: ['create', 'update'],
|
||||
},
|
||||
},
|
||||
description: 'The company ID you have defined for the company',
|
||||
},
|
||||
{
|
||||
displayName: 'JSON Parameters',
|
||||
name: 'jsonParameters',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: ['create', 'update'],
|
||||
resource: ['company'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: ['create', 'update'],
|
||||
resource: ['company'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Industry',
|
||||
name: 'industry',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The industry that this company operates in',
|
||||
},
|
||||
{
|
||||
displayName: 'Monthly Spend',
|
||||
name: 'monthlySpend',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The phone number of the user',
|
||||
},
|
||||
{
|
||||
displayName: 'Name',
|
||||
name: 'name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
placeholder: '',
|
||||
description: 'Name of the user',
|
||||
},
|
||||
{
|
||||
displayName: 'Plan',
|
||||
name: 'plan',
|
||||
type: 'string',
|
||||
default: '',
|
||||
placeholder: '',
|
||||
description: 'The name of the plan you have associated with the company',
|
||||
},
|
||||
{
|
||||
displayName: 'Size',
|
||||
name: 'size',
|
||||
type: 'number',
|
||||
default: '',
|
||||
description: 'The number of employees in this company',
|
||||
},
|
||||
{
|
||||
displayName: 'Website',
|
||||
name: 'website',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description:
|
||||
"The URL for this company's website. Please note that the value specified here is not validated. Accepts any string.",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: 'Custom Attributes',
|
||||
name: 'customAttributesJson',
|
||||
type: 'json',
|
||||
typeOptions: {
|
||||
alwaysOpenEditWindow: true,
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['company'],
|
||||
operation: ['create', 'update'],
|
||||
jsonParameters: [true],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description:
|
||||
'A hash of key/value pairs to represent custom data you want to attribute to a user',
|
||||
},
|
||||
{
|
||||
displayName: 'Custom Attributes',
|
||||
name: 'customAttributesUi',
|
||||
type: 'fixedCollection',
|
||||
default: {},
|
||||
placeholder: 'Add Attribute',
|
||||
typeOptions: {
|
||||
multipleValues: true,
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['company'],
|
||||
operation: ['create', 'update'],
|
||||
jsonParameters: [false],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'customAttributesValues',
|
||||
displayName: 'Attributes',
|
||||
values: [
|
||||
{
|
||||
displayName: 'Name',
|
||||
name: 'name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Value',
|
||||
name: 'value',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
description:
|
||||
'A hash of key/value pairs to represent custom data you want to attribute to a user',
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,13 @@
|
||||
import type { IDataObject } from 'n8n-workflow';
|
||||
|
||||
export interface ICompany {
|
||||
remote_created_at?: string;
|
||||
company_id?: string;
|
||||
name?: string;
|
||||
monthly_spend?: number;
|
||||
plan?: string;
|
||||
size?: number;
|
||||
website?: string;
|
||||
industry?: string;
|
||||
custom_attributes?: IDataObject;
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
IHookFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
JsonObject,
|
||||
IHttpRequestOptions,
|
||||
IHttpRequestMethods,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
|
||||
export async function intercomApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
endpoint: string,
|
||||
method: IHttpRequestMethods,
|
||||
|
||||
body: any = {},
|
||||
query?: IDataObject,
|
||||
uri?: string,
|
||||
): Promise<any> {
|
||||
const options: IHttpRequestOptions = {
|
||||
method,
|
||||
qs: query,
|
||||
url: uri ?? `https://api.intercom.io${endpoint}`,
|
||||
body,
|
||||
json: true,
|
||||
};
|
||||
|
||||
try {
|
||||
return await this.helpers.httpRequestWithAuthentication.call(this, 'intercomApi', options);
|
||||
} catch (error) {
|
||||
throw new NodeApiError(this.getNode(), error as JsonObject);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Make an API request to paginated intercom endpoint
|
||||
* and return all results
|
||||
*/
|
||||
export async function intercomApiRequestAllItems(
|
||||
this: IHookFunctions | IExecuteFunctions,
|
||||
propertyName: string,
|
||||
endpoint: string,
|
||||
method: IHttpRequestMethods,
|
||||
|
||||
body: any = {},
|
||||
query: IDataObject = {},
|
||||
): Promise<any> {
|
||||
const returnData: IDataObject[] = [];
|
||||
|
||||
let responseData;
|
||||
|
||||
query.per_page = 60;
|
||||
|
||||
let uri: string | undefined;
|
||||
|
||||
do {
|
||||
responseData = await intercomApiRequest.call(this, endpoint, method, body, query, uri);
|
||||
uri = responseData.pages.next;
|
||||
returnData.push.apply(returnData, responseData[propertyName] as IDataObject[]);
|
||||
} while (responseData.pages?.next !== null);
|
||||
|
||||
return returnData;
|
||||
}
|
||||
|
||||
export function validateJSON(json: string | undefined): any {
|
||||
let result;
|
||||
try {
|
||||
result = JSON.parse(json!);
|
||||
} catch (exception) {
|
||||
result = '';
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"node": "n8n-nodes-base.intercom",
|
||||
"nodeVersion": "1.0",
|
||||
"codexVersion": "1.0",
|
||||
"categories": ["Communication", "Sales"],
|
||||
"resources": {
|
||||
"credentialDocumentation": [
|
||||
{
|
||||
"url": "https://docs.n8n.io/integrations/builtin/credentials/intercom/"
|
||||
}
|
||||
],
|
||||
"primaryDocumentation": [
|
||||
{
|
||||
"url": "https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.intercom/"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,640 @@
|
||||
import type {
|
||||
IExecuteFunctions,
|
||||
IDataObject,
|
||||
ILoadOptionsFunctions,
|
||||
INodeExecutionData,
|
||||
INodePropertyOptions,
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
JsonObject,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeConnectionTypes, NodeApiError, NodeOperationError } from 'n8n-workflow';
|
||||
|
||||
import { companyFields, companyOperations } from './CompanyDescription';
|
||||
import type { ICompany } from './CompanyInteface';
|
||||
import { intercomApiRequest, intercomApiRequestAllItems, validateJSON } from './GenericFunctions';
|
||||
import { leadFields, leadOperations } from './LeadDescription';
|
||||
import type { IAvatar, ILead, ILeadCompany } from './LeadInterface';
|
||||
import { userFields, userOperations } from './UserDescription';
|
||||
import type { IUser, IUserCompany } from './UserInterface';
|
||||
|
||||
export class Intercom implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
displayName: 'Intercom',
|
||||
name: 'intercom',
|
||||
|
||||
icon: 'file:intercom.svg',
|
||||
group: ['output'],
|
||||
version: 1,
|
||||
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
||||
description: 'Consume Intercom API',
|
||||
defaults: {
|
||||
name: 'Intercom',
|
||||
},
|
||||
usableAsTool: true,
|
||||
inputs: [NodeConnectionTypes.Main],
|
||||
outputs: [NodeConnectionTypes.Main],
|
||||
credentials: [
|
||||
{
|
||||
name: 'intercomApi',
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
properties: [
|
||||
{
|
||||
displayName: 'Resource',
|
||||
name: 'resource',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
options: [
|
||||
{
|
||||
name: 'Company',
|
||||
value: 'company',
|
||||
description:
|
||||
'Companies allow you to represent commercial organizations using your product',
|
||||
},
|
||||
{
|
||||
name: 'Lead',
|
||||
value: 'lead',
|
||||
description: 'Leads are useful for representing logged-out users of your application',
|
||||
},
|
||||
{
|
||||
name: 'User',
|
||||
value: 'user',
|
||||
description: 'The Users resource is the primary way of interacting with Intercom',
|
||||
},
|
||||
],
|
||||
default: 'user',
|
||||
},
|
||||
...leadOperations,
|
||||
...userOperations,
|
||||
...companyOperations,
|
||||
...userFields,
|
||||
...leadFields,
|
||||
...companyFields,
|
||||
],
|
||||
};
|
||||
|
||||
methods = {
|
||||
loadOptions: {
|
||||
// Get all the available companies to display them to user so that they can
|
||||
// select them easily
|
||||
async getCompanies(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
let response;
|
||||
try {
|
||||
response = await intercomApiRequest.call(this, '/companies', 'GET');
|
||||
} catch (error) {
|
||||
throw new NodeApiError(this.getNode(), error as JsonObject);
|
||||
}
|
||||
const companies = response.companies;
|
||||
for (const company of companies) {
|
||||
const companyName = company.name;
|
||||
const companyId = company.company_id;
|
||||
returnData.push({
|
||||
name: companyName,
|
||||
value: companyId,
|
||||
});
|
||||
}
|
||||
return returnData;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
let qs: IDataObject;
|
||||
let responseData;
|
||||
for (let i = 0; i < length; i++) {
|
||||
try {
|
||||
qs = {};
|
||||
const resource = this.getNodeParameter('resource', 0);
|
||||
const operation = this.getNodeParameter('operation', 0);
|
||||
//https://developers.intercom.com/intercom-api-reference/reference#leads
|
||||
if (resource === 'lead') {
|
||||
if (operation === 'create' || operation === 'update') {
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i);
|
||||
const jsonActive = this.getNodeParameter('jsonParameters', i);
|
||||
const body: ILead = {};
|
||||
if (operation === 'create') {
|
||||
body.email = this.getNodeParameter('email', i) as string;
|
||||
}
|
||||
if (additionalFields.email) {
|
||||
body.email = additionalFields.email as string;
|
||||
}
|
||||
if (additionalFields.phone) {
|
||||
body.phone = additionalFields.phone as string;
|
||||
}
|
||||
if (additionalFields.name) {
|
||||
body.name = additionalFields.name as string;
|
||||
}
|
||||
if (additionalFields.unsubscribedFromEmails) {
|
||||
body.unsubscribed_from_emails = additionalFields.unsubscribedFromEmails as boolean;
|
||||
}
|
||||
if (additionalFields.updateLastRequestAt) {
|
||||
body.update_last_request_at = additionalFields.updateLastRequestAt as boolean;
|
||||
}
|
||||
if (additionalFields.utmSource) {
|
||||
body.utm_source = additionalFields.utmSource as string;
|
||||
}
|
||||
if (additionalFields.utmMedium) {
|
||||
body.utm_medium = additionalFields.utmMedium as string;
|
||||
}
|
||||
if (additionalFields.utmCampaign) {
|
||||
body.utm_campaign = additionalFields.utmCampaign as string;
|
||||
}
|
||||
if (additionalFields.utmTerm) {
|
||||
body.utm_term = additionalFields.utmTerm as string;
|
||||
}
|
||||
if (additionalFields.utmContent) {
|
||||
body.utm_content = additionalFields.utmContent as string;
|
||||
}
|
||||
if (additionalFields.avatar) {
|
||||
const avatar: IAvatar = {
|
||||
type: 'avatar',
|
||||
image_url: additionalFields.avatar as string,
|
||||
};
|
||||
body.avatar = avatar;
|
||||
}
|
||||
if (additionalFields.companies) {
|
||||
const companies: ILeadCompany[] = [];
|
||||
// @ts-ignore
|
||||
additionalFields.companies.forEach((o) => {
|
||||
const company: ILeadCompany = {};
|
||||
company.company_id = o;
|
||||
companies.push(company);
|
||||
});
|
||||
body.companies = companies;
|
||||
}
|
||||
if (!jsonActive) {
|
||||
const customAttributesValues = (
|
||||
this.getNodeParameter('customAttributesUi', i) as IDataObject
|
||||
).customAttributesValues as IDataObject[];
|
||||
if (customAttributesValues) {
|
||||
const customAttributes = {};
|
||||
for (let index = 0; index < customAttributesValues.length; index++) {
|
||||
// @ts-ignore
|
||||
customAttributes[customAttributesValues[index].name] =
|
||||
customAttributesValues[index].value;
|
||||
}
|
||||
body.custom_attributes = customAttributes;
|
||||
}
|
||||
} else {
|
||||
const customAttributesJson = validateJSON(
|
||||
this.getNodeParameter('customAttributesJson', i) as string,
|
||||
);
|
||||
if (customAttributesJson) {
|
||||
body.custom_attributes = customAttributesJson;
|
||||
}
|
||||
}
|
||||
|
||||
if (operation === 'update') {
|
||||
const updateBy = this.getNodeParameter('updateBy', 0) as string;
|
||||
const value = this.getNodeParameter('value', i) as string;
|
||||
if (updateBy === 'userId') {
|
||||
body.user_id = value;
|
||||
}
|
||||
if (updateBy === 'id') {
|
||||
body.id = value;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
responseData = await intercomApiRequest.call(this, '/contacts', 'POST', body);
|
||||
} catch (error) {
|
||||
throw new NodeApiError(this.getNode(), error as JsonObject);
|
||||
}
|
||||
}
|
||||
if (operation === 'get') {
|
||||
const selectBy = this.getNodeParameter('selectBy', 0) as string;
|
||||
const value = this.getNodeParameter('value', i) as string;
|
||||
if (selectBy === 'email') {
|
||||
qs.email = value;
|
||||
}
|
||||
if (selectBy === 'userId') {
|
||||
qs.user_id = value;
|
||||
}
|
||||
if (selectBy === 'phone') {
|
||||
qs.phone = value;
|
||||
}
|
||||
try {
|
||||
if (selectBy === 'id') {
|
||||
responseData = await intercomApiRequest.call(this, `/contacts/${value}`, 'GET');
|
||||
} else {
|
||||
responseData = await intercomApiRequest.call(this, '/contacts', 'GET', {}, qs);
|
||||
responseData = responseData.contacts;
|
||||
}
|
||||
} catch (error) {
|
||||
throw new NodeApiError(this.getNode(), error as JsonObject);
|
||||
}
|
||||
}
|
||||
if (operation === 'getAll') {
|
||||
const returnAll = this.getNodeParameter('returnAll', i);
|
||||
const filters = this.getNodeParameter('filters', i);
|
||||
Object.assign(qs, filters);
|
||||
|
||||
try {
|
||||
if (returnAll) {
|
||||
responseData = await intercomApiRequestAllItems.call(
|
||||
this,
|
||||
'contacts',
|
||||
'/contacts',
|
||||
'GET',
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
} else {
|
||||
qs.per_page = this.getNodeParameter('limit', i);
|
||||
responseData = await intercomApiRequest.call(this, '/contacts', 'GET', {}, qs);
|
||||
responseData = responseData.contacts;
|
||||
}
|
||||
} catch (error) {
|
||||
throw new NodeApiError(this.getNode(), error as JsonObject);
|
||||
}
|
||||
}
|
||||
if (operation === 'delete') {
|
||||
const deleteBy = this.getNodeParameter('deleteBy', 0) as string;
|
||||
const value = this.getNodeParameter('value', i) as string;
|
||||
try {
|
||||
if (deleteBy === 'id') {
|
||||
responseData = await intercomApiRequest.call(this, `/contacts/${value}`, 'DELETE');
|
||||
} else {
|
||||
qs.user_id = value;
|
||||
responseData = await intercomApiRequest.call(this, '/contacts', 'DELETE', {}, qs);
|
||||
}
|
||||
} catch (error) {
|
||||
throw new NodeApiError(this.getNode(), error as JsonObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
//https://developers.intercom.com/intercom-api-reference/reference#users
|
||||
if (resource === 'user') {
|
||||
if (operation === 'create' || operation === 'update') {
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i);
|
||||
const jsonActive = this.getNodeParameter('jsonParameters', i);
|
||||
const body: IUser = {};
|
||||
|
||||
if (operation === 'create') {
|
||||
const identifierType = this.getNodeParameter('identifierType', i) as string;
|
||||
if (identifierType === 'email') {
|
||||
body.email = this.getNodeParameter('idValue', i) as string;
|
||||
} else if (identifierType === 'userId') {
|
||||
body.user_id = this.getNodeParameter('idValue', i) as string;
|
||||
}
|
||||
}
|
||||
|
||||
if (additionalFields.email) {
|
||||
body.email = additionalFields.email as string;
|
||||
}
|
||||
if (additionalFields.userId) {
|
||||
body.user_id = additionalFields.userId as string;
|
||||
}
|
||||
if (additionalFields.phone) {
|
||||
body.phone = additionalFields.phone as string;
|
||||
}
|
||||
if (additionalFields.name) {
|
||||
body.name = additionalFields.name as string;
|
||||
}
|
||||
if (additionalFields.unsubscribedFromEmails) {
|
||||
body.unsubscribed_from_emails = additionalFields.unsubscribedFromEmails as boolean;
|
||||
}
|
||||
if (additionalFields.updateLastRequestAt) {
|
||||
body.update_last_request_at = additionalFields.updateLastRequestAt as boolean;
|
||||
}
|
||||
if (additionalFields.sessionCount) {
|
||||
body.session_count = additionalFields.sessionCount as number;
|
||||
}
|
||||
if (additionalFields.avatar) {
|
||||
const avatar: IAvatar = {
|
||||
type: 'avatar',
|
||||
image_url: additionalFields.avatar as string,
|
||||
};
|
||||
body.avatar = avatar;
|
||||
}
|
||||
if (additionalFields.utmSource) {
|
||||
body.utm_source = additionalFields.utmSource as string;
|
||||
}
|
||||
if (additionalFields.utmMedium) {
|
||||
body.utm_medium = additionalFields.utmMedium as string;
|
||||
}
|
||||
if (additionalFields.utmCampaign) {
|
||||
body.utm_campaign = additionalFields.utmCampaign as string;
|
||||
}
|
||||
if (additionalFields.utmTerm) {
|
||||
body.utm_term = additionalFields.utmTerm as string;
|
||||
}
|
||||
if (additionalFields.utmContent) {
|
||||
body.utm_content = additionalFields.utmContent as string;
|
||||
}
|
||||
if (additionalFields.companies) {
|
||||
const companies: IUserCompany[] = [];
|
||||
// @ts-ignore
|
||||
additionalFields.companies.forEach((o) => {
|
||||
const company: IUserCompany = {};
|
||||
company.company_id = o;
|
||||
companies.push(company);
|
||||
});
|
||||
body.companies = companies;
|
||||
}
|
||||
if (additionalFields.sessionCount) {
|
||||
body.session_count = additionalFields.sessionCount as number;
|
||||
}
|
||||
if (!jsonActive) {
|
||||
const customAttributesValues = (
|
||||
this.getNodeParameter('customAttributesUi', i) as IDataObject
|
||||
).customAttributesValues as IDataObject[];
|
||||
if (customAttributesValues) {
|
||||
const customAttributes = {};
|
||||
for (let index = 0; index < customAttributesValues.length; index++) {
|
||||
// @ts-ignore
|
||||
customAttributes[customAttributesValues[index].name] =
|
||||
customAttributesValues[index].value;
|
||||
}
|
||||
body.custom_attributes = customAttributes;
|
||||
}
|
||||
} else {
|
||||
const customAttributesJson = validateJSON(
|
||||
this.getNodeParameter('customAttributesJson', i) as string,
|
||||
);
|
||||
if (customAttributesJson) {
|
||||
body.custom_attributes = customAttributesJson;
|
||||
}
|
||||
}
|
||||
|
||||
if (operation === 'update') {
|
||||
const updateBy = this.getNodeParameter('updateBy', 0) as string;
|
||||
const value = this.getNodeParameter('value', i) as string;
|
||||
if (updateBy === 'userId') {
|
||||
body.user_id = value;
|
||||
}
|
||||
if (updateBy === 'id') {
|
||||
body.id = value;
|
||||
}
|
||||
if (updateBy === 'email') {
|
||||
body.email = value;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
responseData = await intercomApiRequest.call(this, '/users', 'POST', body, qs);
|
||||
} catch (error) {
|
||||
throw new NodeApiError(this.getNode(), error as JsonObject);
|
||||
}
|
||||
}
|
||||
if (operation === 'get') {
|
||||
const selectBy = this.getNodeParameter('selectBy', 0) as string;
|
||||
const value = this.getNodeParameter('value', i) as string;
|
||||
if (selectBy === 'userId') {
|
||||
qs.user_id = value;
|
||||
}
|
||||
try {
|
||||
if (selectBy === 'id') {
|
||||
responseData = await intercomApiRequest.call(
|
||||
this,
|
||||
`/users/${value}`,
|
||||
'GET',
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
} else {
|
||||
responseData = await intercomApiRequest.call(this, '/users', 'GET', {}, qs);
|
||||
}
|
||||
} catch (error) {
|
||||
throw new NodeApiError(this.getNode(), error as JsonObject);
|
||||
}
|
||||
}
|
||||
if (operation === 'getAll') {
|
||||
const returnAll = this.getNodeParameter('returnAll', i);
|
||||
const filters = this.getNodeParameter('filters', i);
|
||||
Object.assign(qs, filters);
|
||||
|
||||
try {
|
||||
if (returnAll) {
|
||||
responseData = await intercomApiRequestAllItems.call(
|
||||
this,
|
||||
'users',
|
||||
'/users',
|
||||
'GET',
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
} else {
|
||||
qs.per_page = this.getNodeParameter('limit', i);
|
||||
responseData = await intercomApiRequest.call(this, '/users', 'GET', {}, qs);
|
||||
responseData = responseData.users;
|
||||
}
|
||||
} catch (error) {
|
||||
throw new NodeApiError(this.getNode(), error as JsonObject);
|
||||
}
|
||||
}
|
||||
if (operation === 'delete') {
|
||||
const id = this.getNodeParameter('id', i) as string;
|
||||
try {
|
||||
responseData = await intercomApiRequest.call(this, `/users/${id}`, 'DELETE');
|
||||
} catch (error) {
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
`Intercom Error: ${JSON.stringify(error)}`,
|
||||
{ itemIndex: i },
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
//https://developers.intercom.com/intercom-api-reference/reference#companies
|
||||
if (resource === 'company') {
|
||||
if (operation === 'create' || operation === 'update') {
|
||||
const id = this.getNodeParameter('companyId', i) as string;
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i);
|
||||
const jsonActive = this.getNodeParameter('jsonParameters', i);
|
||||
const body: ICompany = {
|
||||
company_id: id,
|
||||
};
|
||||
if (additionalFields.monthlySpend) {
|
||||
body.monthly_spend = additionalFields.monthlySpend as number;
|
||||
}
|
||||
if (additionalFields.name) {
|
||||
body.name = additionalFields.name as string;
|
||||
}
|
||||
if (additionalFields.plan) {
|
||||
body.plan = additionalFields.plan as string;
|
||||
}
|
||||
if (additionalFields.size) {
|
||||
body.size = additionalFields.size as number;
|
||||
}
|
||||
if (additionalFields.website) {
|
||||
body.website = additionalFields.website as string;
|
||||
}
|
||||
if (additionalFields.industry) {
|
||||
body.industry = additionalFields.industry as string;
|
||||
}
|
||||
if (!jsonActive) {
|
||||
const customAttributesValues = (
|
||||
this.getNodeParameter('customAttributesUi', i) as IDataObject
|
||||
).customAttributesValues as IDataObject[];
|
||||
if (customAttributesValues) {
|
||||
const customAttributes = {};
|
||||
for (let index = 0; index < customAttributesValues.length; index++) {
|
||||
// @ts-ignore
|
||||
customAttributes[customAttributesValues[index].name] =
|
||||
customAttributesValues[index].value;
|
||||
}
|
||||
body.custom_attributes = customAttributes;
|
||||
}
|
||||
} else {
|
||||
const customAttributesJson = validateJSON(
|
||||
this.getNodeParameter('customAttributesJson', i) as string,
|
||||
);
|
||||
if (customAttributesJson) {
|
||||
body.custom_attributes = customAttributesJson;
|
||||
}
|
||||
}
|
||||
try {
|
||||
responseData = await intercomApiRequest.call(this, '/companies', 'POST', body, qs);
|
||||
} catch (error) {
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
`Intercom Error: ${JSON.stringify(error)}`,
|
||||
{ itemIndex: i },
|
||||
);
|
||||
}
|
||||
}
|
||||
if (operation === 'get') {
|
||||
const selectBy = this.getNodeParameter('selectBy', 0) as string;
|
||||
const value = this.getNodeParameter('value', i) as string;
|
||||
if (selectBy === 'companyId') {
|
||||
qs.company_id = value;
|
||||
}
|
||||
if (selectBy === 'name') {
|
||||
qs.name = value;
|
||||
}
|
||||
try {
|
||||
if (selectBy === 'id') {
|
||||
responseData = await intercomApiRequest.call(
|
||||
this,
|
||||
`/companies/${value}`,
|
||||
'GET',
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
} else {
|
||||
responseData = await intercomApiRequest.call(this, '/companies', 'GET', {}, qs);
|
||||
}
|
||||
} catch (error) {
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
`Intercom Error: ${JSON.stringify(error)}`,
|
||||
{ itemIndex: i },
|
||||
);
|
||||
}
|
||||
}
|
||||
if (operation === 'getAll') {
|
||||
const returnAll = this.getNodeParameter('returnAll', i);
|
||||
const filters = this.getNodeParameter('filters', i);
|
||||
Object.assign(qs, filters);
|
||||
|
||||
try {
|
||||
if (returnAll) {
|
||||
responseData = await intercomApiRequestAllItems.call(
|
||||
this,
|
||||
'companies',
|
||||
'/companies',
|
||||
'GET',
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
} else {
|
||||
qs.per_page = this.getNodeParameter('limit', i);
|
||||
responseData = await intercomApiRequest.call(this, '/companies', 'GET', {}, qs);
|
||||
responseData = responseData.companies;
|
||||
}
|
||||
} catch (error) {
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
`Intercom Error: ${JSON.stringify(error)}`,
|
||||
{ itemIndex: i },
|
||||
);
|
||||
}
|
||||
}
|
||||
if (operation === 'users') {
|
||||
const listBy = this.getNodeParameter('listBy', 0) as string;
|
||||
const value = this.getNodeParameter('value', i) as string;
|
||||
const returnAll = this.getNodeParameter('returnAll', i);
|
||||
|
||||
if (listBy === 'companyId') {
|
||||
qs.company_id = value;
|
||||
}
|
||||
|
||||
try {
|
||||
if (listBy === 'id') {
|
||||
if (returnAll) {
|
||||
responseData = await intercomApiRequestAllItems.call(
|
||||
this,
|
||||
'users',
|
||||
`/companies/${value}/users`,
|
||||
'GET',
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
} else {
|
||||
qs.per_page = this.getNodeParameter('limit', i);
|
||||
responseData = await intercomApiRequest.call(
|
||||
this,
|
||||
`/companies/${value}/users`,
|
||||
'GET',
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
responseData = responseData.users;
|
||||
}
|
||||
} else {
|
||||
qs.type = 'users';
|
||||
|
||||
if (returnAll) {
|
||||
responseData = await intercomApiRequestAllItems.call(
|
||||
this,
|
||||
'users',
|
||||
'/companies',
|
||||
'GET',
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
} else {
|
||||
qs.per_page = this.getNodeParameter('limit', i);
|
||||
responseData = await intercomApiRequest.call(this, '/companies', 'GET', {}, qs);
|
||||
responseData = responseData.users;
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
`Intercom Error: ${JSON.stringify(error)}`,
|
||||
{ itemIndex: i },
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData as IDataObject),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
return [returnData];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,452 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const leadOperations: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['lead'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
description: 'Create a new lead',
|
||||
action: 'Create a lead',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: 'Delete a lead',
|
||||
action: 'Delete a lead',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Get data of a lead',
|
||||
action: 'Get a lead',
|
||||
},
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
description: 'Get data of many leads',
|
||||
action: 'Get many leads',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
description: 'Update new lead',
|
||||
action: 'Update a lead',
|
||||
},
|
||||
],
|
||||
default: 'create',
|
||||
},
|
||||
];
|
||||
|
||||
export const leadFields: INodeProperties[] = [
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* lead:delete */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Delete By',
|
||||
name: 'deleteBy',
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['lead'],
|
||||
operation: ['delete'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'ID',
|
||||
value: 'id',
|
||||
description: 'The Intercom defined ID representing the Lead',
|
||||
},
|
||||
{
|
||||
name: 'User ID',
|
||||
value: 'userId',
|
||||
description: 'Automatically generated identifier for the Lead',
|
||||
},
|
||||
],
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Value',
|
||||
name: 'value',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['lead'],
|
||||
operation: ['delete'],
|
||||
},
|
||||
},
|
||||
description: 'Delete by value',
|
||||
},
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* lead:get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Select By',
|
||||
name: 'selectBy',
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['lead'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Email',
|
||||
value: 'email',
|
||||
description: 'Email representing the Lead',
|
||||
},
|
||||
{
|
||||
name: 'ID',
|
||||
value: 'id',
|
||||
description: 'The Intercom defined ID representing the Lead',
|
||||
},
|
||||
{
|
||||
name: 'User ID',
|
||||
value: 'userId',
|
||||
description: 'Automatically generated identifier for the Lead',
|
||||
},
|
||||
{
|
||||
name: 'Phone',
|
||||
value: 'phone',
|
||||
description: 'Phone representing the Lead',
|
||||
},
|
||||
],
|
||||
default: '',
|
||||
description: 'The property to select the lead by',
|
||||
},
|
||||
{
|
||||
displayName: 'Value',
|
||||
name: 'value',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['lead'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
description: 'View by value',
|
||||
},
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* lead:getAll */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['lead'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
description: 'Whether to return all results or only up to a given limit',
|
||||
},
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['lead'],
|
||||
operation: ['getAll'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
maxValue: 60,
|
||||
},
|
||||
default: 50,
|
||||
description: 'Max number of results to return',
|
||||
},
|
||||
{
|
||||
displayName: 'Filters',
|
||||
name: 'filters',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Filter',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['lead'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Email',
|
||||
name: 'email',
|
||||
type: 'string',
|
||||
placeholder: 'name@email.com',
|
||||
default: '',
|
||||
description: 'The email address of the lead',
|
||||
},
|
||||
{
|
||||
displayName: 'Phone',
|
||||
name: 'phone',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The phone number of the lead',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* lead:update */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Update By',
|
||||
name: 'updateBy',
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['lead'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'User ID',
|
||||
value: 'userId',
|
||||
description: 'Automatically generated identifier for the Lead',
|
||||
},
|
||||
{
|
||||
name: 'ID',
|
||||
value: 'id',
|
||||
description: 'The Intercom defined ID representing the Lead',
|
||||
},
|
||||
],
|
||||
default: 'id',
|
||||
description: 'The property via which to query the lead',
|
||||
},
|
||||
{
|
||||
displayName: 'Value',
|
||||
name: 'value',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['lead'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
description: 'Value of the property to identify the lead to update',
|
||||
},
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* lead:create */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Email',
|
||||
name: 'email',
|
||||
type: 'string',
|
||||
placeholder: 'name@email.com',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['lead'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
description: 'The email of the user',
|
||||
},
|
||||
{
|
||||
displayName: 'JSON Parameters',
|
||||
name: 'jsonParameters',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: ['create', 'update'],
|
||||
resource: ['lead'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: ['create', 'update'],
|
||||
resource: ['lead'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Avatar',
|
||||
name: 'avatar',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'An avatar image URL. note: the image URL needs to be https.',
|
||||
},
|
||||
{
|
||||
displayName: 'Company Names or IDs',
|
||||
name: 'companies',
|
||||
type: 'multiOptions',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getCompanies',
|
||||
},
|
||||
default: [],
|
||||
description:
|
||||
'Identifies the companies this user belongs to. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Email',
|
||||
name: 'email',
|
||||
type: 'string',
|
||||
placeholder: 'name@email.com',
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
'/resource': ['lead'],
|
||||
'/operation': ['update'],
|
||||
},
|
||||
},
|
||||
description: 'The email of the user',
|
||||
},
|
||||
{
|
||||
displayName: 'Name',
|
||||
name: 'name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Name of the user',
|
||||
},
|
||||
{
|
||||
displayName: 'Phone',
|
||||
name: 'phone',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The phone number of the user',
|
||||
},
|
||||
{
|
||||
displayName: 'Unsubscribed From Emails',
|
||||
name: 'unsubscribedFromEmails',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether the Lead is unsubscribed from emails',
|
||||
},
|
||||
{
|
||||
displayName: 'Update Last Request At',
|
||||
name: 'updateLastRequestAt',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description:
|
||||
'Whether to instruct Intercom to update the users last_request_at value to the current API service time in UTC. default value if not sent is false.',
|
||||
},
|
||||
{
|
||||
displayName: 'UTM Campaign',
|
||||
name: 'utmCampaign',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Identifies a specific product promotion or strategic campaign',
|
||||
},
|
||||
{
|
||||
displayName: 'UTM Content',
|
||||
name: 'utmContent',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Identifies what specifically was clicked to bring the user to the site',
|
||||
},
|
||||
{
|
||||
displayName: 'UTM Medium',
|
||||
name: 'utmMedium',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Identifies what type of link was used',
|
||||
},
|
||||
{
|
||||
displayName: 'UTM Source',
|
||||
name: 'utmSource',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'An avatar image URL. note: the image URL needs to be https.',
|
||||
},
|
||||
{
|
||||
displayName: 'UTM Term',
|
||||
name: 'utmTerm',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Identifies search terms',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: 'Custom Attributes',
|
||||
name: 'customAttributesJson',
|
||||
type: 'json',
|
||||
typeOptions: {
|
||||
alwaysOpenEditWindow: true,
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['lead'],
|
||||
operation: ['create', 'update'],
|
||||
jsonParameters: [true],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description:
|
||||
'A hash of key/value pairs to represent custom data you want to attribute to a user',
|
||||
},
|
||||
{
|
||||
displayName: 'Custom Attributes',
|
||||
name: 'customAttributesUi',
|
||||
type: 'fixedCollection',
|
||||
default: {},
|
||||
placeholder: 'Add Attribute',
|
||||
typeOptions: {
|
||||
multipleValues: true,
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['lead'],
|
||||
operation: ['create', 'update'],
|
||||
jsonParameters: [false],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'customAttributesValues',
|
||||
displayName: 'Attributes',
|
||||
values: [
|
||||
{
|
||||
displayName: 'Name',
|
||||
name: 'name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Value',
|
||||
name: 'value',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
description:
|
||||
'A hash of key/value pairs to represent custom data you want to attribute to a user',
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,29 @@
|
||||
import type { IDataObject } from 'n8n-workflow';
|
||||
|
||||
export interface ILeadCompany {
|
||||
company_id?: string;
|
||||
}
|
||||
|
||||
export interface IAvatar {
|
||||
type?: string;
|
||||
image_url?: string;
|
||||
}
|
||||
|
||||
export interface ILead {
|
||||
user_id?: string;
|
||||
id?: string;
|
||||
email?: string;
|
||||
phone?: string;
|
||||
name?: string;
|
||||
custom_attributes?: IDataObject;
|
||||
companies?: ILeadCompany[];
|
||||
last_request_at?: number;
|
||||
unsubscribed_from_emails?: boolean;
|
||||
update_last_request_at?: boolean;
|
||||
avatar?: IAvatar;
|
||||
utm_source?: string;
|
||||
utm_medium?: string;
|
||||
utm_campaign?: string;
|
||||
utm_term?: string;
|
||||
utm_content?: string;
|
||||
}
|
||||
@@ -0,0 +1,495 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const userOperations: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['user'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
description: 'Create a new user',
|
||||
action: 'Create a user',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: 'Delete a user',
|
||||
action: 'Delete a user',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Get data of a user',
|
||||
action: 'Get a user',
|
||||
},
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
description: 'Get data of many users',
|
||||
action: 'Get many users',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
description: 'Update a user',
|
||||
action: 'Update a user',
|
||||
},
|
||||
],
|
||||
default: 'create',
|
||||
},
|
||||
];
|
||||
|
||||
export const userFields: INodeProperties[] = [
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* user:delete */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'ID',
|
||||
name: 'id',
|
||||
type: 'string',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['user'],
|
||||
operation: ['delete'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'The Intercom defined ID representing the Lead',
|
||||
},
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* user:getAll */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['user'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
description: 'Whether to return all results or only up to a given limit',
|
||||
},
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['user'],
|
||||
operation: ['getAll'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
maxValue: 60,
|
||||
},
|
||||
default: 50,
|
||||
description: 'Max number of results to return',
|
||||
},
|
||||
{
|
||||
displayName: 'Filters',
|
||||
name: 'filters',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Filter',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['user'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Company ID',
|
||||
name: 'company_id',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Company ID representing the user',
|
||||
},
|
||||
{
|
||||
displayName: 'Email',
|
||||
name: 'email',
|
||||
type: 'string',
|
||||
placeholder: 'name@email.com',
|
||||
default: '',
|
||||
description: 'The email address of the user',
|
||||
},
|
||||
{
|
||||
displayName: 'Segment ID',
|
||||
name: 'segment_id',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Segment representing the user',
|
||||
},
|
||||
{
|
||||
displayName: 'Tag ID',
|
||||
name: 'tag_id',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Tag representing the user',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* user:get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Select By',
|
||||
name: 'selectBy',
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['user'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'ID',
|
||||
value: 'id',
|
||||
default: '',
|
||||
description: 'The Intercom defined ID representing the Lead',
|
||||
},
|
||||
{
|
||||
name: 'User ID',
|
||||
value: 'userId',
|
||||
default: '',
|
||||
description: 'Automatically generated identifier for the Lead',
|
||||
},
|
||||
],
|
||||
default: '',
|
||||
description: 'The property to select the user by',
|
||||
},
|
||||
{
|
||||
displayName: 'Value',
|
||||
name: 'value',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['user'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
description: 'View by value',
|
||||
},
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* user:update */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Update By',
|
||||
name: 'updateBy',
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['user'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'ID',
|
||||
value: 'id',
|
||||
description: 'The Intercom defined ID representing the user',
|
||||
},
|
||||
{
|
||||
name: 'Email',
|
||||
value: 'email',
|
||||
description: 'The email address of user',
|
||||
},
|
||||
{
|
||||
name: 'User ID',
|
||||
value: 'userId',
|
||||
description: 'Automatically generated identifier for the user',
|
||||
},
|
||||
],
|
||||
default: 'id',
|
||||
description: 'The property via which to query the user',
|
||||
},
|
||||
{
|
||||
displayName: 'Value',
|
||||
name: 'value',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['user'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
description: 'Value of the property to identify the user to update',
|
||||
},
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* user:create */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Identifier Type',
|
||||
name: 'identifierType',
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['user'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'User ID',
|
||||
value: 'userId',
|
||||
description:
|
||||
'A unique string identifier for the user. It is required on creation if an email is not supplied.',
|
||||
},
|
||||
{
|
||||
name: 'Email',
|
||||
value: 'email',
|
||||
description:
|
||||
"The user's email address. It is required on creation if a user_id is not supplied.",
|
||||
},
|
||||
],
|
||||
default: '',
|
||||
description: 'Unique string identifier',
|
||||
},
|
||||
{
|
||||
displayName: 'Value',
|
||||
name: 'idValue',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['user'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
description: 'Unique string identifier value',
|
||||
},
|
||||
{
|
||||
displayName: 'JSON Parameters',
|
||||
name: 'jsonParameters',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: ['create', 'update'],
|
||||
resource: ['user'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: ['create', 'update'],
|
||||
resource: ['user'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Avatar',
|
||||
name: 'avatar',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'An avatar image URL. note: the image URL needs to be https.',
|
||||
},
|
||||
{
|
||||
displayName: 'Company Names or IDs',
|
||||
name: 'companies',
|
||||
type: 'multiOptions',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getCompanies',
|
||||
},
|
||||
default: [],
|
||||
description:
|
||||
'Identifies the companies this user belongs to. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Email',
|
||||
name: 'email',
|
||||
displayOptions: {
|
||||
show: {
|
||||
'/operation': ['update'],
|
||||
'/resource': ['user'],
|
||||
},
|
||||
hide: {
|
||||
'/updateBy': ['email'],
|
||||
},
|
||||
},
|
||||
type: 'string',
|
||||
placeholder: 'name@email.com',
|
||||
default: '',
|
||||
description: 'Email of the user',
|
||||
},
|
||||
{
|
||||
displayName: 'Name',
|
||||
name: 'name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
placeholder: '',
|
||||
description: 'Name of the user',
|
||||
},
|
||||
{
|
||||
displayName: 'Phone',
|
||||
name: 'phone',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The phone number of the user',
|
||||
},
|
||||
{
|
||||
displayName: 'Session Count',
|
||||
name: 'sessionCount',
|
||||
type: 'number',
|
||||
default: false,
|
||||
options: [],
|
||||
description: 'How many sessions the user has recorded',
|
||||
},
|
||||
{
|
||||
displayName: 'User ID',
|
||||
name: 'userId',
|
||||
displayOptions: {
|
||||
show: {
|
||||
'/operation': ['update'],
|
||||
'/resource': ['user'],
|
||||
},
|
||||
hide: {
|
||||
'/updateBy': ['email', 'userId'],
|
||||
},
|
||||
},
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Email of the user',
|
||||
},
|
||||
{
|
||||
displayName: 'Unsubscribed From Emails',
|
||||
name: 'unsubscribedFromEmails',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
placeholder: '',
|
||||
description: 'Whether the user is unsubscribed from emails',
|
||||
},
|
||||
{
|
||||
displayName: 'Update Last Request At',
|
||||
name: 'updateLastRequestAt',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
options: [],
|
||||
description:
|
||||
'Whether to instruct Intercom to update the users last_request_at value to the current API service time in UTC',
|
||||
},
|
||||
{
|
||||
displayName: 'UTM Campaign',
|
||||
name: 'utmCampaign',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Identifies a specific product promotion or strategic campaign',
|
||||
},
|
||||
{
|
||||
displayName: 'UTM Content',
|
||||
name: 'utmContent',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Identifies what specifically was clicked to bring the user to the site',
|
||||
},
|
||||
{
|
||||
displayName: 'UTM Medium',
|
||||
name: 'utmMedium',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Identifies what type of link was used',
|
||||
},
|
||||
{
|
||||
displayName: 'UTM Source',
|
||||
name: 'utmSource',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'An avatar image URL. note: the image URL needs to be https.',
|
||||
},
|
||||
{
|
||||
displayName: 'UTM Term',
|
||||
name: 'utmTerm',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Identifies search terms',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: 'Custom Attributes',
|
||||
name: 'customAttributesJson',
|
||||
type: 'json',
|
||||
typeOptions: {
|
||||
alwaysOpenEditWindow: true,
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['user'],
|
||||
operation: ['create', 'update'],
|
||||
jsonParameters: [true],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description:
|
||||
'A hash of key/value pairs to represent custom data you want to attribute to a user',
|
||||
},
|
||||
{
|
||||
displayName: 'Custom Attributes',
|
||||
name: 'customAttributesUi',
|
||||
type: 'fixedCollection',
|
||||
default: {},
|
||||
placeholder: 'Add Attribute',
|
||||
typeOptions: {
|
||||
multipleValues: true,
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['user'],
|
||||
operation: ['create', 'update'],
|
||||
jsonParameters: [false],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'customAttributesValues',
|
||||
displayName: 'Attributes',
|
||||
values: [
|
||||
{
|
||||
displayName: 'Name',
|
||||
name: 'name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Value',
|
||||
name: 'value',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
description:
|
||||
'A hash of key/value pairs to represent custom data you want to attribute to a user',
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,32 @@
|
||||
import type { IDataObject } from 'n8n-workflow';
|
||||
|
||||
export interface IUserCompany {
|
||||
company_id?: string;
|
||||
}
|
||||
|
||||
export interface IAvatar {
|
||||
type?: string;
|
||||
image_url?: string;
|
||||
}
|
||||
|
||||
export interface IUser {
|
||||
user_id?: string;
|
||||
id?: string;
|
||||
email?: string;
|
||||
phone?: string;
|
||||
name?: string;
|
||||
custom_attributes?: IDataObject;
|
||||
companies?: IUserCompany[];
|
||||
last_request_at?: number;
|
||||
signed_up_at?: string;
|
||||
unsubscribed_from_emails?: boolean;
|
||||
update_last_request_at?: boolean;
|
||||
last_seen_user_agent?: boolean;
|
||||
session_count?: number;
|
||||
avatar?: IAvatar;
|
||||
utm_source?: string;
|
||||
utm_medium?: string;
|
||||
utm_campaign?: string;
|
||||
utm_term?: string;
|
||||
utm_content?: string;
|
||||
}
|
||||
@@ -0,0 +1,254 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"android_app_name": {
|
||||
"type": "null"
|
||||
},
|
||||
"android_app_version": {
|
||||
"type": "null"
|
||||
},
|
||||
"android_device": {
|
||||
"type": "null"
|
||||
},
|
||||
"android_last_seen_at": {
|
||||
"type": "null"
|
||||
},
|
||||
"android_os_version": {
|
||||
"type": "null"
|
||||
},
|
||||
"android_sdk_version": {
|
||||
"type": "null"
|
||||
},
|
||||
"avatar": {
|
||||
"type": "null"
|
||||
},
|
||||
"browser": {
|
||||
"type": "null"
|
||||
},
|
||||
"browser_language": {
|
||||
"type": "null"
|
||||
},
|
||||
"browser_version": {
|
||||
"type": "null"
|
||||
},
|
||||
"companies": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"has_more": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"total_count": {
|
||||
"type": "integer"
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
},
|
||||
"url": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"created_at": {
|
||||
"type": "integer"
|
||||
},
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"external_id": {
|
||||
"type": "null"
|
||||
},
|
||||
"has_hard_bounced": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"ios_app_name": {
|
||||
"type": "null"
|
||||
},
|
||||
"ios_app_version": {
|
||||
"type": "null"
|
||||
},
|
||||
"ios_device": {
|
||||
"type": "null"
|
||||
},
|
||||
"ios_last_seen_at": {
|
||||
"type": "null"
|
||||
},
|
||||
"ios_os_version": {
|
||||
"type": "null"
|
||||
},
|
||||
"ios_sdk_version": {
|
||||
"type": "null"
|
||||
},
|
||||
"language_override": {
|
||||
"type": "null"
|
||||
},
|
||||
"last_contacted_at": {
|
||||
"type": "null"
|
||||
},
|
||||
"last_email_clicked_at": {
|
||||
"type": "null"
|
||||
},
|
||||
"last_email_opened_at": {
|
||||
"type": "null"
|
||||
},
|
||||
"last_replied_at": {
|
||||
"type": "null"
|
||||
},
|
||||
"last_seen_at": {
|
||||
"type": "null"
|
||||
},
|
||||
"location": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"city": {
|
||||
"type": "null"
|
||||
},
|
||||
"continent_code": {
|
||||
"type": "null"
|
||||
},
|
||||
"country": {
|
||||
"type": "null"
|
||||
},
|
||||
"country_code": {
|
||||
"type": "null"
|
||||
},
|
||||
"region": {
|
||||
"type": "null"
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"marked_email_as_spam": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"notes": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"has_more": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"total_count": {
|
||||
"type": "integer"
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
},
|
||||
"url": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"opted_in_subscription_types": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"has_more": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"total_count": {
|
||||
"type": "integer"
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
},
|
||||
"url": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"opted_out_subscription_types": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"has_more": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"total_count": {
|
||||
"type": "integer"
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
},
|
||||
"url": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"os": {
|
||||
"type": "null"
|
||||
},
|
||||
"owner_id": {
|
||||
"type": "null"
|
||||
},
|
||||
"referrer": {
|
||||
"type": "null"
|
||||
},
|
||||
"role": {
|
||||
"type": "string"
|
||||
},
|
||||
"signed_up_at": {
|
||||
"type": "null"
|
||||
},
|
||||
"sms_consent": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"social_profiles": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tags": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"has_more": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"total_count": {
|
||||
"type": "integer"
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
},
|
||||
"url": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
},
|
||||
"unsubscribed_from_emails": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"unsubscribed_from_sms": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"updated_at": {
|
||||
"type": "integer"
|
||||
},
|
||||
"utm_campaign": {
|
||||
"type": "null"
|
||||
},
|
||||
"utm_content": {
|
||||
"type": "null"
|
||||
},
|
||||
"utm_medium": {
|
||||
"type": "null"
|
||||
},
|
||||
"utm_source": {
|
||||
"type": "null"
|
||||
},
|
||||
"utm_term": {
|
||||
"type": "null"
|
||||
},
|
||||
"workspace_id": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"version": 1
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x="3" y="2" width="35" height="36" fill="white"/>
|
||||
<path d="M34.6667 21.9919C34.6629 22.343 34.5208 22.6785 34.2711 22.9254C34.0215 23.1724 33.6845 23.3109 33.3334 23.3109C32.9822 23.3109 32.6452 23.1724 32.3956 22.9254C32.146 22.6785 32.0038 22.343 32 21.9919V10C32.0038 9.64887 32.146 9.31341 32.3956 9.06646C32.6452 8.81951 32.9822 8.681 33.3334 8.681C33.6845 8.681 34.0215 8.81951 34.2711 9.06646C34.5208 9.31341 34.6629 9.64887 34.6667 10V21.9919ZM34.2014 30.3377C33.9953 30.5141 29.0561 34.6587 20 34.6587C10.9441 34.6587 6.005 30.5139 5.79891 30.3375C5.53046 30.1073 5.36443 29.7799 5.33733 29.4273C5.31023 29.0748 5.42427 28.7259 5.65437 28.4573C5.88399 28.1893 6.21056 28.0232 6.56245 27.9956C6.91435 27.968 7.26282 28.0811 7.53141 28.3102C7.60969 28.3758 12.0203 31.9919 20.0002 31.9919C28.0802 31.9919 32.4225 28.3497 32.4655 28.313C33.0234 27.8338 33.8667 27.8981 34.3456 28.4575C34.5758 28.726 34.6899 29.0749 34.6629 29.4274C34.6358 29.78 34.4698 30.1074 34.2014 30.3377ZM5.33328 10C5.33708 9.64887 5.47923 9.31341 5.72887 9.06646C5.97852 8.81951 6.31549 8.681 6.66664 8.681C7.01779 8.681 7.35477 8.81951 7.60441 9.06646C7.85405 9.31341 7.9962 9.64887 8 10V21.9919C7.9962 22.343 7.85405 22.6785 7.60441 22.9254C7.35477 23.1724 7.01779 23.3109 6.66664 23.3109C6.31549 23.3109 5.97852 23.1724 5.72887 22.9254C5.47923 22.6785 5.33708 22.343 5.33328 21.9919V10ZM12.0002 7.33328C12.0055 6.98321 12.1483 6.64929 12.3978 6.40362C12.6473 6.15796 12.9833 6.02026 13.3334 6.02026C13.6836 6.02026 14.0196 6.15796 14.2691 6.40362C14.5185 6.64929 14.6614 6.98321 14.6667 7.33328V25.1459C14.6614 25.496 14.5185 25.8299 14.2691 26.0756C14.0196 26.3213 13.6836 26.459 13.3334 26.459C12.9833 26.459 12.6473 26.3213 12.3978 26.0756C12.1483 25.8299 12.0055 25.496 12.0002 25.1459V7.33328ZM18.6667 6.65859C18.6667 6.4835 18.7012 6.31012 18.7682 6.14834C18.8352 5.98657 18.9334 5.83959 19.0572 5.71578C19.181 5.59196 19.328 5.49376 19.4898 5.42676C19.6515 5.35976 19.8249 5.32529 20 5.32531C20.1751 5.32527 20.3485 5.35973 20.5103 5.42672C20.6721 5.4937 20.8191 5.59191 20.9429 5.71572C21.0667 5.83953 21.165 5.98653 21.232 6.14831C21.299 6.31009 21.3335 6.48349 21.3334 6.65859V25.9919C21.3296 26.343 21.1875 26.6785 20.9378 26.9254C20.6882 27.1724 20.3512 27.3109 20.0001 27.3109C19.6489 27.3109 19.312 27.1724 19.0623 26.9254C18.8127 26.6785 18.6705 26.343 18.6667 25.9919V6.65859ZM25.3334 7.33328C25.3388 6.98321 25.4816 6.64929 25.7311 6.40362C25.9805 6.15796 26.3166 6.02026 26.6667 6.02026C27.0168 6.02026 27.3529 6.15796 27.6024 6.40362C27.8518 6.64929 27.9946 6.98321 28 7.33328V25.1459C27.9946 25.496 27.8518 25.8299 27.6024 26.0756C27.3529 26.3213 27.0168 26.459 26.6667 26.459C26.3166 26.459 25.9805 26.3213 25.7311 26.0756C25.4816 25.8299 25.3388 25.496 25.3334 25.1459V7.33328ZM35 0H5C2.23859 0 0 2.23859 0 5V35C0 37.7613 2.23859 40 5 40H35C37.7614 40 40 37.7613 40 35V5C40 2.23859 37.7614 0 35 0Z" fill="#0057FF"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.0 KiB |
Reference in New Issue
Block a user