2021-07-30 07:12:30 -07:00
|
|
|
import {
|
2022-07-10 01:37:41 -07:00
|
|
|
IAuthenticateGeneric,
|
|
|
|
ICredentialTestRequest,
|
2021-07-30 07:12:30 -07:00
|
|
|
ICredentialType,
|
|
|
|
INodeProperties,
|
|
|
|
} from 'n8n-workflow';
|
|
|
|
|
|
|
|
export class FreshworksCrmApi implements ICredentialType {
|
|
|
|
name = 'freshworksCrmApi';
|
2022-12-02 12:54:28 -08:00
|
|
|
|
2021-07-30 07:12:30 -07:00
|
|
|
displayName = 'Freshworks CRM API';
|
2022-12-02 12:54:28 -08:00
|
|
|
|
2021-07-30 07:12:30 -07:00
|
|
|
documentationUrl = 'freshdesk';
|
2022-12-02 12:54:28 -08:00
|
|
|
|
2021-07-30 07:12:30 -07:00
|
|
|
properties: INodeProperties[] = [
|
|
|
|
{
|
|
|
|
displayName: 'API Key',
|
|
|
|
name: 'apiKey',
|
|
|
|
type: 'string',
|
2022-11-01 09:41:45 -07:00
|
|
|
typeOptions: { password: true },
|
2021-07-30 07:12:30 -07:00
|
|
|
default: '',
|
|
|
|
placeholder: 'BDsTn15vHezBlt_XGp3Tig',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Domain',
|
|
|
|
name: 'domain',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
placeholder: 'n8n-org',
|
2022-07-24 08:36:17 -07:00
|
|
|
description:
|
|
|
|
'Domain in the Freshworks CRM org URL. For example, in <code>https://n8n-org.myfreshworks.com</code>, the domain is <code>n8n-org</code>.',
|
2021-07-30 07:12:30 -07:00
|
|
|
},
|
|
|
|
];
|
2022-12-02 12:54:28 -08:00
|
|
|
|
2022-07-10 01:37:41 -07:00
|
|
|
authenticate: IAuthenticateGeneric = {
|
|
|
|
type: 'generic',
|
|
|
|
properties: {
|
|
|
|
headers: {
|
2022-07-24 08:36:17 -07:00
|
|
|
Authorization: '=Token token={{$credentials?.apiKey}}',
|
2022-07-10 01:37:41 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
2022-12-02 12:54:28 -08:00
|
|
|
|
2022-07-10 01:37:41 -07:00
|
|
|
test: ICredentialTestRequest = {
|
|
|
|
request: {
|
|
|
|
baseURL: '=https://{{$credentials?.domain}}.myfreshworks.com/crm/sales/api',
|
2022-07-24 08:36:17 -07:00
|
|
|
url: '/tasks',
|
2022-07-10 01:37:41 -07:00
|
|
|
method: 'GET',
|
2022-07-24 08:36:17 -07:00
|
|
|
},
|
2022-07-10 01:37:41 -07:00
|
|
|
};
|
2021-07-30 07:12:30 -07:00
|
|
|
}
|