mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
fix(Notion Trigger (Beta) Node): Fix Notion trigger polling strategy
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
import { request } from 'http';
|
||||
import {
|
||||
IAuthenticateGeneric,
|
||||
ICredentialDataDecryptedObject,
|
||||
ICredentialTestRequest,
|
||||
ICredentialType,
|
||||
IHttpRequestOptions,
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
@@ -24,13 +27,25 @@ export class NotionApi implements ICredentialType {
|
||||
url: '/users',
|
||||
},
|
||||
};
|
||||
authenticate: IAuthenticateGeneric = {
|
||||
type: 'generic',
|
||||
properties: {
|
||||
headers: {
|
||||
Authorization: '=Bearer {{$credentials.apiKey}}',
|
||||
'Notion-Version': '2021-05-13',
|
||||
},
|
||||
},
|
||||
};
|
||||
async authenticate(
|
||||
credentials: ICredentialDataDecryptedObject,
|
||||
requestOptions: IHttpRequestOptions,
|
||||
): Promise<IHttpRequestOptions> {
|
||||
requestOptions.headers = {
|
||||
...requestOptions.headers,
|
||||
Authorization: `Bearer ${credentials.apiKey} `,
|
||||
};
|
||||
|
||||
// if version it's not set, set it to last one
|
||||
// version is only set when the request is made from
|
||||
// the notion node, or was set explicitly in the http node
|
||||
if (!requestOptions.headers['Notion-Version']) {
|
||||
requestOptions.headers = {
|
||||
...requestOptions.headers,
|
||||
'Notion-Version': '2022-02-22',
|
||||
};
|
||||
}
|
||||
|
||||
return requestOptions;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user