trigger node fix

This commit is contained in:
Rupenieks 2020-06-10 12:57:13 +02:00
parent 3f9bdd2e41
commit d614483828

View file

@ -281,7 +281,21 @@ export class HubspotTrigger implements INodeType {
};
async webhook(this: IWebhookFunctions): Promise<IWebhookResponseData> {
const credentials = this.getCredentials('hubspotDeveloperApi');
const authenticationMethod = this.getNodeParameter('authentication') as string;
let credentials : IDataObject;
if (authenticationMethod === 'hubspotDeveloperApi') {
credentials = this.getCredentials('hubspotDeveloperApi') as IDataObject;
} else {
credentials = this.getCredentials('hubspotOAuth2Api') as IDataObject;
}
if (credentials === undefined) {
throw new Error('No credentials found!');
}
const req = this.getRequestObject();
const bodyData = req.body;
const headerData = this.getHeaderData();