Skip to content

Instantly share code, notes, and snippets.

@mosessoh
Created September 27, 2017 13:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mosessoh/c047821e963562cc5701802ad3b6e147 to your computer and use it in GitHub Desktop.
Save mosessoh/c047821e963562cc5701802ad3b6e147 to your computer and use it in GitHub Desktop.
Set webhook for Telegram API
from pprint import pprint
import requests
bot_token = <your-bot-token>
test_url = "<your-https-url>/{}".format(bot_token)
def get_url(method):
return "https://api.telegram.org/bot{}/{}".format(bot_token,method)
r = requests.get(get_url("setWebhook"), data={"url": test_url})
r = requests.get(get_url("getWebhookInfo"))
pprint(r.status_code)
pprint(r.json())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment