- A web server SSL-encrypted with a public url (apache, nginx, caddy, etc....)
- PHP
- curl binding for php (
php5-curl
package in Ubuntu) - SQLite3 for php (
php-sqlite3
package in Ubuntu)
- Clone this repository in the document root of the webserver, or any other folder inside it (anything accesible from a browser is valid):
- https://example.com/index.php
- https://example.com/llubot/index.php
- https://example.com/somefolder/llubot/index.php
-
Copy sample_config.php to config.php:
cp sample_config.php config.php
-
Edit config.php:
-
Substitute SECRETKEY with any random string
-
Substitute SECRETTOKEN with the token provided by @BotFather
-
Set the variable $botHook to the URL where the index.php is located.
The URL should end in: '?key='.$_GET['key']
If the URL to my index.php is: https://SECRETURL/llubot/index.php
Then: $botHook = 'https://SECRETURL/llubot/?key='.$_GET['key'];
-
Visit this URL in your browser to setup the webhook:
https://SECRETURL/?key=SECRETKEY&setHook
Replacing SECRETKEY with the one choosen before and SECRETURL with the URL prefix set in step 1. For example: https://example.com/ or https://example.com/llubot/.
Once the webhook is set, the bot should work. It is NOT neccesary to update again the webhook when the code is changed. Once the webhook is set, telegram will remember it.