n8n/packages/nodes-base/credentials/SlackApi.credentials.ts
2022-04-22 12:45:11 +02:00

45 lines
841 B
TypeScript

import {
IAuthenticateBearer,
IAuthenticateQueryAuth,
ICredentialTestRequest,
ICredentialType,
INodeProperties,
} from 'n8n-workflow';
export class SlackApi implements ICredentialType {
name = 'slackApi';
displayName = 'Slack API';
documentationUrl = 'slack';
properties: INodeProperties[] = [
{
displayName: 'Access Token',
name: 'accessToken',
type: 'string',
default: '',
required: true,
},
];
authenticate: IAuthenticateBearer = {
type: 'bearer',
properties: {
tokenPropertyName: 'accessToken',
},
};
test: ICredentialTestRequest = {
request: {
baseURL: 'https://slack.com',
url: '/api/users.profile.get',
},
rules: [
{
type: 'responseSuccessBody',
properties: {
key: 'error',
value: 'invalid_auth',
message: 'Invalid access token',
},
},
],
};
}