ShowMessagesQueue#
השיטה מכוונת לקבלת רשימה של הודעות בתור לשליחה. ההודעות יישמרו 24 שעות בתור עד לאישור המופע. קצב שליחת ההודעות מנוהל על ידי עיכוב בשליחת הודעות פָּרָמֶטֶר.
השיטה מחזירה את 500 ההודעות הראשונות שנוספו לתור השליחה.
בַּקָשָׁה#
כדי לקבל תור הודעות, עליך לבצע בקשה בכתובת:
GET
{{apiUrl}}/waInstance{{idInstance}}/showMessagesQueue/{{apiTokenInstance}}
לקבלת פרמטרי בקשה של 'apiUrl', 'idInstance' ו-'apiTokenInstance', עיין בסעיף לפני שמתחילים.
תְגוּבָה#
פרמטרי תגובה#
מערך אובייקטים עם פרמטרים:
שָׂדֶה | סוּג | תֵאוּר |
---|---|---|
messageID | string | מזהה הודעה, אם type = sendMessage /sendPoll /sendFileByUrl /sendLocation /sendContact /sendTextStatus /sendMediaStatus /sendVoiceStatus |
messagesIDs | array | מערך מזהי הודעות, אם type = ForwardMessages |
type | string | סוג הבקשה: |
sendMessage - הודעת טקסט | ||
sendPoll - הודעה עם סקר | ||
sendFileByUrl - הודעה עם קובץ (הודעות שנשלחו על ידי sendFileByUrl, sendFileByUpload) | ||
sendLocation - הודעה עם מיקום | ||
שלחContact - הודעה עם איש קשר | ||
sendLink - הודעה עם קישור (הוצא משימוש) | ||
ForwardMessages - הודעות להעברה | ||
sendVoiceStatus - מצב קול | ||
sendMediaStatus - סטטוס וידאו או תמונה | ||
sendTextStatus - סטטוס טקסט | ||
editMessage - עריכת הודעה | ||
body | object | אובייקט נתוני הודעת תור |
שדות של אובייקט 'גוף':
שָׂדֶה | סוּג | תֵאוּר |
---|---|---|
chatId | string | מזהה צ'אט אליו תישלח ההודעה |
message | string | טקסט הודעה, אם type = sendMessage /sendPoll /sendFileByUrl /sendLocation /sendContact /sendTextStatus |
messages | array | מערך הודעות שהועברו, אם 'סוג' = 'העבר הודעות' |
linkPreview | boolean | הפרמטר כולל הצגת תצוגה מקדימה ותיאור של הקישור, אם type = sendMessage /sendTextStatus |
typePreview | string | גודל תצוגה מקדימה. ערכים אפשריים הם large לתצוגה מקדימה גדולה ו-small לתצוגה מקדימה קטנה |
customPreview | object | אובייקט נתונים אודות התצוגה המקדימה המותאמת אישית |
quotedMessageId | string | מזהה הודעה מצוטט, אם type = sendMessage /sendPoll /sendFileByUrl /sendLocation /sendContact |
options | array | מערך אפשרויות סקר, אם 'סוג' = 'שלח סקר' |
fileName | string | שם הקובץ שיש לשלוח, אם type = sendFileByUrl /sendMediaStatus /sendVoiceStatus |
caption | string | תיאור מתחת לקובץ, אם type = sendFileByUrl /sendMediaStatus |
urlFile | string | קישור לקובץ שהועלה type = sendFileByUrl /sendMediaStatus /sendVoiceStatus |
archive | string | השדה הוצא משימוש, אם type = sendFileByUrl |
latitude | string | קו הרוחב של המיקום, אם 'סוג' = 'sendLocation' |
longitude | string | קו האורך של המיקום, אם 'סוג' = 'sendLocation' |
nameLocation | string | שם מיקום, אם type = sendLocation |
address | string | כתובת מיקום, אם 'סוג' = 'sendLocation' |
contact | object | אובייקט נתונים לגבי הודעה עם איש קשר, אם סוג = contactMessage |
backgroundColor | string | רקע הודעה, אם type = sendTextStatus /sendVoiceStatus |
font | string | גופן טקסט, אם type = sendTextStatus |
participants | array | מערך של מיתרים עם תעודות איש קשר עבור מי הסטטוס יהיה זמין, אם type = sendTextStatus /sendMediaStatus /sendVoiceStatus |
urlLink | string | כתובת האתר של הקישור, אם 'סוג' = 'שלח קישור' (הוצא משימוש) |
chatIdFrom | string | מזהה צ'אט שממנו מועברת ההודעה |
שדות של האובייקט customPreview
:
Field | Type | Description |
---|---|---|
title | string | תצוגה מקדימה של כותרת (עד 300 תווים) |
description | string | תיאור (עד 300 תווים) |
link | string | שם דומיין לאתר עם קישור (עד 300 תווים) |
urlFile | string | קישור לקובץ תמונה ליצירת תצוגה מקדימה גדולה |
jpegThumbnail | string | תצוגה מקדימה של תמונה ב-base64 |
שדות של מערך options
:
פָּרָמֶטֶר | סוּג | תֵאוּר |
---|---|---|
optionName | string | טקסט אפשרות בחירת סקר |
שדות של אובייקט contact
:
שָׂדֶה | סוּג | תֵאוּר |
---|---|---|
phoneContact | string | מספר טלפון ליצירת קשר בפורמט בינלאומי (ללא +) 11 או 12 ספרות |
firstName | string | שם פרטי איש קשר |
lastName | string | שם משפחה של איש קשר |
middleName | string | שם אמצעי ליצירת קשר |
company | string | צור קשר עם שם החברה |
בקשת גוף לדוגמה#
[
{
"messageID": "BAE123456789",
"type": "sendMessage",
"body": {
"chatId": "11001234567@c.us",
"message": "I use Green-API to send this message to you!",
"linkPreview": true
}
},
{
"messageID": "BAE1234567123",
"type": "sendMessage",
"body": {
"chatId": "11001234567@c.us",
"message": "Hello",
"quotedMessageId": "BAE123456789",
"linkPreview": true
}
},
{
"messageID": "BAE5DE8CA912345",
"type": "sendPoll",
"body": {
"chatId": "11001234567@c.us",
"message": "Please choose the color:",
"options": [
{
"optionName": "green"
},
{
"optionName": "red"
}
]
}
},
{
"messageID": "BAE1234567789",
"type": "sendFileByUrl",
"body": {
"fileName": "test.jpg",
"chatId": "11001234567@c.us",
"quotedMessageId": "BAE1234567159",
"caption": "caption",
"archive": false,
"urlFile": "https://sw-media-out.storage.net/1101123456/5005fe15-23ee-43ef-8535-35e1dff8315c.jpg"
}
},
{
"messageID": "BAE1234561230",
"type": "sendLocation",
"body": {
"chatId": "11001234567@c.us",
"latitude": 44.9370129,
"longitude": 89.8728409,
"nameLocation": "I'm here, come",
"address": "613123, Perm"
}
},
{
"messageID": "BAE1234567456",
"type": "sendContact",
"body": {
"chatId": "11001234567@c.us",
"contact": {
"phoneContact": 79001234567,
"firstName": "Harry",
"lastName": "Aben",
"middleName": "Paris",
"company": "Bicycles"
}
}
},
{
"messagesIDs": [
"BAE1234561256",
"BAE1234561278"
],
"type": "ForwardMessages",
"body": {
"chatId": "11001234567@g.us",
"chatIdFrom": "12036304684212345@g.us",
"messages": [
"BAE1234561296",
"BAE1234561205"
]
}
},
{
"messageID": "BAE583864C6D427F",
"type": "sendTextStatus",
"body": {
"message": "I use Green-API to send this Status!",
"backgroundColor": "#228B22",
"font": "SERIF",
"participants": [ //status will be available only to the specified contacts
"70000001234@c.us",
"70000001235@c.us"
],
"linkPreview": true
}
},
{
"messageID": "BAE514E5B2E4B22D",
"type": "sendVoiceStatus",
"body": {
"urlFile": "https://my.site.com/audio/music.mp3",
"fileName": "music.mp3",
"backgroundColor": "#228B22",
"participants": [] // status available for everyone
}
},
{
"messageID": "BAE5D81B7C3EED1C",
"type": "sendMediaStatus",
"body": {
"urlFile": "https://my.site.com/img/horse.png",
"fileName": "horse.png",
"caption": "Little horse",
"participants": [] // status available for everyone
}
},
{
"messageID": "BAE5611039B271DE",
"type": "editMessage",
"body": {
"chatId": "11001234567@c.us",
"message": "Message",
"idMessage": "BAE5644EDA6EB464",
"linkPreview": true
}
},
{
"messageID": "BAE51A04FD58C43E",
"type": "sendMessage",
"body": {
"chatId": "79876543210@c.us",
"message": "link 1: https://green-api.com/en/docs/api/sending/SendMessage/ \n link 2: https://green-api.com/en",
"linkPreview": true,
"typePreview": "large",
"customPreview": {
"title": "Custom Preview",
"description": "Wow!",
"link": "https://green-api.com",
"urlFile": "https://storage.yandexcloud.net/green-api.com/logo/Logo_GREEN-API.jpg"
}
}
},
{
"messageID": "BAE586AAB953AF5F",
"type": "sendMessage",
"body": {
"chatId": "79876543210@c.us",
"message": "link 1: https://green-api.com/en/docs/api/sending/SendMessage/ \n link 2: https://green-api.com/en",
"linkPreview": true,
"typePreview": "small",
"customPreview": {
"title": "Custom Preview",
"description": "Wow!",
"link": "https://green-api.com",
"jpegThumbnail": "/9j/2wCEAAEBAQEBAQEBAgAooooAKKKKACiiigAooooAKKKKACiiigAooooA//9k=",
"urlFile": ""
}
}
}
]
ShowMessagesQueue errors#
For a list of errors common to all methods, refer to Common errors section
Request examples#
import requests
url = "{{apiUrl}}/waInstance{{idInstance}}/showMessagesQueue/{{apiTokenInstance}}"
payload = {}
headers= {}
response = requests.request("GET", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
curl --location '{{apiUrl}}/waInstance{{idInstance}}/showMessagesQueue/{{apiTokenInstance}}'
var restTemplate = new RestTemplate();
var requestUrl = new StringBuilder();
requestUrl
.append({{apiUrl}})
.append("/waInstance").append({{idInstance}})
.append("/showMessagesQueue/")
.append({{apiTokenInstance}});
var response = restTemplate.exchange(requestUrl.toString(), HttpMethod.GET, null, String.class);
System.out.println(response);
var requestUrl = new StringBuilder();
requestUrl
.append({{apiUrl}})
.append("/waInstance").append({{idInstance}})
.append("/showMessagesQueue/")
.append({{apiTokenInstance}});
var response = Unirest.get(requestUrl.toString())
.header("Content-Type", "application/json")
.asString();
System.out.println(response);
Sub ShowMessagesQueue()
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}}/showMessagesQueue/{{apiTokenInstance}}"
Set http = CreateObject("MSXML2.XMLHTTP")
http.Open "GET", 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