Telegram Trigger node function for checking if webhook exists (#915)

*  Trigger checkExists function

*  Fixed checkExists logic to ensure API registered webhook URL matches local
This commit is contained in:
Rupenieks 2020-09-02 15:19:24 +02:00 committed by GitHub
parent ebc52acdbc
commit f291315359
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -112,6 +112,14 @@ export class TelegramTrigger implements INodeType {
webhookMethods = {
default: {
async checkExists(this: IHookFunctions): Promise<boolean> {
const endpoint = 'getWebhookInfo';
const webhookReturnData = await apiRequest.call(this, 'POST', endpoint, {});
const webhookUrl = this.getNodeWebhookUrl('default');
if (webhookReturnData.result.url === webhookUrl) {
return true;
}
return false;
},
async create(this: IHookFunctions): Promise<boolean> {