SetWebhookApi

setWebhook

Use this method to specify a URL and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified URL, containing a JSON-serialized Update. In case of an unsuccessful request, we will give up after a reasonable amount of attempts. Returns True on success.

If you'd like to make sure that the webhook was set by you, you can specify secret data in the parameter secret_token. If specified, the request will contain a header “X-Telegram-Bot-Api-Secret-Token” with the secret token as content.

Notes

  1. You will not be able to receive updates using getUpdates for as long as an outgoing webhook is set up.

  2. To use a self-signed certificate, you need to upload your public key certificate using certificate parameter. Please upload as InputFile, sending a String will not work.

  3. Ports currently supported for webhooks: 443, 80, 88, 8443.

If you're having any trouble setting up webhooks, please check out this amazing guide to webhooks.

Author

ForteScarlet

Types

Link copied to clipboard
object Factory
Link copied to clipboard
data class Params(var url: String, var certificate: InputFile? = null, var ipAddress: String? = null, var maxConnections: Int? = null, var allowedUpdates: Collection<String>? = null, var dropPendingUpdates: String? = null, var secretToken: String? = null)

Request body of SetWebhookApi.

Properties

Link copied to clipboard
open override val body: MultiPartFormDataContent

The request body (or null).

Link copied to clipboard
open override val name: String

The method name.

Link copied to clipboard

The result's DeserializationStrategy of this Method.

Inherited properties

Link copied to clipboard

MultiPartFormDataContent does not require a serializer. Always get null.

Link copied to clipboard
open val headers: Headers

Headers for request. Default is Headers.Empty.

Inherited functions

Link copied to clipboard
suspend fun <R : Any> TelegramApi<R>.requestData(client: HttpClient, token: String, server: Url?): R
suspend fun <R : Any> TelegramApi<R>.requestData(client: HttpClient, token: String, server: String? = null): R

Request the TelegramApi by client with token.

Link copied to clipboard
suspend fun TelegramApi<*>.requestRaw(client: HttpClient, token: String, server: Url?): HttpResponse
suspend fun TelegramApi<*>.requestRaw(client: HttpClient, token: String, server: String? = null): HttpResponse

Request the TelegramApi by client with token.

Link copied to clipboard
suspend fun <R : Any> TelegramApi<R>.requestResult(client: HttpClient, token: String, server: Url?): TelegramApiResult<R>
suspend fun <R : Any> TelegramApi<R>.requestResult(client: HttpClient, token: String, server: String? = null): TelegramApiResult<R>

Request the TelegramApi by client with token.