Skip to content

Instantly share code, notes, and snippets.

@u-mulder
Created Jun 5, 2016
Embed
What would you like to do?
Send setWebhook to TelegramBot
<?php
define('BOT_TOKEN', 'YOUR_BOT_TOKEN_HERE');
$wh_url = 'YOUR_WEB_HOOK_URL'; // must support https!
$url = 'https://api.telegram.org/bot' . BOT_TOKEN . '/setWebhook?' . http_build_query(['url' => $wh_url]);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$r = curl_exec($ch);
curl_close($ch);
var_dump($r);
// If webhook was set - response is:
// "{"ok":true,"result":true,"description":"Webhook was set"}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment