DeleteNotification#
השיטה מכוונת למחיקת הודעה נכנסת מתור ההודעות. כדי לציין איזו הודעה למחוק, השתמש בפרמטר receiptId. לאחר קבלת ועיבוד הודעה נכנסת, עליך למחוק את ההודעה מהתור. זה מחייב אותך להפעיל את השיטה הזו. לאחר הקריאה לשיטה, ההודעה תיחשב כמתקבלת ומעובדת ותימחק לצמיתות מהתור. לכן, השיחה הבאה של ReceiveNotification method will return the next notification from the queue in the order in which notifications come to the queue.
הודעות נכנסות נשמרות בתור למשך 24 שעות.
הודעות נשלחות מהתור פנימה FIFO order
בַּקָשָׁה#
כדי למחוק הודעה נכנסת מהתור, עליך לבצע בקשה בכתובת:
{{apiUrl}}/waInstance{{idInstance}}/deleteNotification/{{apiTokenInstance}}
Note that you have to use a request of
DELETEtype
לפרמטרים של בקשת apiUrl, idInstance ו-apiTokenInstance, עיין ב לפני שמתחילים סָעִיף.
בקש פרמטרים#
| פָּרָמֶטֶר | סוּג | הֶכְרֵחִי | תֵאוּר |
|---|---|---|---|
receiptId | integer | כֵּן | מזהה קבלה למחיקת הודעה נכנסת שהתקבלה על ידיReceiveNotification שִׁיטָה |
Response#
Response parameters#
| פָּרָמֶטֶר | סוּג | תֵאוּר |
|---|---|---|
result | boolean | תוצאת מחיקת הודעה נכנסת: true - הודעה נכנסת נמחקה בהצלחה מהתור; 'false' - ההודעה לא נמחקה - אפשרי, אם ההודעה נמחקה קודם לכן או 'receiptId' אינו תואם לערך שהתקבל בעבר על ידי ReceiveNotification method |
Response body example#
{
"result": true
}
שגיאות DeleteNotification#
רשימת השגיאות המשותפות לכל השיטות מופיעה בסעיף שגיאות נפוצות
| קוד HTTP | מזהה השגיאה | תיאור |
|---|---|---|
| 400 | Parameter idInstance not an integer | הפרמטר idInstance לא צוין או שהוא מכיל תווים שאינם ספרות |
| 400 | Parameter receiptId must be a Number! | הערך שצוין בפרמטר receiptId אינו מספר |
| 400 | Parameter apiTokenInstance not define | הפרמטר apiTokenInstance לא צוין |
| 400 | Message cannot be received because custom webhook url is set. Go to cabinet, clear webhook url for instance: ХХХХХХХХХХ and wait for about 1 minute for another attempt | השדה webhookUrl אינו ריק. יש לנקות את כתובת ה-URL במופע XXXXXXXXXXX ולהמתין כדקה לפני שליחת בקשות לקבלת התראות |
| 500 | Internal Server Error Cannot read properties of undefined (reading 'findUnAckedMessage') | ההודעה שניסיתם למחוק לא נמצאה |
Request examples#
import requests
url = "{{apiUrl}}/waInstance{{idInstance}}/deleteNotification/{{apiTokenInstance}}/1234567"
payload = {}
headers= {}
response = requests.request("DELETE", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
curl --location --request DELETE '{{apiUrl}}/waInstance{{idInstance}}/deleteNotification/{{apiTokenInstance}}/1234567'
var receiptId = 1;
var restTemplate = new RestTemplate();
var requestUrl = new StringBuilder();
requestUrl
.append({{apiUrl}})
.append("/waInstance").append({{idInstance}})
.append("/deleteNotification/")
.append({{apiTokenInstance}})
.append("/").append(receiptId);
var response = restTemplate.exchange(requestUrl.toString(), HttpMethod.DELETE, null, String.class);
System.out.println(response);
var receiptId = 1;
var requestUrl = new StringBuilder();
requestUrl
.append({{apiUrl}})
.append("/waInstance").append({{idInstance}})
.append("/deleteNotification/")
.append({{apiTokenInstance}})
.append("/").append(receiptId);;
var response = Unirest.delete(requestUrl.toString())
.asString();
System.out.println(response);
Sub DeleteNotification()
Dim url As String
Dim http As Object
Dim response As String
' The apiUrl, idInstance and apiTokenInstance values are available in console, double brackets must be removed
url = "{{apiUrl}}/waInstance{{idInstance}}/deleteNotification/{{apiTokenInstance}}/12345"
Set http = CreateObject("MSXML2.XMLHTTP")
http.Open "DELETE", url, False
http.Send
response = http.responseText
Debug.Print response
' Outputting the answer to the desired cell
' Range("A1").Value = response
Set http = Nothing
End Sub
You can see the example of notifications receipt code on NodeJS in the file ReceiveNotifications