add_action('wpcf7_mail_sent', 'cf7_send_to_telegram_with_static_image'); function cf7_send_to_telegram_with_static_image($contact_form) { $submission = WPCF7_Submission::get_instance(); if (!$submission) return; $data = $submission->get_posted_data(); $name = sanitize_text_field($data['your-name']); $email = sanitize_email($data['your-email']); $order_id = sanitize_text_field($data['your-order-id']); $category = sanitize_text_field($data['your-category']); $message = sanitize_textarea_field($data['your-message']); $token = '8082821430:AAGLgb78K2hx1CEfOixhZ3xEL5hCXkR0C_M'; $allowed_users = [151916075, 181993141]; $text = "🔔 *New Contact Form Submission*\n" . "━━━━━━━━━━━━━━━\n" . "👤 *Name:* $name\n" . "📧 *Email:* $email\n" . ($order_id ? "🧾 *Order ID:* $order_id\n" : "") . "📂 *Category:* $category\n" . "💬 *Message:*\n$message\n" . "━━━━━━━━━━━━━━━"; // Вставь сюда ссылку на статичную картинку (пример с иконкой alerts) $image_url = 'https://stlmodels.com/alert.webp'; foreach ($allowed_users as $chat_id) { $send_url = "https://api.telegram.org/bot$token/sendPhoto"; $post_fields = [ 'chat_id' => $chat_id, 'photo' => $image_url, 'caption' => $text, 'parse_mode' => 'Markdown', ]; wp_remote_post($send_url, ['body' => $post_fields]); } } 3D Printable Models | STLmodels.com | Page 34

Felicia DarkStalkers