Webhook constructor
Webhook(})
Setup webhook
Webhook server listens to port by default, set serverPort to override.
Set url as host name e.g. https://example.com
.
Default port is 443
, Telegram API supports 443
, 80
, 88
, 8443
.
Provide privateKey and certificate pair for HTTPS configuration
Throws WebhookException if port is not supported by Telegram or maxConnections is less than 1 or greater than 100.
Implementation
Webhook(this.telegram, this.url, this._server,
{this.ipAddress,
this.certificate,
this.privateKey,
this.port = 443,
this.serverPort,
this.uploadCertificate = false,
this.maxConnections = 40,
this.allowedUpdates,
this.dropPendingUpdates,
this.secretToken}) {
if (![443, 80, 88, 8443].contains(port)) {
throw WebhookException(
'Ports currently supported for Webhooks: 443, 80, 88, 8443.');
}
if (maxConnections > 100 || maxConnections < 1) {
throw WebhookException('Connection limit must between 1 and 100.');
}
}