К содержанию
TelegaFirst

Для AI-агентов: markdown этой страницы — /docs/mcp-tool-site-form-declare.mdиндекс документации — /llms.txt

site_form_declare

Обновлено

Declare a form BEFORE BUILDING PAGES; returns `client_slug`, `code`, `submit_snippet` (OFFICIAL: `<form data-tgf-form="{code}">` + your fields + `<script src="/widget/forms.v1.js" async>`) and `mini_app_links`. Paste it; NEVER hand-write the POST or use `no-cors` (opaque: no result shows). It runs `after_submit`, emits `tgf:submitted`/`tgf:failed`/`tgf:refused`. Keep its `tgf_consent_pd` box (unticked, required, absolute `/consent`, `/privacy` links): unticked, it sends nothing. `id` UPDATES (same address); omit for a NEW form. It sets the ENVELOPE, not fields. `destinations`: `{"kind":"telegram","topic_id":<id>}`, `{"kind":"webhook","url":"https://…"}`, `{"kind":"external_api","url":"https://…","method":"POST","header_name":"X-Api-Key","secret_name":"<secret name>"}`; first add its origin via `site_egress_origin_set`. `allowed_origins`: the site's addresses. Stop with `enabled: false`. `after_submit`: `{"mode":"auto"}` (your `title`/`text`, bot button, opt. `button_label`) or `{"mode":"redirect","redirect_url":"https://…"}` (own hosts or `allowed_origins`). `variants`: step `step_id` + exactly one of `when` (`funnel_mode: "deterministic"`, first by `sort`) or `hint` (`"ai_agent"`); `when`: non-empty ARRAY (≤20 predicates, all match): `[{"op":"eq","field":"band","value":"high"}]` (`op`: eq, neq, gt, gte, lt, lte, contains, in with `values`, exists, absent; OR = another entry); `default_step_id` if none matches. `manager_follow_up: true` adds an AI Manager reply; `call_operator_on_submit`/`calls_operator` call an operator. `funnel_outcome: "checkout"` + `catalog_id`: FREE item → order on submit; PAID or anything missing → bot-chat checkout; answers and `hidden` fields → operator-only order comment. NOT a patch: an omitted optional RESETS, except `order_mode`, `catalog_id` (kept). `submission_schema` (`[{"name":"phone","type":"tel","required":true,"label":"Phone"}]`) refuses a submission breaking it; names = your inputs. Give every field a human `label`; metadata → `hidden: true`.

Права и условия

required_scopes: ALL.

ПолеЗначение
description"Declare a form BEFORE BUILDING PAGES; returns `client_slug`, `code`, `submit_snippet` (OFFICIAL: `<form data-tgf-form=\"{code}\">` + your fields + `<script src=\"/widget/forms.v1.js\" async>`) and `mini_app_links`. Paste it; NEVER hand-write the POST or use `no-cors` (opaque: no result shows). It runs `after_submit`, emits `tgf:submitted`/`tgf:failed`/`tgf:refused`. Keep its `tgf_consent_pd` box (unticked, required, absolute `/consent`, `/privacy` links): unticked, it sends nothing. `id` UPDATES (same address); omit for a NEW form. It sets the ENVELOPE, not fields. `destinations`: `{\"kind\":\"telegram\",\"topic_id\":<id>}`, `{\"kind\":\"webhook\",\"url\":\"https://…\"}`, `{\"kind\":\"external_api\",\"url\":\"https://…\",\"method\":\"POST\",\"header_name\":\"X-Api-Key\",\"secret_name\":\"<secret name>\"}`; first add its origin via `site_egress_origin_set`. `allowed_origins`: the site's addresses. Stop with `enabled: false`. `after_submit`: `{\"mode\":\"auto\"}` (your `title`/`text`, bot button, opt. `button_label`) or `{\"mode\":\"redirect\",\"redirect_url\":\"https://…\"}` (own hosts or `allowed_origins`). `variants`: step `step_id` + exactly one of `when` (`funnel_mode: \"deterministic\"`, first by `sort`) or `hint` (`\"ai_agent\"`); `when`: non-empty ARRAY (≤20 predicates, all match): `[{\"op\":\"eq\",\"field\":\"band\",\"value\":\"high\"}]` (`op`: eq, neq, gt, gte, lt, lte, contains, in with `values`, exists, absent; OR = another entry); `default_step_id` if none matches. `manager_follow_up: true` adds an AI Manager reply; `call_operator_on_submit`/`calls_operator` call an operator. `funnel_outcome: \"checkout\"` + `catalog_id`: FREE item → order on submit; PAID or anything missing → bot-chat checkout; answers and `hidden` fields → operator-only order comment. NOT a patch: an omitted optional RESETS, except `order_mode`, `catalog_id` (kept). `submission_schema` (`[{\"name\":\"phone\",\"type\":\"tel\",\"required\":true,\"label\":\"Phone\"}]`) refuses a submission breaking it; names = your inputs. Give every field a human `label`; metadata → `hidden: true`."
domain"site"
name"site_form_declare"
platform_version"1.0.34"
required_scopes["site:write"]
risk"write"
scope"site:write"
title"Site Form Declare"

Входные параметры

site_form_declare: inputSchema

Результат

site_form_declare: outputSchema