Intercom node

This commit is contained in:
Ricardo Espinoza
2019-11-16 18:47:28 -05:00
parent 7a19837833
commit 3cfcbead71
4 changed files with 117 additions and 7 deletions

View File

@@ -27,9 +27,6 @@ export async function intercomApiRequest(this: IHookFunctions | IExecuteFunction
json: true
};
console.log(options)
try {
return await this.helpers.request!(options);
} catch (error) {
@@ -43,3 +40,13 @@ export async function intercomApiRequest(this: IHookFunctions | IExecuteFunction
throw error.response.body;
}
}
export function validateJSON(json: string | undefined): any { // tslint:disable-line:no-any
let result;
try {
result = JSON.parse(json!);
} catch (exception) {
result = '';
}
return result;
}