Improvements to ConvertKit-Trigger

This commit is contained in:
ricardo
2020-08-06 13:33:43 -04:00
parent 9b15cf50bc
commit 833001a9e4
3 changed files with 255 additions and 38 deletions

View File

@@ -39,12 +39,19 @@ export async function convertKitApiRequest(this: IExecuteFunctions | IExecuteSin
delete options.body;
}
console.log(options);
// it's a webhook so include the api secret on the body
if ((options.uri as string).includes('/automations/hooks')) {
options.body['api_secret'] = credentials.apiSecret;
} else {
qs.api_secret = credentials.apiSecret;
}
if (Object.keys(options.qs).length === 0) {
delete options.qs;
}
try {
qs.api_secret = credentials.apiSecret;
return await this.helpers.request!(options);
} catch (error) {