mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
* 👕 Enable `consistent-type-imports` for nodes-base * 👕 Apply to nodes-base * ⏪ Undo unrelated changes * 🚚 Move to `.eslintrc.js` in nodes-base * ⏪ Revert "Enable `consistent-type-imports` for nodes-base" This reverts commit 529ad72b051478fa1633aaf84b2864f2fdc7613c. * 👕 Fix severity
60 lines
1.1 KiB
TypeScript
60 lines
1.1 KiB
TypeScript
import type {
|
|
IAuthenticateGeneric,
|
|
ICredentialTestRequest,
|
|
ICredentialType,
|
|
INodeProperties,
|
|
} from 'n8n-workflow';
|
|
|
|
export class WhatsAppApi implements ICredentialType {
|
|
name = 'whatsAppApi';
|
|
|
|
displayName = 'WhatsApp API';
|
|
|
|
documentationUrl = 'whatsApp';
|
|
|
|
properties: INodeProperties[] = [
|
|
{
|
|
displayName: 'Access Token',
|
|
type: 'string',
|
|
typeOptions: { password: true },
|
|
name: 'accessToken',
|
|
default: '',
|
|
required: true,
|
|
},
|
|
{
|
|
displayName: 'Bussiness Account ID',
|
|
type: 'string',
|
|
name: 'businessAccountId',
|
|
default: '',
|
|
required: true,
|
|
},
|
|
];
|
|
|
|
authenticate: IAuthenticateGeneric = {
|
|
type: 'generic',
|
|
properties: {
|
|
headers: {
|
|
Authorization: '=Bearer {{$credentials.accessToken}}',
|
|
},
|
|
},
|
|
};
|
|
|
|
test: ICredentialTestRequest = {
|
|
request: {
|
|
baseURL: 'https://graph.facebook.com/v13.0',
|
|
url: '/',
|
|
ignoreHttpStatusErrors: true,
|
|
},
|
|
rules: [
|
|
{
|
|
type: 'responseSuccessBody',
|
|
properties: {
|
|
key: 'error.type',
|
|
value: 'OAuthException',
|
|
message: 'Invalid access token',
|
|
},
|
|
},
|
|
],
|
|
};
|
|
}
|