mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-10 14:44:05 -08:00
45 lines
841 B
TypeScript
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',
|
|
},
|
|
},
|
|
],
|
|
};
|
|
}
|