Skip to content

SendTemplateButtons#

שים לב, בבקשה! השיטה לא עובדת באופן זמני

כאשר השיטה נקראת, תוחזר שגיאת 403.

השיטה מיועדת לשליחת הודעה עם כפתורים אינטראקטיביים של רשימת תבניות לצ'אט אישי או קבוצתי. ההודעה תתווסף לתור השליחה. ההודעה תישמר 24 שעות בתור ותשלח מיד לאחר אישור טלפוני. קצב שליחת ההודעות מהתור מנוהל על ידי פרמטר עיכוב שליחת הודעות.

בקשה#

כדי לשלוח הודעה, עליך לבצע בקשה בכתובת:

POST
{{apiUrl}}/waInstance{{idInstance}}/sendTemplateButtons/{{apiTokenInstance}}

לפרמטרים של בקשת apiUrl, idInstance ו-apiTokenInstance, עיין בסעיף לפני שמתחילים.

תכונות בעבודה עם כפתורים#

  • לחצני url תואמים לחצני מספרי טלפון, אך לא ללחצני תשובה;
  • כפתורי מספרי טלפון кнопки תואמים לחצני url, אך לא ללחצני תשובה;
  • כפתורי תשובה מהירה אינם תואמים לחצני מספרי טלפון ולחצני url.

פרמטרי בקשה#

פרמטר הקלד חובה תֵאוּר
chatId string כן צ'אט מזהה
message string כן טקסט הודעה. דמויות Emoji 😃 נתמכות
footer string לא כותרת תחתונה של הודעה. שימושי להדגשה ויזואלית של טקסט הקשור ללחצנים.
templateButtons array כן לחצני תבנית הודעה
quotedMessageId string לא מזהה הודעה מצוטט. אם קיימת, ההודעה תישלח בציטוט הודעת הצ'אט שצוינה

פרמטרי מערך 'templateButtons'

פרמטר הקלד תיאור
index integer זיהוי לחצן
urlButton object כפתור כתובת אתר
callButton object כפתור שיחה
quickReplyButton object כפתור רגיל

פרמטרי אובייקט urlButton

פרמטר הקלד תיאור
displayText string טקסט קישור
url string קישור אינטרנט

פרמטרי אובייקט 'callButton'

פרמטר הקלד תיאור
displayText string טקסט קישור
phoneNumber string מספר טלפון

פרמטרי אובייקט quickReplyButton

פרמטר הקלד תיאור
displayText string טקסט לחצן
id string מזהה לחצן

האורך המרבי של הודעת טקסט הוא 4096 תווים

דוגמה לגוף הבקשה#

שליחת הודעה לצ'אט אישי:

{
  "chatId": "11001234567@c.us",
  "message": "שלום",
 "footer": "איזה סוג פעולה תבחר?",
 "templateButtons": [
 {"index": 1, "urlButton": {"displayText": "⭐ סמן אותנו ב-GitHub!", "url": "https://github.com/green-api"}},
 {"index": 2, "callButton": {"displayText": "התקשר אלינו", "phoneNumber": "+1 (234) 5678-901"}},
 {"index": 3, "quickReplyButton": {"displayText": "Plain button", "id": "plainButtonId"}}
 ]
}

תגובה#

פרמטרי תגובה#

פרמטר הקלד תיאור
idMessage string זיהוי הודעה נשלחה

דוגמה לגוף התגובה#

{
 "idMessage": "3EB0C767D097B7C7C030"
}

דוגמה לתצוגה של הנמען#

כפתור התקשרות חזרה
דוגמה להצגת כפתורים

כפתור כתובת אתר
דוגמה להצגת כפתורים

כפתור תשובה מהירה
דוגמה להצגת כפתורים

שגיאות SendMessage#

לרשימה של שגיאות משותפות לכל השיטות, עיין בסעיף שגיאות נפוצות

טעויות אפשריות

When using the SendTemplateButtons method, messages may not be displayed on the web, desktop, and mobile versions of the application. The ability to send messages with buttons is implemented by us in a low-level way. The official WhatsApp-Web client does not provide the functionality of sending buttons. To a large extent, the stability of the SendTemplateButtons method does not depend on us, WhatsApp constantly makes changes to their work.

We recommend that you always duplicate buttons with regular messages.

For example, use numbers to define choices.

Choose an action:

1 - action 1

2 - action 2

3 - action 3

curl example#

```
curl --location --request POST '{{apiUrl}}/waInstance{{idInstance}}/sendTemplateButtons/{{apiTokenInstance}}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "chatId": "11001234567@c.us",
    "message": "Hello",
    "footer": "What kind of action will you choose?",
    "templateButtons": [
            {"index": 1, "urlButton": {"displayText": "⭐ Star us on GitHub!", "url": "https://github.com/green-api"}},
            {"index": 2, "callButton": {"displayText": "Call us", "phoneNumber": "+1 (234) 5678-901"}},
            {"index": 3, "quickReplyButton": {"displayText": "Plain button", "id": "plainButtonId"}}
        ]
}'
```