Telegram-bot-sdk: How to use the version 3 in Laravel

Created on 15 Mar 2017  路  13Comments  路  Source: irazasyed/telegram-bot-sdk

How should to add and use the version 3 of SDK in Laravel.
All the documentation are for V2!
When will you release it? Just say a date plz!
Best

Most helpful comment

@behnamazimi Here you go: https://github.com/irazasyed/telegram-bot-laravel-starter

Just created now! Hope that helps.

All 13 comments

Hi,

You should change your composer.json

"require": {
    "irazasyed/telegram-bot-sdk": "dev-master",

I update to V3 for the Keyboard objects and works fine on my little bot :grimacing: .

@juniorZavaleta, thanks for your reply.
Could I ask you to share your little bot as repository? I have some stupidly issues and I think a sample could help me.
Best

@behnamazimi I'm so sorry, for the moment I can't do that. Actually it's a private repository :disappointed:

Oops! I really need a real sample. Because in most cases l could not realize the relations beetwen objects and the documentation. For example in documentaion they used Telegram class and its static methods like getWebhookUpdate but in my case there is just an Api class.
I realy confused and l dont know what should l do!!!

@behnamazimi I can't give a date as I'm very busy with my on-going work and having a hard time managing this project. The only things that are missing in V3 are the docs and a few bugs here and there.

Until that happens, you'll have to read the code and understand but TBH, you don't need to look at the objects, or the methods directories as those are connected to the Api class which does all the job for you and just like in V2 you do it.

@irazasyed Thanks a lot and I hope your on-going work be done soon successfully.
In an other issue I asked how to use the sdk in the Laravel and you replied that I must use the Telegram class and I don't have need to use any new instance of Api class.
There is no Telegram class or namespace in sdk!
For example I could not use this format and syntax for my little test bot:
$updates = Telegram::getWebhookUpdates();
What is my wrong? I really rummaged the documentation but I'm still confused!

@behnamazimi No problem.

Telegram is a facade in Laravel. Please refer Laravel docs and Laravel part of the section of this package.

Refer this section.

That is initial setup before everything else. Once you do that, you'll then be able to use the facade.

@irazasyed I did it before! I checked that steps several times!
However thanks a lot. 馃槉

Well, then you should've added this facade in your config/app.php file:

'Telegram'  => Telegram\Bot\Laravel\Facades\Telegram::class

You will then be able to use it.

You can also import it on top of your file:

use Telegram\Bot\Laravel\Facades\Telegram;

@irazasyed I realy did it...
See this plz.

That'll work. Just add a comment to refer to Api class if you want to use the auto-completion. Execute that and see. Don't rely on the message of your IDE. It doesn't know how facades work.

@irazasyed Not Working!
I really need a sample in the Laravel! 馃様馃槩
No matter...

@behnamazimi Here you go: https://github.com/irazasyed/telegram-bot-laravel-starter

Just created now! Hope that helps.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

behnamazimi picture behnamazimi  路  3Comments

YaroslavStrigun picture YaroslavStrigun  路  4Comments

behnamazimi picture behnamazimi  路  4Comments

dswtech picture dswtech  路  4Comments

maminbajand picture maminbajand  路  4Comments