Skip to content

Incoming image, video, audio, document message#

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

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

typeWebhook = IncomingMessageReceived

messageData.typeMessage = imageMessage || הודעה וידאו || מסמך הודעה || 'הודעה שמע'

Webhook#

פרמטרים של Webhook#

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

פרמטר הקלד תיאור
typeMessage string סוג הודעה שהתקבלה. עבור הודעות מסוג זה, השדה מקבל את הערך: imageMessage, videoMessage, documentMessage, audioMessage
fileMessageData object אובייקט נתוני קובץ שהתקבל
quotedMessage object אובייקט נתוני הודעה מצוטט. הצג רק אם ההודעה עצמה היא ציטוט

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

פרמטר הקלד תיאור
כתובת אתר להורדה string קישור להורדת קובץ
כיתוב string כיתוב קובץ
שם קובץ string שם הקובץ. השדה מולא נכון רק עבור typeMessage = documentMessage, במקרים אחרים שם הקובץ נוצר אוטומטית
jpeg Thumbnail string תצוגה מקדימה של תמונה ב-base64
mimeType string סוג קובץ לפי הסיווג סוגי מדיה
isForwarded boolean בין אם ההודעה מועברת, מקבלת ערכים אמת/לא נכון
forwardingScore integer מספר העברות הודעות
videoNote boolean Only for video messages. Field takes the value true for an instant video message and false for a ordinary video message.

בעת שליחת תמונות דרך ה-API ברזולוציה גבוהה מ-3000x3000, לא תיווצר תצוגה מקדימה. השדה 'jpegThumbnail' בהודעות ובהודעות שהתקבלו יהיה ריק.

פרמטרי אובייקט 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": "imageMessage",
    "fileMessageData": {
      "downloadUrl": "https://api.greenapi.com/waInstance1234/downloadFile/19136A974392FA8CF584D70DD0E1AEDF",
      "caption": "Image",
      "jpegThumbnail": "",
      "mimeType": "image/jpeg",
      "forwardingScore": 4,
      "isForwarded": true
    }
  }
}

Audio and text quote incoming message webhook body example#

{
  "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": "audioMessage",
    "fileMessageData": {
      "downloadUrl": "https://sw-media.storage.greenapi.net/9901742665/39c20293-eb8d-abdd-5fdd1b83820a.mpga",
      "fileName": "39c20293-eb8d-abdd-5fdd1b83820a.mpga",
      "mimeType": "image/jpeg",
      "forwardingScore": 4,
      "isForwarded": true
    },
    "quotedMessage": {
      "stanzaId": "9A73322488DCB7D9689A6112F2528C9D",
      "participant": "79001234569@c.us",
      "typeMessage": "textMessage",
      "textMessage": "Hello"
    }
  }
}

Audio and audio/video/document quote incoming message webhook body example#

{
  "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": "audioMessage",
    "fileMessageData": {
      "downloadUrl": "https://s/990173687/801078ab-3340-4e4aa5.ogg",
      "caption": "",
      "fileName": "801078ab-3340-4f78-е9978be4aa5.ogg",
      "jpegThumbnail": "",
      "mimeType": "audio/ogg",
      "forwardingScore": 4,
      "isForwarded": true
    },
    "quotedMessage": {
      "stanzaId": "9A73322488DCB7D9689A6112F2528C9D",
      "participant": "79001234567@c.us",
      "typeMessage": "imageMessage",
      "downloadUrl": "",
      "caption": "",
      "jpegThumbnail": ""
    }
  }
}

Image and location quote incoming message webhook body example#

{
  "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": "imageMessage",
    "fileMessageData": {
      "downloadUrl": "https://sw-media.storage.greenapi.net/0b-9784-483b-8426-e8d871d6de9f.jpeg",
      "caption": "",
      "fileName": "d417740b483b-8426-e8d871d6de9f.jpeg",
      "jpegThumbnail": "",
      "mimeType": "image/jpeg",
      "forwardingScore": 4,
      "isForwarded": true
    },
    "quotedMessage": {
      "stanzaId": "9A73322488DCB7D9689A6112F2528C9D",
      "participant": "79060002233@c.us",
      "typeMessage": "locationMessage",
      "location": {
        "nameLocation": "",
        "address": "",
        "jpegThumbnail": "",
        "latitude": 72.5922702,
        "longitude": 45.6645388
      }
    }
  }
}

Image and contact quote incoming message webhook body example#

{
  "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": "imageMessage",
    "fileMessageData": {
      "downloadUrl": "https://sw-media.storage.greenapi.net/542ad819-166b-40a4-b0e1-279069cd03bb.jpeg",
      "caption": "",
      "fileName": "542ad819-166b-b0e1-279069cd03bb.jpeg",
      "jpegThumbnail": "",
      "mimeType": "image/jpeg",
      "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:Мобильный\nEND:VCARD"
      }
    }
  }
}

Video incoming message webhook body example#

The videoNote field takes the value true for an instant video message and false for a ordinary video message.

{
        "typeWebhook": "incomingMessageReceived",
        "instanceData": {
            "idInstance": 1234,
            "wid": "11001234567@c.us",
            "typeInstance": "whatsapp"
        },
        "timestamp": 1741243695,
        "idMessage": "811C5FBF0BB676C3D73743331789E7FA",
        "senderData": {
            "chatId": "79001234567@c.us",
            "chatName": "Ivan",
            "sender": "79001234567@c.us",
            "senderName": "Jon Doe",
            "senderContactName": "Ivan"
        },
        "messageData": {
            "typeMessage": "videoMessage",
            "fileMessageData": {
                "downloadUrl": "https://api.green-api.com/444444/892c70.mp4",
                "caption": "",
                "fileName": "892c70.mp4",
                "jpegThumbnail": "",
                "isAnimated": false,
                "mimeType": "video/mp4",
                "forwardingScore": 0,
                "isForwarded": false,
                "videoNote": true
        }
}