Skip to content

Latest commit

 

History

History
32 lines (21 loc) · 694 Bytes

5.callback-data.md

File metadata and controls

32 lines (21 loc) · 694 Bytes
title navigation.title
Retrieve Callback Data
Callback Data

Callback query data must be defined with the following structure:

action:action_name;key1:foo;key2:bar

and will be handled by a public action_name method inside a custom webhook handler.

Telegraph implements some useful methods to interact with the received callback query:

Data can be retrieved from the payload using ->get() method:

class CustomWebhookHandler extends WebhookHandler
{
    public function dismiss(){
        //...

        $key1 = $this->data->get('key1'); //foo

        $key3 = $this->data->get('key1', 'default value'); //default value
    }
}