BOTWIZARD Documentation

Applying custom blocks

Custom blocks can be used to add new functionality to the bot while also adding visual blocks in the script editor. If you are a developer, check out the article - methods for working with custom blocks.

Block example

Any conclusions, fields (checkmarks, text or script file upload), and 2 buttons (information and block settings on the external page) can be added to the block. You independently determine the scheme of fields and conclusions of the block when registering a new block. Once a block is saved, it is not possible to change the schema.

Block information and settings button

Available to use 2 buttons. Both buttons open a small iframe window right inside the script editor that will display your page (settings or info). An access_token is automatically sent to your page using the POST method, containing the token of the current user who is viewing your application.

Call handler

Set the block to the desired location in the script. When the subscriber sends a message to the chat and the block is launched, a request will be sent to your server. You can manage the state of the chat, determine the further course of the script, etc. For convenience, the API access key is immediately included in the request. You can specify from which user the request is made (for whom the token is issued) in the block itself (the user must be a member of the bot, it is mandatory). The issued token is active for a short period of time (up to 4 hours), and it is subject to a bot restriction (you can only perform actions with the bot on which the block is registered).

PHP handler example


$params = filter_input(INPUT_POST, 'payload');
$data = json_decode($params, true);
$lines = ['It Works!'];
$keys = ['customer', 'profile', 'message', 'formdata', 'extra'];

if (is_array($data)) {
    foreach ($keys as $key) {
        if (!empty($data[$key])) {
                    str_repeat('=', 8),

$res = [
    'new_fields' => [
            'node_id' => -1,
            'key' => 'my_field',
            'datatype' => 'string',
            'field_name' => 'Myfield',
            'uservar' => 'my_field',
            'value' => 'test',
            'hash' => md5('test'),
    'data' => json_encode([
        'test' => 'Y',
        'amount' => rand(5, 100),
        'code' => 'xxx-xxx-xxx-xxx',
    'replymsg' => json_encode([
            'type' => 'text',
            '_text' => implode(PHP_EOL, $lines),
            'type' => 'image',
            '_text' => 'Rose',
            '_url' => '',
        // next_block_id = Node ID
        // next = out0, out1, out2, out3

header('content-type: application/json; charset=utf-8');
echo json_encode([
    'success' => true,
    'message' => '',
    'result' => json_encode($res),


The request includes all the required data. The call uses the same component as the [RPC] block (#3423487), so the parameters are similar. An exception is the "extra" parameter, which adds block information and an access token. An example is below.

EM: test
{"type":"text","_text":"HELLO WORLD",