PHP Classes
elePHPant
Icontem

File: readme-telegram.md

Recommend this page to a friend!
  Classes of Marcel Pociot  >  PHP Slack Bot  >  readme-telegram.md  >  Download  
File: readme-telegram.md
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: PHP Slack Bot
Robot to automate interactions with Slack users
Author: By
Last change: Work on readme
Date: 1 month ago
Size: 1,297 bytes
 

Contents

Class file image Download

BotMan with Telegram

> To connect BotMan with your Telegram Bot, you first need to follow the official guide to create your Telegram Bot and an access token.

Once you have obtained the access token, place it in your BotMan configuration.

Laravel

For Laravel, the access token needs to be in your config/services.php file

    'botman' => [
    	'telegram_token' => 'YOUR-TELEGRAM-TOKEN-HERE',
    ],

Generic

If you don't use Laravel, you can pass the Telegram access token to the BotManFactory upon initialization.

$botman = BotManFactory::create([
    'telegram_token' => 'YOUR-TELEGRAM-TOKEN-HERE',
]);

Register your Webhook

To let your Telegram Bot know, how it can communicate with your BotMan bot, you have to register the URL where BotMan is running at, with Telegram.

You can do this by sending a POST request to this URL:

https://api.telegram.org/bot<YOUR-TELEGRAM-TOKEN-HERE>/setWebhook

This POST request needs only one parameter called url with the URL that points to your BotMan logic / controller.

> If you are using Laravel Valet, you can get an external URL for testing using the valet share command.

And that's it - you can now use BotMan with your Telegram bot!