Skip to content

Incoming text message or URL message#

סעיף זה מתאר פורמט webhook נכנס של אובייקט messageData עבור הודעת טקסט נכנסת עם כתובת URL. לתיאור של הפורמט הכללי של webhooks נכנסות, עיין בסעיף הודעות נכנסות.

כדי לקבל webhooks נכנס מסוג זה, שני תנאים חייבים להתקיים:

typeWebhook = IncomingMessageReceived

messageData.typeMessage = extendedTextMessage

Webhook#

פרמטרים של Webhook#

פרמטרים של אובייקט messageData

פרמטר הקלד תֵאוּר
typeMessage **string* סוג הודעה נכנסת. עבור הודעות מסוג זה, הפרמטר מקבל את הערך extendedTextMessage
extendedTextMessageData object אובייקט נתונים על קישור נכנס עם מטא נתונים
quotedMessage object אובייקט נתוני הודעה מצוטט. הצג רק אם ההודעה עצמה היא ציטוט

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

פרמטר הקלד תֵאוּר
טקסט **string* טקסט קישור או טקסט רגיל
תיאור **string* תיאור הקישור, עשוי להיות ריק
כותרת **string* כותרת הקישור, עשויה להיות ריקה
jpeg Thumbnail **string* תצוגה מקדימה של תמונה מקודדת base64, עשויה להיעדר
isForwarded בוליאנית בין אם ההודעה מועברת, מקבלת ערכים נכון/לא נכון
forwardingScore integer מספר העברות ההודעות
previewType **string* סוג תצוגה מקדימה (רק עבור הודעות פרסומת) previewType: הערך None הוצא משימוש
מכיל תגובה אוטומטית בוליאנית האם ההודעה מכילה תשובה אוטומטית (עבור הודעות פרסומת בלבד)
mediaType **string* סוג מדיה של הודעה, למשל "IMAGE" (עבור הודעות פרסומת בלבד)
showAdAttribution בוליאנית האם יש להציג את פרטי הפרסומת (רק עבור הודעות פרסומת)
sourceId **string* מזהה פרסומת (רק עבור הודעות פרסומת)
sourceType **string* סוג מקור, למשל "מודעה" (רק עבור הודעות פרסומת)
sourceUrl **string* כתובת אתר של פרסומת (עבור הודעות פרסומת בלבד)
thumbnailUrl **string* כתובת אתר לתצוגה מקדימה של תמונה (עבור הודעות פרסומת בלבד)

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

פרמטר הקלד תיאור
stanzaId **string* מזהה הודעה מצוטט
משתתף **string* מצוטט מזהה שולח ההודעה
typeMessage **string* סוג הודעה מצוטט

שאר השדות ממולאים בהתאם לסוג ההודעה המצוטטת והם זהים לשדות ההודעות הנכנסות המתוארות בסעיף הודעות נכנסות

דוגמה לגוף Webhook#

{
    "typeWebhook": "incomingMessageReceived",
    "instanceData": {
        "idInstance": 1234,
        "wid": "11001234567@c.us",
        "typeInstance": "whatsapp"
    },
    "timestamp": 1588091580,
    "idMessage": "F7AEC1B7086ECDC7E6E45923F5EDB825",
    "senderData": {
        "chatId": "79001234567@c.us",
        "sender": "79001234567@c.us",
        "chatName": "John",
        "senderName": "John",
        "senderContactName": "John Doe"
    },
    "messageData": {
        "typeMessage": "extendedTextMessage",
        "extendedTextMessageData": {
            "text": "https://green-api.com/docs/video",
            "description": "GREEN-API docs show how you can develop the WhatsApp Bot",
            "title": "How to develop WhatsApp Bot",
            "jpegThumbnail": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYG==",
            "forwardingScore": 4,
            "isForwarded": true
        }
    }
}

קישור או טקסט והצעה ליצירת קשר דוגמה לגוף ההודעה הנכנסת webhook#

{
  "typeWebhook": "incomingMessageReceived",
  "instanceData": {
    "idInstance": 1234,
    "wid": "11001234567@c.us",
    "typeInstance": "whatsapp"
  },
  "timestamp": 1588091580,
  "idMessage": "F7AEC1B7086ECDC7E6E45923F5EDB825",
  "senderData": {
    "chatId": "79001234567@c.us",
    "sender": "79001234567@c.us",
    "senderName": "John",
    "senderContactName": "John Doe"
  },
  "messageData": {
    "typeMessage": "quotedMessage",
    "extendedTextMessageData": {
      "text": "https://yandex.ru/former&utm_source=home&utm_content=main_informer&utm_term=main_number",
      "stanzaId": "0EA554E587820E35309858AE265BE7EA",
      "participant": "79001230000@c.us",
      "forwardingScore": 4,
      "isForwarded": true
    },
    "quotedMessage": {
      "stanzaId": "9A73322488DCB7D9689A6112F2528C9D",
      "participant": "79061230000@c.us",
      "typeMessage": "contactMessage",
      "contact": {
        "displayName": "Green-Api",
        "vcard": "BEGIN:VCARD\nVERSION:3.0\nN:Green-Api\nitem1.TEL;waid=79001230000\nitem1.X-ABLabel:Mobile\nEND:VCARD"
      }
    }
  }
}

קישור וציטוט תמונה דוגמה לגוף ההודעה הנכנסת#

{
  "typeWebhook": "incomingMessageReceived",
  "instanceData": {
    "idInstance": 1234,
    "wid": "11001234567@c.us",
    "typeInstance": "whatsapp"
  },
  "timestamp": 1588091580,
  "idMessage": "F7AEC1B7086ECDC7E6E45923F5EDB825",
  "senderData": {
    "chatId": "79001234567@c.us",
    "sender": "79001234567@c.us",
    "senderName": "John",
    "senderContactName": "John Doe"
  },
  "messageData": {
    "typeMessage": "quotedMessage",
    "extendedTextMessageData": {
      "text": "https://yandex.ru/pogoda/?utm_medium=source=home&utm_content=main_informer&utm_term=main_number",
      "stanzaId": "B4AA239D112CB2576897B3910FEDE26E",
      "participant": "79001230000@c.us",
      "forwardingScore": 4,
      "isForwarded": true
    },
    "quotedMessage": {
      "stanzaId": "9A73322488DCB7D9689A6112F2528C9D",
      "participant": "79061230000@c.us",
      "typeMessage": "imageMessage",
      "downloadUrl": "",
      "caption": "",
      "jpegThumbnail": ""
    }
  }
}