Skip to content

setWebhook ​

Set a webhook URL to receive incoming updates. After setting a webhook, the getUpdates method will no longer work. Supports uploading a self-signed certificate.

Request ​

POST /:token/setwebhook

Parameters ​

ParameterTypeRequiredDescription
urlStringYesWebhook URL (must be HTTPS)
certificateFileNoSelf-signed SSL certificate in PEM format
ip_addressStringNoFixed IP address for the webhook
max_connectionsIntegerNoMaximum number of concurrent connections
allowed_updatesString[]NoList of allowed update types to receive
secret_tokenStringNoSecret token used to verify the request origin

Response ​

Returns Boolean true on success.

json
{
  "ok": true,
  "result": true
}

Error Codes ​

CodeDescription
400Bad request parameters or invalid URL format
401Invalid token
403Bot does not have permission to perform this action