PHPackages                             diecoding/yii2-telegram-bot - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. diecoding/yii2-telegram-bot

ActiveYii2-component[API Development](/categories/api)

diecoding/yii2-telegram-bot
===========================

Yii2 Telegram Bot Api Component

114PHP

Since Mar 23Pushed 4y ago1 watchersCompare

[ Source](https://github.com/wanforge/yii2-telegram-bot)[ Packagist](https://packagist.org/packages/diecoding/yii2-telegram-bot)[ RSS](/packages/diecoding-yii2-telegram-bot/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

 Yii2 Telegram Bot
===================

[](#----yii2-telegram-bot)

 [![](https://camo.githubusercontent.com/f5c93bdade0ac8d93728c5e98a11348ec61281cbd0929192ccbcbe1dd3107bf9/68747470733a2f2f692e6962622e636f2f4a5178445a57482f74656c656772616d2e706e67)](https://camo.githubusercontent.com/f5c93bdade0ac8d93728c5e98a11348ec61281cbd0929192ccbcbe1dd3107bf9/68747470733a2f2f692e6962622e636f2f4a5178445a57482f74656c656772616d2e706e67)

 Yii2 Telegram Bot Api Component

[![Latest Stable Version](https://camo.githubusercontent.com/a61e0de55a01352d1008cee5f41ffbc2eb5af5837ceeca00ba71157e54388f45/68747470733a2f2f706f7365722e707567782e6f72672f6469652d636f64696e672f796969322d74656c656772616d2d626f742f76657273696f6e)](//packagist.org/packages/die-coding/yii2-telegram-bot)[![Total Downloads](https://camo.githubusercontent.com/85cf05691a4e0015666a7fcc959dbf4c441c4e61a01929f7ccef859e9fe0fa83/68747470733a2f2f706f7365722e707567782e6f72672f6469652d636f64696e672f796969322d74656c656772616d2d626f742f646f776e6c6f616473)](https://packagist.org/packages/die-coding/yii2-telegram-bot)[![Latest Unstable Version](https://camo.githubusercontent.com/482af8bd1303a645de9412437069045665e5817ebcd64a56ccd69024f556b53f/68747470733a2f2f706f7365722e707567782e6f72672f6469652d636f64696e672f796969322d74656c656772616d2d626f742f762f756e737461626c65)](https://packagist.org/packages/die-coding/yii2-telegram-bot)[![License](https://camo.githubusercontent.com/dc9c220e8da3c216c3629da285e1ae91c11152abc806b762dc1409559294c702/68747470733a2f2f706f7365722e707567782e6f72672f6469652d636f64696e672f796969322d74656c656772616d2d626f742f6c6963656e7365)](https://packagist.org/packages/die-coding/yii2-telegram-bot)[![Monthly Downloads](https://camo.githubusercontent.com/e755484c94caed5dce8a55251d1a571ce8e67d6fdc96f3ac62032c3b59d36488/68747470733a2f2f706f7365722e707567782e6f72672f6469652d636f64696e672f796969322d74656c656772616d2d626f742f642f6d6f6e74686c79)](https://packagist.org/packages/die-coding/yii2-telegram-bot)[![Daily Downloads](https://camo.githubusercontent.com/880b4590294624312e7ece2eabe7bf592934d7d049ed6eed8df5fcb7fc7f845b/68747470733a2f2f706f7365722e707567782e6f72672f6469652d636f64696e672f796969322d74656c656772616d2d626f742f642f6461696c79)](//packagist.org/packages/die-coding/yii2-telegram-bot)

Create your first bot
---------------------

[](#create-your-first-bot)

1. Message @botfather  with the following text: `/newbot` If you don't know how to message by username, click the search field on your Telegram app and type `@botfather`, where you should be able to initiate a conversation. Be careful not to send it to the wrong contact, because some users has similar usernames to `botfather`.

    [![createbot](assets/images/1.jpg)](assets/images/1.jpg)
2. @botfather replies with `Alright, a new bot. How are we going to call it? Please choose a name for your bot.`.
3. Type whatever name you want for your bot.
4. @botfather replies with `Good. Now let's choose a username for your bot. It must end in `bot`. Like this, for example: TetrisBot or tetris_bot.`.
5. Type whatever username you want for your bot, minimum 5 characters, and must end with bot. For example: `diecoding_yii2_bot`.
6. @botfather replies with:

    ```
    Done! Congratulations on your new bot. You will find it at t.me/diecoding_yii2_bot. You can now add a description, about section and profile picture for your bot, see /help for a list of commands. By the way, when you've finished creating your cool bot, ping our Bot Support if you want a better username for it. Just make sure the bot is fully operational before you do this.

    Use this token to access the HTTP API:
    5162536695:AAGdvgUMbNmTlL8sNW-SZHs32iHnTblPqEM
    Keep your token secure and store it safely, it can be used by anyone to control your bot.

    For a description of the Bot API, see this page: https://core.telegram.org/bots/api

    ```
7. Note down the 'token' mentioned above.
8. Type `/setprivacy` to @botfather.

    [![capture](assets/images/2.jpg)](assets/images/2.jpg)
9. @botfather replies with `Choose a bot to change group messages settings.`.
10. Type (or select) @PostMan\_bot (change to the username you set at step 5 above, but start it with @)
11. @botfather replies with.

    ```
    'Enable' - your bot will only receive messages that either start with the '/' symbol or mention the bot by username.
    'Disable' - your bot will receive all messages that people send to groups.
    Current status is: ENABLED

    ```
12. Type (or select) `Disable` to let your bot receive all messages sent to a group. This step is up to you actually.
13. @botfather replies with `Success! The new status is: DISABLED. /help`

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
composer require diecoding/yii2-telegram-bot "@dev"

```

or add

```
"diecoding/yii2-telegram-bot": "@dev"

```

to the require section of your `composer.json` file.

Method list usable
------------------

[](#method-list-usable)

list methods

```
getMe
sendMessage
forwardMessage
sendPhoto
sendAudio
sendDocument
sendSticker
sendVideo
sendLocation
sendChatAction
getUserProfilePhotos
getUpdates
setWebhook
getChat
getChatAdministrators
getChatMembersCount
getChatMember
answerCallbackQuery
editMessageText
editMessageCaption
sendGame
Game
Animation
CallbackGame
getGameHighScores
GameHighScore
answerInlineQuery
setChatStickerSet
deleteChatStickerSet
leaveChat
pinChatMessage
unpinChatMessage
setChatDescription
setChatTitle
deleteChatPhoto
exportChatInviteLink
promoteChatMember
restrictChatMember
unbanChatMember
kickChatMember
editMessageLiveLocation
stopMessageLiveLocation

```

Migration Table
---------------

[](#migration-table)

```
php yii migrate --migrationPath=@vendor/diecoding/yii2-telegram-bot/src/migrations

```

Usage
-----

[](#usage)

first add to `config.php`

```

```

Once the extension is installed, simply use it in your code by :

```
