fix(formatter+telegram): drop tel: inline button, mark all 4xx as permanent
Pilot on washanyanya.ru exposed that Telegram Bot API rejects tel: URLs in inline_keyboard with HTTP 400 "Wrong port number specified in the URL". Queue was stuck on 5 items retrying the same failure 4 times each. - MessageFormatter: always returns reply_markup = null. The phone number is already rendered in the '📱 ...' line, and mobile Telegram clients linkify it automatically. - TelegramClient::is_permanent: treat all 4xx except 429 as permanent client-side errors, so future payload-shape bugs surface in the dashboard widget immediately instead of burning five retry cycles. - MessageFormatterTest updated: the old test asserting tel: in reply_markup is replaced with one asserting reply_markup is null and the phone still appears in the text body. - Spec §9 + §19 updated, §19's open question closed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -249,8 +249,7 @@ apply_filters('cf7stg_classifier_thresholds', ['client' => 3, 'spam' => -2]);
|
||||
```
|
||||
|
||||
**Inline-клавиатура:**
|
||||
- Если распарсился валидный RU-телефон — одна кнопка `"📞 Позвонить: {phone_formatted}"` → `url: "tel:{e164}"`.
|
||||
- Без телефона — `reply_markup = null` (кнопок нет).
|
||||
- `reply_markup = null` всегда. Telegram Bot API отклоняет `tel:` URLs в inline_keyboard с ошибкой HTTP 400 `Wrong port number specified in the URL`. Номер показывается в теле сообщения (строка `📱 ...`), мобильный TG-клиент автоматически делает его кликабельным.
|
||||
|
||||
**Site title:** `Settings::get_site_title()` возвращает либо оверрайд из настроек, либо декодированный через `idn_to_utf8()` host из `home_url()`. Например, `xn--80aae0ca7d8bb.xn--p1ai` → `вашаняня.рф`.
|
||||
|
||||
@@ -397,6 +396,6 @@ $schedules['cf7stg_every_minute'] = ['interval' => 60, 'display' => 'Раз в
|
||||
|
||||
## 19. Открытые вопросы (решаем во время реализации)
|
||||
|
||||
1. **`tel:`-ссылки в inline-кнопках Telegram.** Bot API документация разрешает только `http/https/tg`, но практика показывает, что `tel:` работает в клиентах. Проверить на первом пилотном сайте; если Telegram отклонит — fallback: показать номер текстом без кнопки, добавить префикс `📞 ` для ясности.
|
||||
1. ~~**`tel:`-ссылки в inline-кнопках Telegram.**~~ **РЕШЕНО (2026-04-17 пилот).** Telegram Bot API отклонил `tel:` URLs (HTTP 400, `Wrong port number specified in the URL`). Inline-кнопки полностью убраны; номер показывается в теле сообщения, мобильные клиенты сами делают его кликабельным.
|
||||
2. **Извлечение `flamingo_post_id`.** Flamingo не даёт прямой ссылки submission→post после сохранения. План: после сохранения Flamingo (`wpcf7_submission` priority 20) искать в `wp_posts` записи `post_type=flamingo_inbound`, sort by date DESC, limit 1, фильтр по содержимому `post_content` (сравнение с полями submission). Если совпадение ненадёжное — плагин всё равно работает (`flamingo_post_id = NULL`, dedup ретро-выгрузки пропускается для этой записи, но основной поток не зависит от наличия id).
|
||||
3. **Акцент HTML vs MarkdownV2.** Если в процессе пилота выяснится, что клиенты часто пишут символы, ломающие HTML даже после экранирования — рассмотреть переход на plain text (без форматирования, эмодзи — unicode-символы, не требуют разметки).
|
||||
|
||||
Reference in New Issue
Block a user