1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types = 1); |
4
|
|
|
|
5
|
|
|
namespace unreal4u\Telegram\Methods; |
6
|
|
|
|
7
|
|
|
use unreal4u\Abstracts\TelegramMethods; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Use this method to specify a url and receive incoming updates via an outgoing webhook. Whenever there is an update |
11
|
|
|
* for the bot, we will send an HTTPS POST request to the specified url, containing a JSON-serialized Update. In case of |
12
|
|
|
* an unsuccessful request, we will give up after a reasonable amount of attempts. |
13
|
|
|
* |
14
|
|
|
* If you'd like to make sure that the Webhook request comes from Telegram, we recommend using a secret path in the URL, |
15
|
|
|
* e.g. https://www.example.com/<token>. Since nobody else knows your bot‘s token, you can be pretty sure it’s us. |
16
|
|
|
* |
17
|
|
|
* Notes |
18
|
|
|
* <ul> |
19
|
|
|
* <li>You will not be able to receive updates using getUpdates for as long as an outgoing webhook is set up.</li> |
20
|
|
|
* <li>To use a self-signed certificate, you need to upload your public key certificate using certificate parameter. |
21
|
|
|
* Please upload as InputFile, sending a String will not work.</li> |
22
|
|
|
* <li>Ports currently supported for Webhooks: 443, 80, 88, 8443.</li> |
23
|
|
|
* </ul> |
24
|
|
|
* |
25
|
|
|
* @see https://core.telegram.org/bots/api#setwebhook |
26
|
|
|
*/ |
27
|
|
|
class SetWebhook extends TelegramMethods |
28
|
|
|
{ |
29
|
|
|
/** |
30
|
|
|
* Optional. HTTPS url to send updates to. Use an empty string to remove webhook integration |
31
|
|
|
* @var string |
32
|
|
|
*/ |
33
|
|
|
public $url = ''; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* Optional. Upload your public key certificate so that the root certificate in use can be checked. See our |
37
|
|
|
* self-signed guide for details. |
38
|
|
|
* @var string |
39
|
|
|
*/ |
40
|
|
|
public $certificate = ''; |
41
|
|
|
|
42
|
|
|
public static function bindToObjectType(): string |
43
|
|
|
{ |
44
|
|
|
return 'Custom\\ResultBoolean'; |
45
|
|
|
} |
46
|
|
|
} |
47
|
|
|
|