DEF STUDIO srl

Need help with Laravel and web development?

Hire one of our experts for your projects.

We build tailored products, websites and platforms — with care for UX, performance and maintainability.

Booking open for Q4 — limited slots

You are seeing the documentation for version 1, but the last version for this package is v1. Click here to go to the last version.

Message API calls

message()

compose a new telegram message (will use the default parse mode set up in config/telegraph.php)

Telegraph::message('hello')->send();

markdown()

compose a new telegram message (parsed as markdown)

Telegraph::markdown('*hello* world')->send();

markdownV2()

compose a new telegram message (parsed as markdownV2)

Telegraph::markdownV2('*hello* world')->send();

html()

compose a new telegram message (parsed as html)

Telegraph::html('<b>hello</b> world')->send();

when()

allows to execute a closure when the given condition is verified

Telegraph::when(true, fn(Telegraph $telegraph) => $telegraph->message('conditional message')->send());

edit()

edits a message

Telegraph::edit($messageId)->markdown('new message')->send();

document()

sends a document

Telegraph::document($documentPath)->send();

location()

sends a location attachment

Telegraph::location(12.345, -54.321)->send();

contact()

sens a contact attachment

Telegraph::contact('3331122111', 'firstName')->send();

photo()

sends a photo

Telegraph::photo($pathToPhotoFile)->send();

voice()

sends a vocal message

Telegraph::voice($pathToVoiceFile)->send();

mediaGroup()

sends a group of photos, videos, documents or audios as an album

Telegraph::mediaGroup([
        [
            'type' => 'photo',
            'media' => 'https://my-repository/photo1.jpg',
        ],
        [
            'type' => 'photo',
            'media' => 'https://my-repository/photo2.jpg',
        ]              
])->send();

editCaption()

edits an attachment caption

Telegraph::editCaption($messageId)->markdownV2('new caption')->send();

editMedia()

edits a media messages with a new media content

Telegraph::editMedia($messageId)->photo($path)->send();
Telegraph::editMedia($messageId)->document($path)->send();
Telegraph::editMedia($messageId)->animation($path)->send();
Telegraph::editMedia($messageId)->video($path)->send();
Telegraph::editMedia($messageId)->videoNote($path)->send();
Telegraph::editMedia($messageId)->audio($path)->send();

poll()

creates a native poll. For more info, see telegram bot documentation

Telegraph::poll("What's your favourite programming language?")
    ->option('php')
    ->option('typescript')
    ->option('rust')
    ->allowMultipeAnswers()
    ->validUntil(now()->addMinutes(5))
    ->send();

you can also pass an array of options if you wish

Telegraph::poll("What's your favourite programming language?")
    ->options(['php','typescript','rust'])
    ->allowMultipeAnswers()
    ->validUntil(now()->addMinutes(5))
    ->send();

quiz()

creates a quiz. For more info, see telegram bot documentation

Telegraph::quiz("What's your favourite programming language?")
    ->option('php', correct: true)
    ->option('typescript')
    ->option('rust')
    ->explanation('We all love php, right?')
    ->validUntil(now()->addMinutes(5))
    ->send();

you can also pass an array of options if you wish

Telegraph::quiz("What's your favourite programming language?")
    ->options(['php' => true, 'typescript', 'rust'])
    ->explanation('We all love php, right?')
    ->validUntil(now()->addMinutes(5))
    ->send();

thread()

set custom Telegraph Thread id

Telegraph::message('test')->inThread(thread_id);

business()

set custom Telegraph business connection id

Telegraph::message('test')->inBusiness(business_connection_id);
Suggest a change
Last updated 29 May 2026