'abds_ln_bot_token', 'nt_chat_id' => 'abds_ln_chat_id', 'nt_enabled' => 'abds_ln_enabled', ) as $old => $new ) { $v = get_option( $old, null ); if ( null !== $v && '' === (string) get_option( $new, '' ) ) { update_option( $new, $v ); } } /** Lets the Pro add-on run its own migrations (e.g. ensure its chat tables). */ do_action( 'abds_connect_migrate' ); } add_action( 'admin_init', 'abds_connect_migrate' ); /* ------------------------- Налаштування ------------------------- */ /** * Registers the free plugin's own setting: the shared licence key (read by * both this plugin and, once installed, the Pro add-on). */ function abds_connect_register_core() { register_setting( 'abds_connect', 'abds_license_key', array( 'sanitize_callback' => 'sanitize_text_field', 'default' => '', ) ); } add_action( 'admin_init', 'abds_connect_register_core' ); /** * Registers the top-level ABDS Connect admin menu page. */ function abds_connect_menu() { $hook = add_menu_page( 'ABDS Connect', 'ABDS Connect', 'manage_options', 'abds-connect', 'abds_connect_page', 'dashicons-format-chat', 58 ); add_action( 'admin_enqueue_scripts', function ( $current_hook ) use ( $hook ) { abds_connect_enqueue_settings_assets( $current_hook, $hook ); } ); } add_action( 'admin_menu', 'abds_connect_menu' ); /** * Loads the settings screen's JS/CSS, only on that one screen. * * @param string $current_hook The hook suffix of the screen being rendered. * @param string $our_hook The ABDS Connect settings screen's own hook suffix. */ function abds_connect_enqueue_settings_assets( $current_hook, $our_hook ) { if ( $current_hook !== $our_hook ) { return; } wp_enqueue_style( 'abds-connect-admin', ABDS_CONNECT_URL . 'assets/css/admin-settings.css', array(), ABDS_CONNECT_VER ); wp_enqueue_script( 'abds-connect-admin', ABDS_CONNECT_URL . 'assets/js/admin-settings.js', array(), ABDS_CONNECT_VER, true ); wp_localize_script( 'abds-connect-admin', 'abdsConnectSettings', array( 'ajaxUrl' => admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( 'abds_connect_test_message' ), 'i18n' => array( 'sending' => 'Надсилаємо…', 'button' => 'Надіслати тестове повідомлення', ), ) ); } /** * Adds a "Налаштування" (Settings) link to the plugin's row on the Plugins * screen. * * @param string[] $links Existing action links. * @return string[] */ function abds_connect_action_links( $links ) { $links[] = '' . esc_html__( 'Налаштування', 'abds-connect' ) . ''; return $links; } add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'abds_connect_action_links' ); /** * Renders the ABDS Connect settings page: the leads → Telegram module, the * detected form sources, the licence field, and (via action hooks) the Pro * add-on's own sections when it's installed. Native wp-admin `.card` groups, * in onboarding order — Telegram first, since it's the only thing a fresh * install needs before it does anything useful. */ function abds_connect_page() { if ( ! current_user_can( 'manage_options' ) ) { return; } $pro = abds_is_pro(); $has_token = '' !== trim( (string) get_option( 'abds_ln_bot_token', '' ) ); $tg = abds_ln_telegram_status(); ?>

ABDS Connect

Заявки з форм у Telegram — безкоштовно. Живий чат і AI-асистент — у доповненні ABDS Connect Pro.

1. Заявки → Telegram безкоштовно

Крок 1. У Telegram напишіть @BotFather, надішліть команду /newbot і скопіюйте виданий токен.

Крок 2. Дізнайтесь Chat ID: напишіть своєму новому боту будь-що, тоді відкрийте https://api.telegram.org/bot<токен>/getUpdates у браузері — chat.id буде у відповіді. Для групового чату спершу додайте бота в групу.

Крок 3. Вставте токен і Chat ID нижче, збережіть, тоді натисніть «Надіслати тестове повідомлення».

Бот підключений ✓ @ Не підключено

Джерела форм

Заявки з цих форм автоматично йдуть у Telegram, якщо джерело увімкнене нижче.

    $def ) : ?>
  • виявлено не знайдено

Ліцензія

Тариф: ABDS Connect Pro активний Тариф: Безкоштовний

Живий чат + AI-асистент Pro

Віджет живого чату на сайті з відповідями прямо з Telegram і AI-асистентом під ваш бізнес — у доповненні ABDS Connect Pro. Дізнатися більше.


Дії

'Недостатньо прав.' ), 403 ); } check_ajax_referer( 'abds_connect_test_message', 'nonce' ); $token = trim( (string) get_option( 'abds_ln_bot_token', '' ) ); $chat = trim( (string) get_option( 'abds_ln_chat_id', '' ) ); if ( '' === $token || '' === $chat ) { wp_send_json_error( array( 'message' => 'Спершу заповніть токен і Chat ID, збережіть налаштування.' ) ); } $res = abds_ln_send( $token, $chat, '✅ Тест заявок — ' . get_bloginfo( 'name' ) . "\nЧас: " . wp_date( 'Y-m-d H:i' ) ); if ( is_wp_error( $res ) ) { wp_send_json_error( array( 'message' => 'Не вдалося надіслати: ' . $res->get_error_message() ) ); } wp_send_json_success( array( 'message' => 'Надіслано, перевірте чат.' ) ); } add_action( 'wp_ajax_abds_connect_test_message', 'abds_connect_ajax_test_message' ); /* ------------------------- Повідомлення ------------------------- */ /** * Renders the post-redirect admin notice for the settings page (test-lead * result, chat-webhook connect/disconnect result), keyed by the * `abds_notice` query arg. */ function abds_connect_notices() { // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- read-only display of a post-redirect admin-notice flag; sanitized below, changes no state. if ( ! isset( $_GET['page'], $_GET['abds_notice'] ) || 'abds-connect' !== $_GET['page'] ) { return; } // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- same read-only notice flag as the guard above; mapped to a fixed message. $n = sanitize_key( wp_unslash( $_GET['abds_notice'] ) ); $map = array( 'hookok' => array( 'success', 'Webhook чату підключено — відповіді Reply з Telegram надходитимуть у чат.' ), 'hookfail' => array( 'error', 'Не вдалося підключити webhook чату. Перевірте токен бота чату.' ), 'hookdel' => array( 'success', 'Webhook чату відключено.' ), ); if ( isset( $map[ $n ] ) ) { printf( '

%s

', esc_attr( $map[ $n ][0] ), esc_html( $map[ $n ][1] ) ); } } add_action( 'admin_notices', 'abds_connect_notices' );