Telegram SetWebHook Self Signed Certificate

ssl ssl-certificate telegram telegram-bot

885 просмотра

1 ответ

2125 Репутация автора

I'm Trying to Send a Self Signed Certificate To telegram . The Configuration will be done through PostMan And My Bot Server is Ok (tests through getUpdates and action call over ssl connection responded successfully).

Here is what i send to telegram : TOKEN/setWebhook?url=MY SWERVER IP:443/api/webhook

and i DO attach the PUBLICKEY.pem as a binary body to the request.

Here is what i get :

{ "ok": true, "result": true, "description": "Webhook was set" }

the problem is when i check the webHook via getWebHookInfo :

  "ok": true,
  "result": {
    "url": "",
    "has_custom_certificate": false,
    "pending_update_count": 5,
    "last_error_date": 1476206652,
    "last_error_message": "Connection timed out"

in which the attribute "has_custom_certificate" : false means it did't get my certificate :\

What am i doing wrong here ?

Any alternatives to PostMan ??

One Step Further

I tried the HttpClient as below but it didn't work eighter :\

public string SetWebHook()
        FileStream paramFileStream = new FileStream(@"E:\PATH.......\YOURPUBLIC.pem", FileMode.Open);
        HttpContent fileStreamContent = new StreamContent(paramFileStream);
        var response = string.Empty;
        using (var client = new HttpClient())
        using (var formData = new MultipartFormDataContent())
            formData.Add(fileStreamContent, "Certificate", "YOURPUBLIC.pem");
             response = client.PostAsync("", formData).Result.ToString();
        return response;
Автор: AmiNadimi Источник Размещён: 18.07.2016 01:19

Ответы (1)

0 плюса

25 Репутация автора

You must use curl to upload your certificate (pem)
You should use HTTPS:// for your url

Автор: Bahram Boroumandan Размещён: 02.12.2016 05:06
Вопросы из категории :