إيقاف مؤشر الكتابة (Stop Typing)

إيقاف وضع الكتابة قبل الإرسال الفعلي.

POST
https://api.wawp.net/v2/send/stop-typing?access_token=YOUR_ACCESS_TOKEN&chatId=201234567890%40c.us&instance_id=123456789

تسجيل الدخول مطلوب

سجل الدخول لاستبدال المعرفات (Instance ID) ورمز الوصول (Access Token) بمعلومات حسابك الحقيقي لاختبار ال API مباشرة.

تسجيل الدخول
اختبار /v2/send/stop-typing
POST
POST

لا توجد معاملات استعلام مطلوبة

هذه النهاية الطرفية لا تتوقع بيانات في الرابط.

توصيات

  • Consult the official documentation for detailed parameter descriptions.

  • Test endpoints in a sandbox environment before production.

  • Keep your API client library up to date.

State Cleanup: Mastering the Stop Typing Engine

The /v2/send/stop-typing endpoint is the essential "Cleanup Crew" of the Wawp presence system. While simple in its objective—to remove the "typing..." or "recording audio..." indicators—it plays a critical role in maintaining the professional polish of your WhatsApp integration. In a high-stakes customer support or sales environment, a "typing..." indicator that lingers indefinitely without a resulting message is a significant UX failure that signals system malfunction or agent indecision.


🏗️ The Presence Termination Pipeline

When you explicitly call /stop-typing, Wawp executes a coordinated cleanup across the WhatsApp stack:

  1. The PAUSE Signal: The engine transmits a specialized PAUSE packet to the target chatId. This packet instructs the recipient's WhatsApp client to immediately hide all presence indicators.
  2. Override of Implicit Timeouts: While WhatsApp has a native timeout (usually 10–20 seconds), explicit calls to /stop-typing provide instant feedback. This is crucial for fast-paced, multi-step conversational flows where states change rapidly.
  3. Internal Buffer Clearance: Wawp clears the local session's presence-tracking buffer to ensure that subsequent typing requests are treated as fresh starts, preventing "Presence Stuttering" on the recipient's UI.

🛡️ Strategic Best Practices for Presence Hygiene

1. The "Message-Sent" Auto-Stop

It is a common misconception that you must call /stop-typing immediately before sending a message.

  • Fact: Sending any message (Text, Image, PDF, etc.) to a chat automatically triggers the "Stop Typing" behavior on the WhatsApp network.
  • Optimization: To save API calls and reduce latency, do not call /v2/send/stop-typing before or after sending your final message. The message delivery itself is the most efficient way to clear the status.

2. Handling Workflow Cancellations

This is the most critical use case for the explicit stop endpoint.

  • Scenario: An agent starts a response in your CRM but then decides the inquiry belongs to a different department. They close the chat tab or transfer the ticket.
  • Best Practice: Your CRM should automatically trigger /v2/send/stop-typing whenever an agent's focus leaves a chat that was previously in a "Typing" state. This prevents the "Phantom Agent" effect where a customer sees someone typing for minutes with no result.

3. Graceful AI Failure Recovery

If your AI backend (e.g., GPT-4 or Claude) times out or returns an error while a "typing..." indicator is active, your system must handle the cleanup.

  • Implementation: Wrap your AI generation logic in a try...catch...finally block. In the finally section, if no message was successfully sent, trigger /v2/send/stop-typing. This ensures that even in the event of a crash, the customer isn't left staring at a perpetual typing status.

🧩 Advanced Use Cases

The "Search Transition" UX

In complex bot flows where a user requests a search (e.g., "Find my order"), you can use /v2/send/start-typing to show work is in progress. If the search returns 0 results, trigger /v2/send/stop-typing before sending the "No results found" text. This momentary clearing of the status creates a distinct visual "Beat" in the conversation, signaling that one phase of logic has ended and another (the error message) has begun.

Agent Transfer Synchronization

When transferring a chat between human agents, the secondary agent may want to "Pick up" the thread quietly. Triggering stop-typing during the handoff ensures the transition is visually seamless for the customer, with no overlapping or conflicting indicators from two different sessions.


🛠️ Common Pitfalls and Solutions

  • Double-Counting Latency: If your network is slow, calling /stop-typing followed immediately by a message might cause the message to arrive before the stop signal is processed, leading to a brief flicker. Solution: Rely on the "Auto-Stop" property of messages whenever possible.
  • Rate Limit Caution: While presence signals are lightweight, WhatsApp still tracks the frequency of these specialized packets. Avoid sending more than 3 stop-typing calls per second to the same chat to ensure your instance maintains a high trust score.
  • Group Environment Noise: In group chats with 200+ participants, presence indicators can be noisy. Use /stop-typing only when an agent was definitely "Active" and now definitely is "Not."

Summary of Capabilities:

  • Explicitly terminate the "typing..." or "recording audio..." presence indicators.
  • Native integration with WhatsApp PAUSE signaling for instant recipient feedback.
  • Essential for cleaning up states after agent transfers or workflow cancellations.
  • Zero-latency override of standard 20-second network-level timeouts.
  • Foundation for reliable "Try/Finally" error handling in automated AI bot systems.
  • Ensures a polished, professional conversational aesthetic by preventing "Phantom Typing."

البارامترات

قم بتهيئة المعاملات المطلوبة للتفاعل مع نقطة النهاية هذه. جميع وسائط الاستعلام والبيانات مدرجة أدناه مع تفاصيلها.

محتوى الطلب

يرسل كـ JSON
string

Your unique WhatsApp Instance ID

مثال:
string

Your API Access Token

مثال:
string

Target phone number or group ID

مثال:

برمج بالذكاء الاصطناعي باستخدام Wawp MCP

MCP READY

قم بربط الـ API مباشرة مع Cursor أو Windsurf أو Claude Desktop، ودع الذكاء الاصطناعي يكتب لك كود الربط وينفذه تلقائياً!

طريقة الربط والإعداد

أمثلة الكود

استخدم أمثلة الكود الجاهزة لدمج واجهة برمجة التطبيقات (API) في مشروعك بسرعة وكفاءة. اختر لغة البرمجة والمكتبة التي تفضلها.

1const baseUrl = "https://api.wawp.net";
2const endpoint = "/v2/send/stop-typing";
3const params = new URLSearchParams({
4 "instance_id": "123456789",
5 "access_token": "YOUR_ACCESS_TOKEN"
6}).toString();
7const body = {
8 "chatId": "201234567890@c.us"
9};
10
11fetch(`${baseUrl}${endpoint}${params ? '?' + params : ''}`, {
12 method: "POST",
13 headers: { "Content-Type": "application/json" },
14 body: JSON.stringify(body)
15})
16 .then(async (response) => {
17 if (response.ok) {
18 const data = await response.json();
19 console.log("Success:", data);
20 return data;
21 }
22
23 // Error Handling
24 if (response.status === 400) {
25 console.error("Error 400: طلب غير صالح - معاملات مطلوبة مفقودة");
26 }
27 if (response.status === 400) {
28 console.error("Error 400: طلب غير صالح - الرقم المستهدف في قائمة الحظر الخاصة بك");
29 }
30 if (response.status === 400) {
31 console.error("Error 400: طلب غير صالح - المستلم قام بإلغاء الاشتراك تلقائياً");
32 }
33 if (response.status === 400) {
34 console.error("Error 400: Bad Request - Invalid Number (Egypt)");
35 }
36 if (response.status === 400) {
37 console.error("Error 400: Bad Request - Invalid Number (Saudi Arabia)");
38 }
39 if (response.status === 400) {
40 console.error("Error 400: Bad Request - Invalid Number (Unknown)");
41 }
42 if (response.status === 400) {
43 console.error("Error 400: طلب غير صالح (تنسيق XML)");
44 }
45 if (response.status === 400) {
46 console.error("Error 400: طلب غير صالح (نص عادي)");
47 }
48 if (response.status === 401) {
49 console.error("Error 401: غير مصرح - مفتاح الوصول غير صالح أو مفقود");
50 }
51 if (response.status === 401) {
52 console.error("Error 401: غير مصرح (تنسيق XML)");
53 }
54 if (response.status === 404) {
55 console.error("Error 404: غير موجود - الجلسة غير موجودة");
56 }
57 if (response.status === 404) {
58 console.error("Error 404: غير موجود (تنسيق XML)");
59 }
60 if (response.status === 429) {
61 console.error("Error 429: طلبات كثيرة جداً - تم تجاوز حد المعدل");
62 }
63 if (response.status === 500) {
64 console.error("Error 500: خطأ في الخادم الداخلي - فشل غير متوقع");
65 }
66 if (response.status === 500) {
67 console.error("Error 500: خطأ في الخادم الداخلي (HTML)");
68 }
69 if (response.status === 502) {
70 console.error("Error 502: بوابة غير صالحة - فشل الاتصال بالخادم الرئيسي");
71 }
72 if (response.status === 502) {
73 console.error("Error 502: بوابة غير صالحة (تنسيق XML)");
74 }
75
76 const errorText = await response.text();
77 console.error(`Error ${response.status}: ${errorText}`);
78 })
79 .catch((error) => console.error("Network Error:", error));
عينات تفاعلية
Ln 79, Col 1javascript

الردود المتوقعة

استكشف كافة الردود والنتائج المحتملة من الخادم. قمنا بتوثيق كل كود حالة (Status Code) مع أمثلة للبيانات لتسهيل معالجة الأخطاء والنجاح.

تم إرسال الرسالة بنجاح
النوع:
application/json
object *
string *
object *
number *
boolean *
string *
string *
number *
string *
string *
string *
boolean *
number *
boolean *
boolean *
boolean *
boolean *
boolean *
array *
array *
array *
boolean *
array *

Example

{
"_data": {
  "id": {
    "fromMe": true,
    "remote": "000000000000@c.us",
    "id": "MSG_ID_123456",
    "_serialized": "true_000000000000@c.us_MSG_ID_123456"
    },
  "viewed": false,
  "body": "BASE64_IMAGE_DATA",
  "type": "image",
  "t": 1759108866,
  "from": {
    "server": "c.us",
    "user": "111111111111",
    "_serialized": "111111111111@c.us"
    },
  "to": {
    "server": "c.us",
    "user": "000000000000",
    "_serialized": "000000000000@c.us"
    },
  "ack": 0,
  "isNewMsg": true,
  "star": false,
  "kicNotified": false,
  "caption": "Here's your requested image.",
  "deprecatedMms3Url": "https://example.com/media-url",
  "directPath": "/media/direct/path/example",
  "mimetype": "image/jpeg",
  "filehash": "FILE_HASH_PLACEHOLDER",
  "encFilehash": "ENC_FILE_HASH_PLACEHOLDER",
  "size": 192487,
  "mediaKey": "MEDIA_KEY_PLACEHOLDER",
  "mediaKeyTimestamp": 1759108865,
  "streamable": false,
  "mediaHandle": null,
  "isFromTemplate": false,
  "pollInvalidated": false,
  "isSentCagPollCreation": false,
  "latestEditMsgKey": null,
  "latestEditSenderTimestampMs": null,
  "mentionedJidList": {
    },
  "groupMentions": {
    },
  "isEventCanceled": false,
  "eventInvalidated": false,
  "isVcardOverMmsDocument": false,
  "isForwarded": false,
  "isQuestion": false,
  "questionReplyQuotedMessage": null,
  "questionResponsesCount": 0,
  "readQuestionResponsesCount": 0,
  "labels": {
    },
  "hasReaction": false,
  "disappearingModeInitiator": "chat",
  "disappearingModeTrigger": "chat_settings",
  "productHeaderImageRejected": false,
  "lastPlaybackProgress": 0,
  "isDynamicReplyButtonsMsg": false,
  "isCarouselCard": false,
  "parentMsgId": null,
  "callSilenceReason": null,
  "isVideoCall": false,
  "callDuration": null,
  "callCreator": null,
  "callParticipants": null,
  "isCallLink": null,
  "callLinkToken": null,
  "isMdHistoryMsg": false,
  "stickerSentTs": 0,
  "lastUpdateFromServerTs": 0,
  "invokedBotWid": null,
  "bizBotType": null,
  "botResponseTargetId": null,
  "botPluginType": null,
  "botPluginReferenceIndex": null,
  "botPluginSearchProvider": null,
  "botPluginSearchUrl": null,
  "botPluginSearchQuery": null,
  "botPluginMaybeParent": false,
  "botReelPluginThumbnailCdnUrl": null,
  "botMessageDisclaimerText": null,
  "botMsgBodyType": null,
  "requiresDirectConnection": false,
  "bizContentPlaceholderType": null,
  "hostedBizEncStateMismatch": false,
  "senderOrRecipientAccountTypeHosted": false,
  "placeholderCreatedWhenAccountIsHosted": false,
  "galaxyFlowDisabled": false,
  "links": {
    }
  },
"mediaKey": "MEDIA_KEY_PLACEHOLDER",
"id": {
  "fromMe": true,
  "remote": "000000000000@c.us",
  "id": "MSG_ID_123456",
  "_serialized": "true_000000000000@c.us_MSG_ID_123456"
  },
"ack": 0,
"hasMedia": true,
"body": "Here's your requested image.",
"type": "image",
"timestamp": 1759108866,
"from": "111111111111@c.us",
"to": "000000000000@c.us",
"deviceType": "android",
"isForwarded": false,
"forwardingScore": 0,
"isStatus": false,
"isStarred": false,
"fromMe": true,
"hasQuotedMsg": false,
"hasReaction": false,
"vCards": {
  },
"mentionedIds": {
  },
"groupMentions": {
  },
"isGif": false,
"links": {
  }
}
طلب غير صالح - معاملات مطلوبة مفقودة
غير مصرح - مفتاح الوصول غير صالح أو مفقود
غير موجود - الجلسة غير موجودة
طلبات كثيرة جداً - تم تجاوز حد المعدل
خطأ في الخادم الداخلي - فشل غير متوقع
بوابة غير صالحة - فشل الاتصال بالخادم الرئيسي
الموضوع السابقبدء مؤشر الكتابة (Start Typing)
الموضوع التاليإرسال تفاعل (Reaction Emoji)

Command Palette

Search for a command to run...