This bot demonstrates how to implement a basic Telegram chat bot in PHP, as described in this article.
To fully take advantage of this repository, the following dependencies should be met
- PHP 7.2+
- Installed
beyondcode/expose
To get started, adjust composer.json
and add a --subdomain=<YOUR_SUBDOMAIN>
option to the dev
script.
Second, update the WEBHOOK_URL
variable in .env
to correspond to <YOUR_SUBDOMAIN>.sharedwithexpose.com
.
Once that is settled, please gather a Telegram token from @Botfather on Telegram and add it to the provided .env
file.
Then, your own Telegram chat ID using @RawDataBot and insert it as well.
Finally, run the following things:
$ composer install
$ php setup.php
$ composer run dev
After running these commands you should have received a message from your bot stating that your webhook has been set up correctly. You can now begin adding commands to your bot!
If you'd like to see more repositories and tutorials like this, consider following me on Twitter or subscribing to my newsletter.