# WhatsApp Flow फ़ॉर्म से जानकारी जुटाएं

> API से WhatsApp Flow बनाएं, उसे जांचें और पब्लिश करें, उसे चैट के भीतर या टेम्पलेट बटन से ग्राहक को भेजें, और अपने webhook पर भरे हुए फ़ील्ड पाएं।

इस गाइड में आप एक कोटेशन अनुरोध फ़ॉर्म बनाते हैं जो WhatsApp के भीतर खुलता है। ग्राहक अपना नाम देता है, एक सेवा चुनता है और पसंदीदा तारीख़ चुनता है, और आपके सिस्टम को जवाब फ़्री-टेक्स्ट चैट के बजाय साफ़ फ़ील्ड के रूप में मिलते हैं।

**ग्राहक को क्या दिखता है:** चैट में एक मैसेज, जिसमें **Request a quote** बटन है। बटन WhatsApp के भीतर एक फ़ॉर्म स्क्रीन खोलता है, जिसमें नाम का फ़ील्ड, सेवाओं की सूची और तारीख़ चुनने वाला है। वे **Send request** पर टैप करते हैं, फ़ॉर्म बंद हो जाता है, चैट में एक छोटा "Sent" जवाब दिखता है, और कुछ पल बाद आपका धन्यवाद मैसेज पहुंचता है।

**आपको क्या दिखता है:** API में flow और उसकी स्थिति, फ़ॉर्म को ब्राउज़र में आज़माने के लिए एक प्रीव्यू लिंक, फ़ॉर्म ले जाने वाले मैसेज के लिए `message.status` इवेंट, और `data.flow.response` में ग्राहक के जवाबों के साथ एक `message.received` इवेंट। जवाब Inbox और Activity Log में भी दिखता है।

## यह कैसे काम करता है

1. आप फ़ॉर्म को **Flow JSON** में बताते हैं (Flows के लिए WhatsApp का अपना फ़ॉर्मैट) और उसे `POST /flows` से बनाते हैं। वह ड्राफ़्ट के रूप में शुरू होता है, और जवाब में WhatsApp की validation त्रुटियां सूचीबद्ध होती हैं।
2. आप त्रुटियां `PUT /flows/{id}/json` से ठीक करते हैं, फ़ॉर्म को उसके प्रीव्यू लिंक से आज़माते हैं, और `POST /flows/{id}/publish` से उसे पब्लिश करते हैं।
3. आप फ़ॉर्म भेजते हैं। ग्राहक की 24 घंटे की विंडो के भीतर: interactive `flow` मैसेज के साथ `POST /messages`। उसके बाहर: Flow बटन वाला मंज़ूर टेम्पलेट।
4. ग्राहक उसे भरता है। आपके webhook को `type` `interactive`, `interactive.type` `nfm_reply` और एक `flow` ऑब्जेक्ट के साथ `message.received` मिलता है, जिसमें फ़ील्ड और आपका भेजा हुआ `flow_token` होता है।

<Note>
**Flows पूरे WhatsApp Business Account के होते हैं।** आपका बनाया, बदला, पब्लिश या deprecate किया हुआ flow उसी WhatsApp Business Account के हर नंबर में साझा होता है, और `flow.status_changed` हर नंबर को जाता है। ऐसे नाम इस्तेमाल करें जो बताएं कि flow किसलिए है।
</Note>

## आपको क्या चाहिए

- **app2email से जुड़ा एक WhatsApp नंबर**, सशुल्क प्लान पर और चालू। प्लान के बिना हर कॉल पर 403 `plan_not_allowed` आता है; रुकी हुई सेवा पर 403 `service_not_live`। देखें [शुरू करना](https://www.app2email.com/docs/onboarding)।
- **एक API key**, [API key पेज](https://www.app2email.com/dashboard/apikey) से, इन scopes के साथ:

| Scope | इस गाइड में यह किसलिए है |
| --- | --- |
| `templates:manage` | flow बनाना (`POST /flows`), उसका Flow JSON बदलना (`PUT /flows/{id}/json`), उसे पब्लिश करना (`POST /flows/{id}/publish`), नया प्रीव्यू लिंक बनाना, उसे deprecate करना या हटाना। साथ ही Flow बटन वाला टेम्पलेट बनाना (`POST /templates`) |
| `messages:read` | flows पढ़ना (`GET /flows`, `GET /flows/{id}`, `GET /flows/{id}/json`) और प्रीव्यू लिंक (`GET /flows/{id}/preview`) |
| `messages:send` | फ़ॉर्म और धन्यवाद मैसेज भेजना (`POST /messages`) |
| `webhooks:manage` | जवाब पाने वाला webhook रजिस्टर करना (`POST /webhooks`)। आप इसे API key पेज पर Webhooks के अंतर्गत भी जोड़ सकते हैं |

Default key (जो तब बनी जब keys में अनुमतियां नहीं थीं) में `templates:manage` नहीं है। उस scope वाली key बनाएं, या Full access (`*`) वाली। `GET /v1/YOUR_NUMBER/me` आपके पास मौजूद key के scopes दिखाता है।

- **एक webhook URL** जो हस्ताक्षर जांचता हो। अगर आपके पास अभी नहीं है, तो [API से WhatsApp चैटबॉट बनाएं](/guides/how-to-whatsapp-chatbot) चार चरणों में एक सेट करता है, आपके अपने कंप्यूटर के लिए टनल के साथ।

<Warning>
**यहां sandbox key क्या कर सकती है और क्या नहीं।** अपने नंबर पर sandbox key (sandbox फ़्लैग वाली key, जो API key पेज पर बनती है) flows **पढ़** सकती है (`GET /flows`, `GET /flows/{id}`, `GET /flows/{id}/json`, `GET /flows/{id}/preview`), और flow मैसेज के साथ `POST /messages` हर जांच चलाता है और कुछ नहीं भेजता: जवाब में `"sandbox": true` होता है, मैसेज id `wamid.SANDBOX.` से शुरू होता है, और `message.status` इवेंट फिर भी आते हैं। flows बनाना, बदलना, पब्लिश करना, deprecate करना और हटाना 403 `sandbox_key` देते हैं, क्योंकि वे आपका WhatsApp Business Account बदलते हैं। डेमो नंबर `12025550100` के तुरंत मिलने वाले sandbox में flow कॉल बिल्कुल नहीं हैं (403 `not_in_instant_sandbox`)। इसलिए: flow को सामान्य key से बनाएं और पब्लिश करें, उसे प्रीव्यू लिंक से आज़माएं, और अपने भेजने वाले कोड को sandbox key से जांचें। विवरण: [Sandbox](/api/sandbox)।
</Warning>

## फ़ॉर्म बनाएं और भेजें

हर कॉल `Authorization: Bearer YOUR_API_KEY` के साथ `https://api.app2email.com/v1/YOUR_NUMBER` पर जाती है। `YOUR_NUMBER` वह WhatsApp नंबर है जिससे आप भेजते हैं: पहले देश कोड, सिर्फ़ अंक।

<Steps>
  <Step title="फ़ॉर्म को Flow JSON में लिखें">
    flow स्क्रीनों की एक सूची है। इसमें एक स्क्रीन है, `QUOTE`, जिसमें एक शीर्षक, एक छोटा टेक्स्ट, तीन फ़ील्ड और एक बटन है। बटन की `complete` कार्रवाई फ़ॉर्म बंद करती है और उसका `payload` आपको वापस भेजती है: `${form.name}` `name` नाम के फ़ील्ड का मान है, और इसी तरह आगे। payload में आप जो नाम चुनते हैं वही वे फ़ील्ड नाम हैं जो आपको मिलते हैं।

    इसे `quote-request.json` के रूप में सहेजें:

    ```json quote-request.json
    {
      "version": "7.2",
      "screens": [
        {
          "id": "QUOTE",
          "title": "Request a quote",
          "terminal": true,
          "success": true,
          "data": {},
          "layout": {
            "type": "SingleColumnLayout",
            "children": [
              { "type": "TextHeading", "text": "Tell us what you need" },
              { "type": "TextBody", "text": "We answer every request within one working day." },
              { "type": "TextInput", "name": "name", "label": "Your name", "input-type": "text", "required": true },
              {
                "type": "Dropdown",
                "name": "service",
                "label": "Service",
                "required": true,
                "data-source": [
                  { "id": "window_cleaning", "title": "Window cleaning" },
                  { "id": "gutter_cleaning", "title": "Gutter cleaning" },
                  { "id": "pressure_washing", "title": "Pressure washing" }
                ]
              },
              { "type": "DatePicker", "name": "preferred_date", "label": "Preferred date", "required": true },
              {
                "type": "Footer",
                "label": "Send request",
                "on-click-action": {
                  "name": "complete",
                  "payload": {
                    "name": "${form.name}",
                    "service": "${form.service}",
                    "preferred_date": "${form.preferred_date}"
                  }
                }
              }
            ]
          }
        }
      ]
    }
    ```

    घटक (`TextHeading`, `TextInput`, `Dropdown`, `DatePicker`, `Footer` ...) और उनके गुण WhatsApp के हैं, app2email के नहीं: app2email Flow JSON को जैसा है वैसा WhatsApp को देता है, और WhatsApp उसे जांचता है। हर घटक के लिए [WhatsApp Flows पर Meta की गाइड](https://developers.facebook.com/documentation/business-messaging/whatsapp/flows/guides/sendingaflow) देखें। जब ग्राहक इसे भरता है तब इस फ़ॉर्म को आपके अपने किसी सर्वर की ज़रूरत नहीं: सब कुछ JSON में है, और जवाब एक मैसेज में वापस आते हैं।
  </Step>
  <Step title="flow को ड्राफ़्ट के रूप में बनाएं">
    `POST /flows` (scope `templates:manage`) एक `name` (आंतरिक, ग्राहक इसे नहीं देखते, 200 अक्षर तक), `categories` में से कम से कम एक (`SIGN_UP`, `SIGN_IN`, `APPOINTMENT_BOOKING`, `LEAD_GENERATION`, `CONTACT_US`, `CUSTOMER_SUPPORT`, `SURVEY`, `OTHER`) और `flow_json` (एक ऑब्जेक्ट या स्ट्रिंग, अधिकतम 10 MB) लेता है।

    <CodeGroup>

    ```bash cURL
    # Builds the body from the file with jq, then creates the draft
    jq -n --slurpfile f quote-request.json \
      '{name: "quote_request", categories: ["LEAD_GENERATION"], flow_json: $f[0]}' |
    curl -X POST https://api.app2email.com/v1/YOUR_NUMBER/flows \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      --data @-
    ```

    ```javascript Node.js
    import { readFile } from "node:fs/promises";

    const flowJson = JSON.parse(await readFile("quote-request.json", "utf8"));
    const res = await fetch("https://api.app2email.com/v1/YOUR_NUMBER/flows", {
      method: "POST",
      headers: { Authorization: `Bearer ${process.env.API_KEY}`, "Content-Type": "application/json" },
      body: JSON.stringify({ name: "quote_request", categories: ["LEAD_GENERATION"], flow_json: flowJson }),
    });
    const created = await res.json();
    console.log(res.status, created.flow?.id, created.validation_errors);
    ```

    ```python Python
    import json, os, requests

    with open("quote-request.json") as f:
        flow_json = json.load(f)
    res = requests.post("https://api.app2email.com/v1/YOUR_NUMBER/flows",
                        headers={"Authorization": f"Bearer {os.environ['API_KEY']}"},
                        json={"name": "quote_request", "categories": ["LEAD_GENERATION"], "flow_json": flow_json},
                        timeout=30)
    created = res.json()
    print(res.status_code, created.get("flow", {}).get("id"), created.get("validation_errors"))
    ```

    </CodeGroup>

    **जवाब में आपको क्या मिलता है** (201 Created):

    ```json
    {
      "success": true,
      "request_id": "f1new",
      "flow": {
        "id": "1234567890123456",
        "name": "quote_request",
        "status": "DRAFT"
      },
      "validation_errors": [],
      "note": "The flow belongs to the whole WhatsApp Business Account: every number on it can send it."
    }
    ```

    `flow.id` रखें: हर दूसरी कॉल और आपका भेजा मैसेज इसी का इस्तेमाल करते हैं। खाली `validation_errors` का मतलब है कि WhatsApp को ठीक करने लायक कुछ नहीं मिला। जो नाम अकाउंट पहले से इस्तेमाल कर रहा है उस पर 409 `flow_name_taken` आता है।

    उसी body में `"publish": true` के साथ, बिना त्रुटि वाला flow तुरंत पब्लिश हो जाता है। इसे पलटा नहीं जा सकता, इसलिए यह गाइड फ़ॉर्म को आज़माने के बाद अलग चरण में पब्लिश करती है। `clone_flow_id` इसके बजाय उसी अकाउंट के किसी मौजूदा flow की नकल बनाता है।
  </Step>
  <Step title="validation त्रुटियां ठीक करें">
    जब WhatsApp को समस्याएं मिलती हैं, तब भी flow ड्राफ़्ट के रूप में बन जाता है, और `validation_errors` हर एक को WhatsApp के `error`, `error_type` और `message`, JSON में जगह (`line_start`, `line_end`, `column_start`, `column_end`) और `pointers` के साथ सूचीबद्ध करता है। उदाहरण के लिए, किसी घटक के `type` में टाइपिंग की गलती के बाद (छोटा किया हुआ, टेक्स्ट WhatsApp का है):

    ```json
    {
      "success": true,
      "request_id": "f1new",
      "flow": { "id": "1234567890123456", "name": "quote_request", "status": "DRAFT" },
      "validation_errors": [
        {
          "error": "INVALID_PROPERTY_VALUE",
          "error_type": "FLOW_JSON_ERROR",
          "message": "Invalid value found for property 'type'.",
          "line_start": 15,
          "line_end": 15,
          "column_start": 25,
          "column_end": 36
        }
      ]
    }
    ```

    फ़ाइल सुधारें और पूरा Flow JSON `PUT /flows/{id}/json` (scope `templates:manage`) से फिर भेजें। body खुद Flow JSON है (या `{"flow_json": {...}}`), अधिकतम 10 MB।

    <CodeGroup>

    ```bash cURL
    curl -X PUT https://api.app2email.com/v1/YOUR_NUMBER/flows/1234567890123456/json \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      --data @quote-request.json
    ```

    ```javascript Node.js
    const res = await fetch("https://api.app2email.com/v1/YOUR_NUMBER/flows/1234567890123456/json", {
      method: "PUT",
      headers: { Authorization: `Bearer ${process.env.API_KEY}`, "Content-Type": "application/json" },
      body: await readFile("quote-request.json", "utf8"),
    });
    console.log((await res.json()).validation_errors);
    ```

    ```python Python
    with open("quote-request.json", "rb") as f:
        res = requests.put("https://api.app2email.com/v1/YOUR_NUMBER/flows/1234567890123456/json",
                           headers={"Authorization": f"Bearer {os.environ['API_KEY']}",
                                    "Content-Type": "application/json"},
                           data=f.read(), timeout=30)
    print(res.json()["validation_errors"])
    ```

    </CodeGroup>

    **जवाब में आपको क्या मिलता है:**

    ```json
    {
      "success": true,
      "request_id": "f1put",
      "flow_id": "1234567890123456",
      "validation_errors": [],
      "note": "WhatsApp found no errors. Publish with POST /flows/1234567890123456/publish (cannot be undone)."
    }
    ```

    जो body बिल्कुल JSON नहीं है उस पर 400 `invalid_json` आता है; जिस `flow_json` को Flow JSON के रूप में पढ़ा नहीं जा सकता उस पर 400 `invalid_flow_json`। `GET /flows/{id}/json` वह Flow JSON लौटाता है जो WhatsApp flow के लिए रखता है।
  </Step>
  <Step title="किसी और के देखने से पहले फ़ॉर्म आज़माएं">
    `GET /flows/{id}/preview` (scope `messages:read`) एक प्रीव्यू लिंक देता है जो 30 दिन चलता है। फ़ॉर्म को खुद भरने के लिए लिंक में `&interactive=true` जोड़ें।

    ```bash
    curl https://api.app2email.com/v1/YOUR_NUMBER/flows/1234567890123456/preview \
      -H "Authorization: Bearer YOUR_API_KEY"
    ```

    **जवाब में आपको क्या मिलता है:**

    ```json
    {
      "success": true,
      "request_id": "f1prv",
      "flow_id": "1234567890123456",
      "preview_url": "https://business.facebook.com/wa/manage/flows/1234567890123456/preview/?token=b9d6a1c2",
      "expires_at": "2026-12-06T01:00:00+0000",
      "note": "Anyone with the link can see the flow until it expires (30 days). Add &interactive=true to try it."
    }
    ```

    लिंक वाला कोई भी इसे खोल सकता है, iframe में भी। अगर कोई लिंक बाहर चला गया हो, तो `POST /flows/{id}/preview` (scope `templates:manage`) नया बनाता है, और पुराना तुरंत काम करना बंद कर देता है।
  </Step>
  <Step title="flow को पब्लिश करें">
    केवल पब्लिश किया हुआ flow ही ग्राहकों को भेजा जा सकता है। `POST /flows/{id}/publish` (scope `templates:manage`, कोई body नहीं) बिना validation त्रुटि वाले ड्राफ़्ट को पब्लिश करता है।

    <CodeGroup>

    ```bash cURL
    curl -X POST https://api.app2email.com/v1/YOUR_NUMBER/flows/1234567890123456/publish \
      -H "Authorization: Bearer YOUR_API_KEY"
    ```

    ```javascript Node.js
    const res = await fetch("https://api.app2email.com/v1/YOUR_NUMBER/flows/1234567890123456/publish", {
      method: "POST",
      headers: { Authorization: `Bearer ${process.env.API_KEY}` },
    });
    console.log(res.status, await res.json());
    ```

    ```python Python
    res = requests.post("https://api.app2email.com/v1/YOUR_NUMBER/flows/1234567890123456/publish",
                        headers={"Authorization": f"Bearer {os.environ['API_KEY']}"}, timeout=30)
    print(res.status_code, res.json())
    ```

    </CodeGroup>

    **जवाब में आपको क्या मिलता है:**

    ```json
    {
      "success": true,
      "request_id": "f1pub",
      "flow_id": "1234567890123456",
      "name": "quote_request",
      "previous_status": "DRAFT",
      "status": "PUBLISHED",
      "note": "Published for every number on this WhatsApp Business Account. It cannot be deleted (deprecate it instead). Changing its name, categories, endpoint or Flow JSON puts it back to DRAFT until you publish again; messages already sent keep the old version."
    }
    ```

    पब्लिश करना पलटा नहीं जा सकता। आपके webhook को `new_status` `PUBLISHED` के साथ `flow.status_changed` भी मिलता है (नीचे नमूना)। जब WhatsApp उसे पब्लिश नहीं करता (ड्राफ़्ट नहीं है, validation त्रुटियां हैं, या पब्लिश करने की जांच विफल हुई), तो जवाब 422 `flow_cannot_publish` होता है।

    भेजने से पहले, `GET /flows/{id}` (scope `messages:read`) स्थिति, validation त्रुटियां, Flow JSON का संस्करण और `health_status` दिखाता है, जो बताता है कि flow अभी भेजा जा सकता है या नहीं:

    ```json
    {
      "success": true,
      "request_id": "f1get",
      "flow": {
        "id": "1234567890123456",
        "name": "quote_request",
        "status": "PUBLISHED",
        "categories": ["LEAD_GENERATION"],
        "validation_errors": [],
        "json_version": "7.2",
        "health_status": {
          "can_send_message": "AVAILABLE",
          "entities": [{ "entity_type": "FLOW", "id": "1234567890123456", "can_send_message": "AVAILABLE" }]
        }
      }
    }
    ```

    `can_send_message` `AVAILABLE`, `LIMITED` या `BLOCKED` होता है।
  </Step>
  <Step title="ग्राहक को फ़ॉर्म भेजें">
    **24 घंटे की विंडो के भीतर** (ग्राहक ने पिछले 24 घंटों में आपको लिखा, जैसे "Can I get a quote?"), फ़ॉर्म को `POST /messages` (scope `messages:send`) से free-form interactive मैसेज के रूप में भेजें:

    | भाग | क्या भरें |
    | --- | --- |
    | `interactive.type` | `flow` |
    | `header`, `body` | बटन के ऊपर का टेक्स्ट। `header` वैकल्पिक है |
    | `action.name` | `flow` |
    | `flow_message_version` | `"3"` |
    | `flow_id` | चरण 2 से flow का id |
    | `flow_cta` | बटन का टेक्स्ट, 30 अक्षर तक |
    | `flow_token` | इस अनुरोध के लिए आपका अपना संदर्भ, जैसे आपका lead id। यह जवाबों के साथ लौटता है, इसलिए आप जानते हैं कि वे किस अनुरोध के हैं |
    | `flow_action`, `flow_action_payload.screen` | `navigate` और पहली स्क्रीन का id, `QUOTE` |
    | `Idempotency-Key` हेडर | इस भेजने के लिए अनोखा मान। 24 घंटे के भीतर वही key वाली वही रिक्वेस्ट दोबारा नहीं भेजी जाती |

    <CodeGroup>

    ```bash cURL
    curl -X POST https://api.app2email.com/v1/YOUR_NUMBER/messages \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -H "Idempotency-Key: quote-form-lead-0042" \
      -d '{
        "to": "61412345678",
        "type": "interactive",
        "interactive": {
          "type": "flow",
          "header": { "type": "text", "text": "Request a quote" },
          "body": { "text": "Tell us what you need and when. It takes 30 seconds." },
          "action": {
            "name": "flow",
            "parameters": {
              "flow_message_version": "3",
              "flow_id": "1234567890123456",
              "flow_cta": "Request a quote",
              "flow_token": "quote-lead-0042",
              "flow_action": "navigate",
              "flow_action_payload": { "screen": "QUOTE" }
            }
          }
        }
      }'
    ```

    ```javascript Node.js
    const res = await fetch("https://api.app2email.com/v1/YOUR_NUMBER/messages", {
      method: "POST",
      headers: {
        Authorization: `Bearer ${process.env.API_KEY}`,
        "Content-Type": "application/json",
        "Idempotency-Key": `quote-form-${leadId}`,
      },
      body: JSON.stringify({
        to: "61412345678",
        type: "interactive",
        interactive: {
          type: "flow",
          header: { type: "text", text: "Request a quote" },
          body: { text: "Tell us what you need and when. It takes 30 seconds." },
          action: {
            name: "flow",
            parameters: {
              flow_message_version: "3",
              flow_id: "1234567890123456",
              flow_cta: "Request a quote",
              flow_token: `quote-${leadId}`,
              flow_action: "navigate",
              flow_action_payload: { screen: "QUOTE" },
            },
          },
        },
      }),
    });
    console.log(res.status, await res.json());
    ```

    ```python Python
    res = requests.post(
        "https://api.app2email.com/v1/YOUR_NUMBER/messages",
        headers={"Authorization": f"Bearer {os.environ['API_KEY']}", "Idempotency-Key": f"quote-form-{lead_id}"},
        json={
            "to": "61412345678",
            "type": "interactive",
            "interactive": {
                "type": "flow",
                "header": {"type": "text", "text": "Request a quote"},
                "body": {"text": "Tell us what you need and when. It takes 30 seconds."},
                "action": {
                    "name": "flow",
                    "parameters": {
                        "flow_message_version": "3",
                        "flow_id": "1234567890123456",
                        "flow_cta": "Request a quote",
                        "flow_token": f"quote-{lead_id}",
                        "flow_action": "navigate",
                        "flow_action_payload": {"screen": "QUOTE"},
                    },
                },
            },
        },
        timeout=10,
    )
    print(res.status_code, res.json())
    ```

    </CodeGroup>

    **जवाब में आपको क्या मिलता है** (200):

    ```json
    {
      "success": true,
      "request_id": "kxrkf",
      "message_id": "wamid.HBgLNjE0MTIzNDU2NzgVAgARGBI1RjQyNUE3NEYxMzAzMzQ5MkEA",
      "status": "accepted",
      "type": "interactive",
      "from": "4976659348270",
      "to": "61412345678",
      "window_closes_at": "2026-11-22T08:45:00Z",
      "conversation_url": "https://www.app2email.com/conversation/61412345678_4976659348270_...",
      "contacts": [{ "input": "61412345678", "wa_id": "61412345678" }]
    }
    ```

    `accepted` का मतलब है कि WhatsApp ने मैसेज ले लिया। `message_id` रखें: ग्राहक का जवाब उसी का हवाला देता है। विंडो के बाहर कॉल 422 `outside_24h_window` देती है।

    **24 घंटे की विंडो के बाहर** (आपकी वेबसाइट से कोई lead, या ऐसा ग्राहक जिसने पिछले हफ़्ते लिखा), केवल मंज़ूर टेम्पलेट ही बातचीत शुरू कर सकता है। ऐसा टेम्पलेट बनाएं जिसमें Flow खोलने वाला बटन हो, WhatsApp Manager में या `POST /templates` से (scope `templates:manage`, `components` WhatsApp के अपने फ़ॉर्मैट में, देखें [Meta की गाइड](https://developers.facebook.com/documentation/business-messaging/whatsapp/flows/guides/sendingaflow))। WhatsApp उसकी समीक्षा करता है (कुछ मिनट से एक दिन), और `template.status_changed` नतीजा बताता है। फिर उसे `sub_type` `flow` वाले `button` घटक के साथ भेजें। उसका `action` `flow_token` ले जाता है:

    ```json
    {
      "to": "61412345678",
      "type": "template",
      "template": {
        "name": "quote_request",
        "language": { "code": "en" },
        "components": [
          {
            "type": "button",
            "sub_type": "flow",
            "index": "0",
            "parameters": [
              { "type": "action", "action": { "flow_token": "quote-lead-0042" } }
            ]
          }
        ]
      }
    }
    ```

    `index` टेम्पलेट में बटन की जगह है, `"0"` से शुरू। `flow_token` वैकल्पिक है; उसके बिना आप नहीं बता सकते कि जवाब किस अनुरोध का है, इसलिए एक भेजें। `action.flow_action_data` पहली स्क्रीन को मान देता है, ऐसे Flow JSON के लिए जिसकी स्क्रीन `data` लेती है; यह फ़ॉर्म कोई नहीं लेता। `GET /templates` (scope `messages:read`) आपके टेम्पलेट सूचीबद्ध करता है, और हर मंज़ूर टेम्पलेट के लिए एक पूरी उदाहरण रिक्वेस्ट। अगर टेम्पलेट के मान मेल न खाएं, तो जवाब सही `example_request` के साथ 422 `template_parameters_invalid` होता है।
  </Step>
</Steps>

## नतीजा

1. ग्राहक **Request a quote** पर टैप करता है। फ़ॉर्म WhatsApp के भीतर खुलता है।
2. वे अपना नाम लिखते हैं, **Gutter cleaning** चुनते हैं, 3 December चुनते हैं और **Send request** पर टैप करते हैं।
3. फ़ॉर्म बंद हो जाता है, और आपके मैसेज के जवाब में एक "Sent" चैट में दिखता है। Inbox और Activity Log में आप जवाब देखते हैं।
4. आपके webhook को फ़ॉर्म मैसेज के लिए `message.status` इवेंट मिलते हैं (`sent`, `delivered`, `read`), किसी भी दूसरे मैसेज की तरह, और फिर जवाब:

```json
{
  "id": "evt_Pa3k9m2Lw8Rt5Yp1Zs014",
  "type": "message.received",
  "created": "2026-11-21T09:14:00.000Z",
  "number": "4976659348270",
  "data": {
    "message_id": "wamid.HBgLNjE0MTIzNDU2NzgVAgASGBQzQUZCMTY0MDc2MUYwNzBDNTY5MAA=",
    "from": "61412345678",
    "name": "Jane Citizen",
    "type": "interactive",
    "text": "[FLOW] Sent\r\nname: Jane Citizen\r\nservice: gutter_cleaning\r\npreferred_date: 2026-12-03",
    "in_reply_to": "wamid.HBgLNjE0MTIzNDU2NzgVAgARGBI1RjQyNUE3NEYxMzAzMzQ5MkEA",
    "context": {
      "from": "4976659348270",
      "id": "wamid.HBgLNjE0MTIzNDU2NzgVAgARGBI1RjQyNUE3NEYxMzAzMzQ5MkEA"
    },
    "interactive": { "type": "nfm_reply" },
    "flow": {
      "name": "flow",
      "body": "Sent",
      "token": "quote-lead-0042",
      "response": {
        "flow_token": "quote-lead-0042",
        "name": "Jane Citizen",
        "service": "gutter_cleaning",
        "preferred_date": "2026-12-03"
      }
    },
    "conversation_url": "https://www.app2email.com/conversation/61412345678_4976659348270_k3XbQ9rTzP2mWv7a1c9e",
    "timestamp": "2026-11-21T09:14:00.000Z"
  }
}
```

- `data.flow.response` वह है जो ग्राहक ने भरा, आपके `payload` के नामों के अंतर्गत, साथ में `flow_token`। `Dropdown` का जवाब विकल्प का `id` है (`gutter_cleaning`), उसका शीर्षक नहीं।
- `data.flow.token` वह `flow_token` है जो आपने भेजा: उससे अपना lead ढूंढें।
- `in_reply_to` और `context.id` आपके भेजे फ़ॉर्म मैसेज का `message_id` हैं।
- `data.text` उसी जवाब का पढ़ने योग्य सारांश है, लॉग और लोगों के लिए।
- जो ग्राहक WhatsApp username इस्तेमाल करता है वह `from_user_id` के साथ आ सकता है और `from` के बिना। वह id वहां काम करता है जहां नंबर करता है।

### कोड में जवाब पाएं

दोनों संस्करण हस्ताक्षर सत्यापित करते हैं, संभाले जा चुके इवेंट छोड़ देते हैं, केवल `quote-` टोकन वाले Flow जवाब रखते हैं, lead सहेजते हैं और धन्यवाद कहते हैं। पहले `NUMBER`, `API_KEY` और `WEBHOOK_SECRET` (आपके webhook का `whsec_...` secret) सेट करें।

<Tabs>
  <Tab title="Node.js (Express)">

```javascript server.mjs
// Node.js 18 or newer.  npm install express   then   node server.mjs
import crypto from "node:crypto";
import express from "express";

const { NUMBER, API_KEY, WEBHOOK_SECRET, PORT = 3000 } = process.env;
const API = `https://api.app2email.com/v1/${NUMBER}`;
const SERVICES = new Set(["window_cleaning", "gutter_cleaning", "pressure_washing"]);
const done = new Set(); // handled event ids: use a database table or Redis in production

function verify(raw, header, secret) {
  const t = /(?:^|,)\s*t=(\d+)/.exec(header ?? "")?.[1];
  const v1 = [...(header ?? "").matchAll(/(?:^|,)\s*v1=([0-9a-f]+)/g)].map((m) => m[1]); // two during a secret change
  if (!t || v1.length === 0 || Math.abs(Date.now() / 1000 - Number(t)) > 300) return false;
  const expected = crypto.createHmac("sha256", secret).update(t + ".").update(raw).digest("hex");
  return v1.some((v) => v.length === expected.length && crypto.timingSafeEqual(Buffer.from(v), Buffer.from(expected)));
}

async function saveLead(lead) {
  console.log("new quote request", lead); // your CRM or database: one row per flow token
}

async function thank(to, messageId, name) {
  const res = await fetch(`${API}/messages`, {
    method: "POST",
    signal: AbortSignal.timeout(4000),
    headers: { Authorization: `Bearer ${API_KEY}`, "Content-Type": "application/json", "Idempotency-Key": `thanks-${messageId}` },
    body: JSON.stringify({ to, type: "text", text: { body: `Thanks ${name}! You will get your quote within one working day.` } }),
  });
  const json = await res.json();
  if (res.status === 429 || res.status >= 500) throw new Error(`${json.error?.code} ${json.request_id}`);
  if (!res.ok) console.warn("thank-you not sent:", json.error?.code, json.error?.how_to_fix, json.request_id);
}

const app = express();
app.post("/webhook", express.raw({ type: "application/json" }), async (req, res) => {
  if (!verify(req.body, req.get("X-App2email-Signature"), WEBHOOK_SECRET)) return res.sendStatus(401);
  const event = JSON.parse(req.body);
  const m = event.data ?? {};
  const isQuote = event.type === "message.received" && m.interactive?.type === "nfm_reply" && m.flow?.token?.startsWith("quote-");
  if (!isQuote || done.has(event.id)) return res.sendStatus(200);

  const answers = m.flow.response ?? {};
  const lead = {
    token: m.flow.token,
    contact: m.from || m.from_user_id,
    name: String(answers.name ?? "").slice(0, 100),
    service: SERVICES.has(answers.service) ? answers.service : "other",
    preferred_date: /^\d{4}-\d{2}-\d{2}$/.test(answers.preferred_date ?? "") ? answers.preferred_date : null,
    message_id: m.message_id,
  };
  try {
    await saveLead(lead);
    if (!event.test) await thank(lead.contact, m.message_id, lead.name); // test events have a made-up contact
    done.add(event.id); // only after it worked: a failed event comes again
    res.sendStatus(200);
  } catch (err) {
    console.error("not handled, app2email will send it again:", event.id, err.message);
    res.sendStatus(503);
  }
});
app.listen(PORT, () => console.log(`listening on http://localhost:${PORT}/webhook`));
```

  </Tab>
  <Tab title="Python (Flask)">

```python server.py
# Python 3.9 or newer.  pip install flask requests   then   flask --app server run --port 3000
import hashlib, hmac, json, os, re, time
import requests
from flask import Flask, request

NUMBER, API_KEY, SECRET = os.environ["NUMBER"], os.environ["API_KEY"], os.environ["WEBHOOK_SECRET"]
API = f"https://api.app2email.com/v1/{NUMBER}"
SERVICES = {"window_cleaning", "gutter_cleaning", "pressure_washing"}
done = set()  # handled event ids: use a database table or Redis in production

def verify(raw: bytes, header: str, secret: str, tolerance: int = 300) -> bool:
    t = re.search(r"(?:^|,)\s*t=(\d+)", header or "")
    v1 = re.findall(r"(?:^|,)\s*v1=([0-9a-f]+)", header or "")  # two during a secret change
    if not t or not v1 or abs(time.time() - int(t.group(1))) > tolerance:
        return False
    expected = hmac.new(secret.encode(), t.group(1).encode() + b"." + raw, hashlib.sha256).hexdigest()
    return any(hmac.compare_digest(v, expected) for v in v1)

def save_lead(lead):
    print("new quote request", lead)  # your CRM or database: one row per flow token

def thank(to, message_id, name):
    res = requests.post(f"{API}/messages", timeout=4,
                        headers={"Authorization": f"Bearer {API_KEY}", "Idempotency-Key": f"thanks-{message_id}"},
                        json={"to": to, "type": "text",
                              "text": {"body": f"Thanks {name}! You will get your quote within one working day."}})
    data = res.json()
    if res.status_code == 429 or res.status_code >= 500:
        raise RuntimeError(f"{data.get('error', {}).get('code')} {data.get('request_id')}")
    if not res.ok:
        print("thank-you not sent:", data["error"]["code"], data["error"].get("how_to_fix"), data.get("request_id"))

app = Flask(__name__)

@app.post("/webhook")
def webhook():
    raw = request.get_data()
    if not verify(raw, request.headers.get("X-App2email-Signature"), SECRET):
        return "bad signature", 401
    event = json.loads(raw)
    m = event.get("data") or {}
    flow = m.get("flow") or {}
    is_quote = (event.get("type") == "message.received"
                and (m.get("interactive") or {}).get("type") == "nfm_reply"
                and str(flow.get("token", "")).startswith("quote-"))
    if not is_quote or event["id"] in done:
        return "", 200

    answers = flow.get("response") or {}
    date = str(answers.get("preferred_date", ""))
    lead = {
        "token": flow["token"],
        "contact": m.get("from") or m.get("from_user_id"),
        "name": str(answers.get("name", ""))[:100],
        "service": answers.get("service") if answers.get("service") in SERVICES else "other",
        "preferred_date": date if re.fullmatch(r"\d{4}-\d{2}-\d{2}", date) else None,
        "message_id": m.get("message_id"),
    }
    try:
        save_lead(lead)
        if not event.get("test"):  # test events have a made-up contact
            thank(lead["contact"], m["message_id"], lead["name"])
    except Exception as err:
        print("not handled, app2email will send it again:", event["id"], err)
        return "", 503
    done.add(event["id"])  # only after it worked: a failed event comes again
    return "", 200
```

  </Tab>
</Tabs>

असली ग्राहक के बिना receiver को आज़माने के लिए, उसे अपना ही नमूना भेजें: `{"event": {...}}` और ऊपर की `message.received` body के साथ `POST /webhooks/{id}/test` (scope `webhooks:manage`)। टेस्ट इवेंट में `"test": true` और हेडर `X-App2email-Test: true` होता है, और वे हर इवेंट की तरह हस्ताक्षरित होते हैं; प्रति नंबर प्रति घंटे 30 टेस्ट तक।

### flow में खुद बदलाव

`flow.status_changed` बताता है कि flow के साथ क्या होता है: पब्लिश, throttled, blocked या deprecated हुआ, Meta द्वारा endpoint या client अलर्ट उठाया या हटाया गया, या यह चेतावनी कि उसका Flow JSON संस्करण जल्द समाप्त होने वाला है। WhatsApp Business Account का हर नंबर इसे पाता है।

```json
{
  "id": "evt_Xq3k9m2Lw8Rt5Yp1Zs21",
  "type": "flow.status_changed",
  "created": "2026-11-21T09:05:00.000Z",
  "number": "4976659348270",
  "data": {
    "flow_id": "1234567890123456",
    "change": "status",
    "event": "FLOW_STATUS_CHANGE",
    "old_status": "DRAFT",
    "new_status": "PUBLISHED",
    "message": "Flow quote_request changed status from DRAFT to PUBLISHED",
    "timestamp": "2026-11-21T09:05:00.000Z"
  }
}
```

`new_status` `THROTTLED` या `BLOCKED` पर, और `change` `flow_version_expiry_warning` पर नज़र रखें: उसका `warning` बताता है कि Flow JSON संस्करण कब जम जाएगा। उसके बाद flow भेजा नहीं जा सकता, इसलिए JSON को `PUT /flows/{id}/json` से नए `version` पर ले जाएं और फिर पब्लिश करें।

## flow बदलें, रिटायर करें या हटाएं

- **फ़ॉर्म बदलें:** नए JSON के साथ `PUT /flows/{id}/json`, या नए `name`, `categories` या `endpoint_uri` के साथ `PATCH /flows/{id}`। पब्लिश किया हुआ flow दोबारा पब्लिश करने तक `DRAFT` पर लौट जाता है, और पहले से भेजे गए मैसेज पुराना संस्करण रखते हैं। कुछ flows बदले नहीं जा सकते (409 `flow_not_editable`, जैसे deprecated वाला): उसे `POST /flows` और `clone_flow_id` से कॉपी करें, कॉपी को बदलें और उसे पब्लिश करें।
- **इसे रिटायर करें:** `POST /flows/{id}/deprecate` (scope `templates:manage`)। इसके बाद वह भेजा या खोला नहीं जा सकता। इसे पलटा नहीं जा सकता।
- **इसे हटाएं:** `DELETE /flows/{id}` केवल ड्राफ़्ट के लिए काम करता है। पब्लिश किए हुए flow पर 409 `flow_not_deletable` आता है: इसके बजाय उसे deprecate करें।
- **उन्हें सूचीबद्ध करें:** `GET /flows` (scope `messages:read`) अकाउंट के हर flow को उसके id, नाम, स्थिति, श्रेणियों और validation त्रुटियों के साथ सूचीबद्ध करता है, एक बार में 1 से 100 (`limit`, और पिछले जवाब के `next_cursor` के साथ `cursor`)।

<Info>
**जिन फ़ॉर्म को लाइव डेटा चाहिए।** इस गाइड का फ़ॉर्म स्वतंत्र है। जो flow ग्राहक के भरते समय डेटा लाता है (खाली समय, कीमतें) वह आपका एक डेटा endpoint इस्तेमाल करता है: flow पर `endpoint_uri`, और नंबर की 2048-bit RSA public key जो `PUT /flows/encryption-key` से सेट होती है (scope `templates:manage`; `GET /flows/encryption-key` उसे दिखाता है)। हर नंबर की अपनी key होती है। जब तक Book-and-Pay अपने बुकिंग Flows के लिए key इस्तेमाल करता है, दूसरी सेट करने पर 409 `encryption_key_managed` आता है।
</Info>

<Tip>
**Flow JSON नहीं लिखना है?** app2email आपके लिए WhatsApp फ़ॉर्म भी बनाता है। **Submit-Info** सवालों की सादी सूची को WhatsApp फ़ॉर्म और वेब पेज में बदल देता है (`POST /submit/forms`, `POST /submit/forms/{key}/publish`, `POST /submit/forms/{key}/send`, scope `submissions:manage`); उसके जवाब `submission.created` के रूप में आते हैं। **Book-and-Pay** सेक्शन में एक बुकिंग फ़ॉर्म और दूसरे फ़ॉर्म हैं जिन्हें आप `POST /flows/{key}/send` (scope `bookings:manage`) से भेजते हैं; उस सेक्शन का फ़ॉर्म Flow `flow.completed` बताता है, बुकिंग Flow `booking.created`। जो flows आप `POST /flows` से बनाते हैं वे अपने जवाब `message.received` के रूप में बताते हैं, जैसा ऊपर दिखाया गया।
</Tip>

## प्रोडक्शन चेकलिस्ट

<Check>
**हर इवेंट सत्यापित करें।** `X-App2email-Signature` (`t=<unix seconds>,v1=<hex>`, `t`, एक बिंदु और raw body का HMAC-SHA256, webhook के `whsec_...` secret के साथ) को raw body पर जांचें, पार्स करने से पहले। हर `v1=` जांचें, constant time में तुलना करें और 5 मिनट से पुराने `t` को अस्वीकार करें।
</Check>

<Check>
**असली ids पर दोहराव हटाएं।** हर संभाले गए इवेंट का इवेंट `id` (`X-App2email-Delivery` में भी) कम से कम दो दिन रखें: विफल इवेंट लगभग 32 घंटे तक फिर भेजा जाता है। हर `flow_token` के लिए एक lead सहेजें, ताकि जो ग्राहक वही फ़ॉर्म दो बार भेजे वह दूसरा अनुरोध बनाने के बजाय अपना अनुरोध अपडेट करे।
</Check>

<Check>
**हर मैसेज एक बार भेजें।** हर `POST /messages` को `Idempotency-Key` दें (फ़ॉर्म के लिए: आपका lead id; धन्यवाद के लिए: जवाब का `message_id`)। 24 घंटे के भीतर वही key और body `Idempotent-Replayed: true` के साथ पहला जवाब लौटाते हैं। वही key अलग body के साथ: 422 `idempotency_key_reused`। 409 `idempotency_request_in_progress`: रुकें और वही key लेकर दोबारा कोशिश करें।
</Check>

<Check>
**जल्दी जवाब दें।** 10 सेकंड के भीतर 2xx लौटाएं; रीडायरेक्ट फ़ॉलो नहीं किए जाते। धीमे काम के लिए, इवेंट सहेजें, 200 से जवाब दें और उसे queue से प्रोसेस करें।
</Check>

<Check>
**सीमाओं का सम्मान करें।** हर जवाब में `X-RateLimit-Limit`, `X-RateLimit-Remaining`, `X-RateLimit-Reset` और `X-RateLimit-Policy` होते हैं। सीमा पार होने पर: `Retry-After` के साथ 429 `rate_limited`; रुकें, फिर दोबारा भेजें। WhatsApp की अपनी सीमाओं (429 `whatsapp_rate_limit`, `too_many_messages_to_recipient`) में मिनट लगते हैं। हर फ़ॉर्म मैसेज आपके प्लान का एक मैसेज गिना जाता है।
</Check>

<Check>
**24 घंटे की विंडो का ध्यान रखें।** interactive फ़ॉर्म मैसेज free-form है: वह केवल उस ग्राहक को जाता है जिसने पिछले 24 घंटों में लिखा (app2email 15 मिनट पहले रुक जाता है; `window_closes_at` ठीक समय है)। बाकी सबको Flow बटन वाला मंज़ूर टेम्पलेट मिलता है।
</Check>

<Check>
**Opt-in और Do Not Call।** अगर आपका Flow बटन टेम्पलेट मार्केटिंग टेम्पलेट है, तो वह किसी भी मार्केटिंग टेम्पलेट के नियम मानता है: आपकी Do Not Call सूची के ग्राहक पर 403 `recipient_opted_out` आता है, और जिस नंबर पर opt-in ज़रूरी है वह बिना opt-in वाले ग्राहक के लिए 403 `recipient_not_opted_in` देता है। Utility टेम्पलेट फिर भी भेजे जा सकते हैं। देखें [opt-in का सम्मान करने वाला मार्केटिंग ब्रॉडकास्ट भेजें](/guides/how-to-marketing-broadcast)।
</Check>

<Check>
**जवाबों को डेटा मानें।** ग्राहक ने उन्हें टाइप किया है। अपने database में जाने से पहले हर फ़ील्ड जांचें (जानी-पहचानी सेवा id, असली तारीख़, उचित लंबाई), और उसे कभी कमांड के रूप में न चलाएं या अपने निर्देशों के साथ मिलाकर किसी AI मॉडल को न दें।
</Check>

<Check>
**flows सावधानी से बदलें।** Flows WhatsApp Business Account के हर नंबर में साझा हैं, और पब्लिश किए flow में बदलाव उसे दोबारा पब्लिश करने तक `DRAFT` पर ले जाता है। Flow JSON को अपने version control में रखें, बदलावों को प्रीव्यू लिंक से आज़माएं, और `flow.status_changed` पर नज़र रखें।
</Check>

<Check>
**न्यूनतम पहुंच।** receiver को केवल `messages:send` चाहिए (धन्यवाद के लिए)। `templates:manage` को अलग key पर रखें जिसे केवल आपकी सेटअप स्क्रिप्ट इस्तेमाल करें। keys को सर्वर पर रखें, कभी वेब पेज या लॉग में नहीं।
</Check>

## अगर यह काम न करे

| आपको क्या दिखता है | कारण | समाधान |
| --- | --- | --- |
| 403 `insufficient_scope` | key में एक अनुमति नहीं है (`details.required_scope`) | flows बनाने के लिए `templates:manage` वाली, और भेजने के लिए `messages:send` वाली key बनाएं |
| 403 `sandbox_key` | sandbox key flows बना, बदल या पब्लिश नहीं कर सकती | इन कॉल के लिए सामान्य key इस्तेमाल करें; sandbox key को `POST /messages` जांचने के लिए रखें |
| 403 `not_in_instant_sandbox` | डेमो नंबर `12025550100` में कोई flow कॉल नहीं है | अपना जुड़ा हुआ नंबर इस्तेमाल करें |
| 400 `invalid_flow_name` | `name` खाली है या 200 अक्षर से लंबा है | एक छोटा आंतरिक नाम भेजें, जैसे `quote_request` |
| 400 `invalid_flow_categories` | `categories` गायब है या उसमें अज्ञात मान है | कम से कम एक श्रेणी वाली सूची भेजें, जैसे `["LEAD_GENERATION"]` |
| 400 `invalid_flow_json`, `invalid_json` | Flow JSON या body वैध JSON नहीं है, या ऑब्जेक्ट नहीं है | ब्रैकेट, कोटेशन और कॉमा जांचें; Flow JSON को ऑब्जेक्ट के रूप में भेजें |
| 400 `invalid_flow_field` | किसी फ़ील्ड में गलत तरह का मान है, जैसे `publish` true या false नहीं है | फ़ील्ड `name`, `categories`, `flow_json`, `publish`, `endpoint_uri`, `clone_flow_id` इस्तेमाल करें |
| 400 `invalid_flow_id`, 404 `flow_not_found` | पते में दिया id इस अकाउंट का flow नहीं है | `GET /flows` ids सूचीबद्ध करता है |
| 404 `flow_json_not_found` | flow में अभी कोई Flow JSON नहीं है | उसे `PUT /flows/{id}/json` से अपलोड करें |
| `validation_errors` खाली नहीं | WhatsApp को Flow JSON में समस्याएं मिलीं | हर एक को उसकी पंक्ति और कॉलम पर ठीक करें, फिर `PUT /flows/{id}/json` दोबारा करें |
| 409 `flow_name_taken` | अकाउंट में इस नाम का flow पहले से है | दूसरा नाम चुनें |
| 413 `flow_json_too_large` | Flow JSON WhatsApp की 10 MB सीमा से ऊपर है | उसे छोटा करें |
| 422 `flow_cannot_publish` | flow ड्राफ़्ट नहीं है, उसमें validation त्रुटियां हैं, या वह पब्लिश करने की जांच में विफल रहा | `GET /flows/{id}` `validation_errors` और `health_status` दिखाता है; उन्हें ठीक करें और फिर पब्लिश करें |
| 422 `flow_rejected` | WhatsApp ने रिक्वेस्ट स्वीकार नहीं की | जवाब में `whatsapp_error` पढ़ें, रिक्वेस्ट ठीक करें और फिर भेजें |
| 409 `flow_not_editable` | WhatsApp इस flow को बदलने नहीं देता | उसे `clone_flow_id` से कॉपी करें, कॉपी को बदलें और उसे पब्लिश करें |
| 409 `flow_not_deletable` | पब्लिश किया हुआ flow हटाया नहीं जा सकता | उसे `POST /flows/{id}/deprecate` से deprecate करें |
| 409 `flow_not_published` | केवल पब्लिश किया हुआ flow deprecate हो सकता है | deprecate करने को कुछ नहीं; ड्राफ़्ट हटाया जा सकता है |
| 409 `encryption_key_managed` | Book-and-Pay नंबर की Flow encryption key इस्तेमाल करता है | key को जैसी है वैसी रहने दें; अपने डेटा endpoint वाले flow के लिए Book-and-Pay के बिना नंबर चाहिए |
| 403 `flow_blocked_by_integrity` | Meta इस WhatsApp अकाउंट पर flows बनाना या पब्लिश करना रोकता है | WhatsApp Manager से Meta सपोर्ट से संपर्क करें |
| 403 `whatsapp_permission_missing` | Meta ने app2email को आपके अकाउंट के लिए वह अनुमति नहीं दी जो इसे चाहिए | दोबारा कोशिश से मदद नहीं मिलती; support@app2email.com से संपर्क करें |
| 422 `outside_24h_window` | ग्राहक ने आखिरी बार 24 घंटे से ज़्यादा पहले लिखा था | इसके बजाय Flow बटन वाला मंज़ूर टेम्पलेट भेजें |
| 404 `template_not_found`, 422 `template_not_approved` | टेम्पलेट का नाम या भाषा गलत है, या वह अभी मंज़ूर नहीं है | `GET /templates` से वह चुनें जिसकी स्थिति APPROVED है |
| 422 `template_parameters_invalid` | बटन घटक टेम्पलेट से मेल नहीं खाता | जवाब में `example_request` से तुलना करें |
| 400 `invalid_interactive` | interactive भाग वैध नहीं है (उसका प्रकार या टेक्स्ट की लंबाई) | `interactive.type` `flow`, `action.parameters` जांचें, और `flow_cta` को 30 अक्षर में रखें |
| 429 `rate_limited` | इस key के लिए बहुत ज़्यादा कॉल | `Retry-After` सेकंड रुकें, फिर दोबारा कोशिश करें |
| 502 `whatsapp_error` | WhatsApp ने ऐसी त्रुटि से रिक्वेस्ट मना कर दी जिसका अपना कोड नहीं है | `whatsapp_error` पढ़ें; बाद में फिर कोशिश करें, और अगर यह विफल होता रहे तो `request_id` सपोर्ट को भेजें |
| फ़ॉर्म खुलता है, लेकिन कोई जवाब नहीं आता | webhook बंद है, या आपका receiver इवेंट छोड़ देता है | `GET /webhooks` `active` और आखिरी डिलीवरी दिखाता है; `GET /webhooks/{id}/deliveries?status=failed` दिखाता है कि क्या विफल हुआ |

हर जवाब में एक `request_id` होता है। `GET /requests/{id}` दिखाता है कि उसके लिए क्या लॉग हुआ, और support@app2email.com भी उसे ढूंढ सकता है। सभी कोड: [Errors](/api/errors)।

## अक्सर पूछे जाने वाले सवाल

<AccordionGroup>
  <Accordion title="क्या कोई AI एजेंट flows बना और संभाल सकता है?">
    हां। MCP सर्वर `https://api.app2email.com/mcp/flows` में यही कॉल टूल के रूप में हैं: `list_flows`, `get_flow`, `create_flow`, `update_flow`, `get_flow_json`, `update_flow_json`, `publish_flow`, `deprecate_flow`, `delete_flow`, `get_flow_preview` और `renew_flow_preview`। देखें [MCP से AI एजेंट को अपना WhatsApp चलाने दें](/guides/how-to-ai-agent-mcp) और [MCP](/api/mcp)।
  </Accordion>
  <Accordion title="क्या मैं फ़ॉर्म एक साथ कई ग्राहकों को भेज सकता हूं?">
    interactive फ़ॉर्म मैसेज हर कॉल में एक संपर्क को, उसकी विंडो के भीतर जाता है। कई ग्राहकों तक पहुंचने के लिए, Flow बटन वाला मंज़ूर टेम्पलेट भेजें, जैसे किसी सेगमेंट को ब्रॉडकास्ट के रूप में, और मार्केटिंग टेम्पलेट के opt-in नियमों का पालन करें। अगर आपको जवाबों को लोगों से मिलाना है तो हर ग्राहक को उसका अपना `flow_token` दें।
  </Accordion>
  <Accordion title="जिन ग्राहकों के पास अब भी पुराना संस्करण है, उनका क्या होता है?">
    पहले से भेजे गए मैसेज flow का वही संस्करण रखते हैं जिसके साथ वे भेजे गए थे। बदलाव नए मैसेज के लिए दोबारा पब्लिश करने के बाद लागू होता है। deprecated flow अब भेजा या खोला नहीं जा सकता।
  </Accordion>
  <Accordion title="क्या मुझे Meta का अपना webhook फ़ॉर्मैट मिल सकता है?">
    हां: `"format": "meta"` वाले webhook को WhatsApp से जो आता है वह Meta की अपनी body (`entry[].changes[]`) के रूप में मिलता है, उसी तरह हस्ताक्षरित। app2email के डिफ़ॉल्ट फ़ॉर्मैट में जवाब पहले से `data.flow` में खुला हुआ होता है, जैसा ऊपर दिखाया गया। `data.whatsapp` में भी Meta का मैसेज ऑब्जेक्ट बिना बदले होता है।
  </Accordion>
</AccordionGroup>

## और how-to गाइड

<CardGroup cols={2}>
  <Card title="अपनी वेबसाइट या ऐप से अपॉइंटमेंट लें" href="/guides/how-to-bookings-api">
    Book-and-Pay API से खाली स्लॉट, बुकिंग और रिमाइंडर।
  </Card>
  <Card title="API से WhatsApp चैटबॉट बनाएं" href="/guides/how-to-whatsapp-chatbot">
    हस्ताक्षरित webhook पर मैसेज पाएं और अपने ही कोड से जवाब दें।
  </Card>
  <Card title="टेम्पलेट से ऑर्डर और अपॉइंटमेंट नोटिफ़िकेशन भेजें" href="/guides/how-to-order-notifications">
    24 घंटे की विंडो के बाहर के मैसेज के लिए मंज़ूर टेम्पलेट, डिलीवरी स्टेटस के साथ।
  </Card>
  <Card title="संपर्क इंपोर्ट करें और उन्हें अपने CRM के साथ सिंक रखें" href="/guides/how-to-contacts-crm-sync">
    आपके फ़ॉर्म से जुटाए lead को अपने बाकी ग्राहक डेटा के साथ रखें।
  </Card>
</CardGroup>

[सभी how-to गाइड](https://www.app2email.com/docs#how-to)
