Skip to content

Incoming text message#

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

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

typeWebhook = IncomingMessageReceived

messageData.typeMessage = textMessage

Webhook#

פרמטרים של Webhook#

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

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

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

פרמטר הקלד תיאור
הודעת טקסט **string* הודעת טקסט
isTemplateMessage בוליאנית הדגל מציין אם ההודעה נוצרה מתבנית

פרמטרי אובייקט 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": "textMessage",
    "textMessageData": {
      "textMessage": "I use Green-API to send this message to you!"
    }
  }
}

Text quoted 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": "quotedMessage",
    "extendedTextMessageData": {
      "text": "Это",
      "stanzaId": "B7F33B8947D872F30FAA646FEDCDE2EC",
      "participant": "79001234567@c.us"
    },
    "quotedMessage": {
      "stanzaId": "9A73322488DCB7D9689A6112F2528C9D",
      "participant": "79001234567@c.us",
      "typeMessage": "textMessage",
      "textMessage": "Hello"
    }
  }
}

Image/video/audio/document quote text message 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": "quotedMessage",
    "extendedTextMessageData": {
      "text": "Ответ",
      "stanzaId": "B4AA239D112CB2576897B3910FEDE26E",
      "participant": "79001230000@c.us"
    },
    "quotedMessage": {
      "stanzaId": "9A73322488DCB7D9689A6112F2528C9D",
      "participant": "79061230000@c.us",
      "typeMessage": "imageMessage",
      "downloadUrl": "",
      "caption": "",
      "jpegThumbnail": ""
    }
  }
}

Contact quote 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": "quotedMessage",
    "extendedTextMessageData": {
      "text": "Ответ",
      "stanzaId": "B4AA239D112CB2576897B3910FEDE26E",
      "participant": "79001230000@c.us"
    },
    "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"
      }
    }
  }
}

Location quote 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": "quotedMessage",
    "extendedTextMessageData": {
      "text": "Address",
      "stanzaId": "CA5654B8E8806ED7D033E758E7463AB9",
      "participant": "79001230000@c.us"
    },
    "quotedMessage": {
      "stanzaId": "9A73322488DCB7D9689A6112F2528C9D",
      "participant": "79060002233@c.us",
      "typeMessage": "locationMessage",
      "location": {
        "nameLocation": "",
        "address": "",
        "jpegThumbnail": "",
        "latitude": 72.5922702,
        "longitude": 39.6645388
      }
    }
  }
}

Link quote message webhook body example#

{
  "typeWebhook": "incomingMessageReceived",
  "instanceData": {
    "idInstance": 1234,
    "wid": "7000000000@c.us",
    "typeInstance": "whatsapp"
  },
  "timestamp": 1658261933,
  "idMessage": "CDF9219DD08D3D84CD4E621122AFBFFD",
  "senderData": {
    "chatId": "79000000000@c.us",
    "sender": "79000000000@c.us",
    "chatName": "John",
    "senderName": "John",
    "senderContactName": "John Doe"
  },
  "messageData": {
    "typeMessage": "quotedMessage",
    "extendedTextMessageData": {
      "text": "Hello",
      "stanzaId": "6FFC3BF49BEE0CF966397321C4E3D3DF",
      "participant": "79000000000@c.us"
    },
    "quotedMessage": {
      "stanzaId": "9A73322488DCB7D9689A6112F2528C9D",
      "participant": "79000000000@c.us",
      "typeMessage": "extendedTextMessage",
      "textMessage": "https://api.greenapi.com/send/?phone=7000000000&text&type=phone_number&app_absent=0",
      "extendedTextMessage": {
        "description": " is free and offers simple, secure, reliable messaging and calling, available on phones all over the world.",
        "title": "Share on ",
        "previewType": "None",
        "jpegThumbnail": null
      }
    }
  }
}

Webhook body example with error SWE001#

{
    "typeWebhook": "incomingMessageReceived",
    "instanceData":
        {
        "idInstance":1100000001,
        "wid":"79000000000@c.us",
        "typeInstance":"whatsapp"
    },
    "timestamp":1700545580,
    "idMessage":"3AE2864C77312000000",
    "senderData":
        {
        "chatId":"79000000001@c.us",
        "chatName":"John",
        "sender":"79000000001@c.us",
        "senderName":"John",
    "senderContactName": "John Doe"
    },
    "messageData":
        {
        "typeMessage":"textMessage",
        "textMessageData":
            {
            "textMessage":"{{SWE001}}"
        }
    }
}

Webhook body example with error SWE002#

{
    "typeWebhook":"incomingMessageReceived",
    "instanceData":
        {
        "idInstance":1100000001,
        "wid":"79000000000@c.us",
        "typeInstance":"whatsapp"
    },
    "timestamp":1700488335,
    "idMessage":"3EB0D00923D87A3FA01BAE",
    "senderData":
        {
        "chatId":"79000000000@c.us",
        "chatName":"John",
        "sender":"79000000000@c.us",
        "senderName":"John",
    "senderContactName": "John Doe"
    },
    "messageData":
        {
        "typeMessage":"documentMessage",
        "fileMessageData":
            {
            "downloadUrl":"{{SWE002}}",
            "caption":"",
            "fileName":"Harry Potter and the Philosopher's Stone.pdf",
            "jpegThumbnail":"",
            "mimeType":"application/pdf",
            "forwardingScore":0,
            "isForwarded":false
        }
    }
}

Webhook body example with error SWE003#

{
    "typeWebhook":"incomingMessageReceived",
    "instanceData":
        {
        "idInstance":1100000001,
        "wid":"79000000000@c.us",
        "typeInstance":"whatsapp"
    },
    "timestamp":1700218861,
    "idMessage":"6E112CC05BA05DD9DF",
    "senderData":
        {
        "chatId":"79000000000@c.us",
        "chatName":"John",
        "sender":"79000000000@c.us",
        "senderName":"John",
    "senderContactName": "John Doe"
        },
    "messageData":
                {
        "typeMessage":"textMessage",
        "textMessageData":
            {
            "textMessage":"{{SWE003}}"
        }
    }
}