+7 495 255 06 20
Войти Начать бесплатно
Сменить регион сайта
Россия (выбрано)
English Казахстан и СНГ

Входящее событие "message"

Пример объекта message (входящее/исходящее сообщение)

Данная статья содержит примеры объектов сообщений, которые могут быть получены через вебхуки и Pusher-события. Сообщения могут быть как входящими, так и исходящими, и они передаются в виде JSON. В зависимости от типа сообщения (текстовое, с файлом, шаблонное и т.д.), объект сообщения может содержать различный набор полей.

Пример текстового сообщения 

{
  "data": [
    {
      "id": "BAE506C4504E06D8",
      "internalId": 6041,
      "groupId": null,
      "fromApi": true,
      "fromMe": true,
      "side": "out",
      "time": 1727357016,
      "type": "text",
      "subtype": null,
      "message": {
        "text": "Текстовое сообщение",
        "textLang": null,
        "caption": "",
        "file": null,
        "location": null,
        "template": null,
        "html": ""
      },
      "quotedMessage": null,
      "fromUser": {
        "id": "70000000000@c.us",
        "username": null,
        "name": "70000000000",
        "phone": "70000000000",
        "email": null
      },
      "chat": {
        "id": "70000000001@c.us",
        "internalId": 296,
        "fullId": "0fd9e908a1da02732f83f0d08961a59e",
        "hash": null,
        "type": "private",
        "phone": "70000000001",
        "username": null,
        "email": null,
        "name": "Имя контакта",
        "image": "https://download.samplelib.com/jpeg/sample-green-400x300.jpg",
        "lastTime": 1727357016,
        "automations": {
          "bots": {
            "active": true
          },
          "autoResponses": {
            "active": true
          },
          "triggers": {
            "active": true
          }
        },
        "link": null,
        "tags": null,
        "responsible": null,
        "producer": null,
        "accomplices": null,
        "auditors": null,
        "status": null,
        "level": null,
        "responsiblePin": false,
        "process": null,
        "timeLastInMessage": 1727093495,
        "unreadMessages": 1,
        "lastRead": null,
        "advert": null,
        "secondLink": null,
        "subtype": null,
        "inviteLink": null,
        "lastMessage": {
          "type": "text",
          "previewText": "Текстовое сообщение",
          "previewTextLang": null
        },
        "comment": null,
        "consentSendMessage": null,
        "archive": false
      },
      "fromApp": {
        "id": "app_25095_1",
        "tracking": null,
        "sender": "employee"
      },
      "utm": null,
      "created": {
        "id": 25095
      },
      "forwarded": false,
      "edited": false
    }
  ],
  "meta": {
    "type": "message",
    "licenseId": 1,
    "messengerType": "grWhatsApp"
  }
}

Пример сообщения с файлом

{
  "data": [
    {
      "id": "B4E4501FDF558C8124",
      "internalId": 6182,
      "groupId": null,
      "fromApi": false,
      "fromMe": true,
      "side": "out",
      "time": 1727594205,
      "type": "file",
      "subtype": null,
      "message": {
        "text": "",
        "textLang": null,
        "caption": "",
        "file": {
          "link": "https://s3.us-east-1.wasabisys.com/devapi.chatapp.online/chatFiles/1/grWhatsApp/2024/09/29/97de057c-4e42-4cf-9c1e-56d6.zip",
          "name": "file_name.zip",
          "contentType": "application/zip"
        },
        "location": null,
        "template": null,
        "html": ""
      },
      "quotedMessage": null,
      "fromUser": {
        "id": "70000000000@c.us",
        "username": null,
        "name": "70000000000",
        "phone": "70000000000",
        "email": null
      },
      "chat": {
        "id": "70000000001@c.us",
        "internalId": 296,
        "fullId": "0fd9e908a1da02732f83f0d08961a59e",
        "hash": null,
        "type": "private",
        "phone": "70000000001",
        "username": null,
        "email": null,
        "name": "Имя контакта",
        "image": "https://download.samplelib.com/jpeg/sample-green-400x300.jpg",
        "lastTime": 1727594205,
        "automations": {
          "bots": {
            "active": true
          },
          "autoResponses": {
            "active": true
          },
          "triggers": {
            "active": true
          }
        },
        "link": null,
        "tags": null,
        "responsible": null,
        "producer": null,
        "accomplices": null,
        "auditors": null,
        "status": null,
        "level": null,
        "responsiblePin": false,
        "process": null,
        "timeLastInMessage": 1727093495,
        "unreadMessages": 1,
        "lastRead": null,
        "advert": null,
        "secondLink": null,
        "subtype": null,
        "inviteLink": null,
        "lastMessage": {
          "type": "file",
          "previewText": "",
          "previewTextLang": null
        },
        "comment": null,
        "consentSendMessage": null,
        "archive": false
      },
      "fromApp": {
        "id": "native",
        "tracking": null,
        "sender": null
      },
      "utm": null,
      "created": null,
      "forwarded": false,
      "edited": false
    }
  ],
  "meta": {
    "type": "message",
    "licenseId": 1,
    "messengerType": "grWhatsApp"
  }
}

Пример голосового сообщения (доступно для мессенджеров: grWhatsApp, WhatsApp, caWhatsApp, telegram, telegramBot, instagram, facebook, vkontakte)

{
  "data": [
    {
      "id": "5AF3D76AD402A9ED44",
      "internalId": 6185,
      "groupId": null,
      "fromApi": false,
      "fromMe": true,
      "side": "out",
      "time": 1727595489,
      "type": "audio",
      "subtype": null,
      "message": {
        "text": "",
        "textLang": null,
        "caption": "",
        "file": {
          "link": "https://s3.us-east-1.wasabisys.com/devapi.chatapp.online/chatFiles/1/grWhatsApp/2024/09/29/5ca2f568-2dd8-44a23.oga",
          "name": "ad7383ec-548a-4400-bb46-0c58954f944a.oga",
          "contentType": "audio/ogg; codecs=opus"
        },
        "location": null,
        "template": null,
        "html": ""
      },
      "quotedMessage": null,
      "fromUser": {
        "id": "70000000000@c.us",
        "username": null,
        "name": "70000000000",
        "phone": "70000000000",
        "email": null
      },
      "chat": {
        "id": "70000000001@c.us",
        "internalId": 296,
        "fullId": "0fd9e908a1da02732f83f0d08961a59e",
        "hash": null,
        "type": "private",
        "phone": "70000000001",
        "username": null,
        "email": null,
        "name": "Имя контакта",
        "image": "https://download.samplelib.com/jpeg/sample-green-400x300.jpg",
        "lastTime": 1727595489,
        "automations": {
          "bots": {
            "active": true
          },
          "autoResponses": {
            "active": true
          },
          "triggers": {
            "active": true
          }
        },
        "link": null,
        "tags": null,
        "responsible": null,
        "producer": null,
        "accomplices": null,
        "auditors": null,
        "status": null,
        "level": null,
        "responsiblePin": false,
        "process": null,
        "timeLastInMessage": 1727093495,
        "unreadMessages": 1,
        "lastRead": null,
        "advert": null,
        "secondLink": null,
        "subtype": null,
        "inviteLink": null,
        "lastMessage": {
          "type": "audio",
          "previewText": "",
          "previewTextLang": null
        },
        "comment": null,
        "consentSendMessage": null,
        "archive": false
      },
      "fromApp": {
        "id": "native",
        "tracking": null,
        "sender": null
      },
      "utm": null,
      "created": null,
      "forwarded": false,
      "edited": false
    }
  ],
  "meta": {
    "type": "message",
    "licenseId": 1,
    "messengerType": "grWhatsApp"
  }
}

Пример события “Пропущенный звонок” (доступно для мессенджеров: grWhatsApp, telegram)

{
  "data": [
    {
      "id": "FCF4FCE2FF7ED62BEBC1B6B7755DF9D6",
      "internalId": 6189,
      "groupId": null,
      "fromApi": false,
      "fromMe": false,
      "side": "in",
      "time": 1727595908,
      "type": "call_log",
      "subtype": null,
      "message": {
        "text": "[Call - miss]",
        "textLang": null,
        "caption": "",
        "file": null,
        "location": null,
        "template": null,
        "html": ""
      },
      "quotedMessage": null,
      "fromUser": {
        "id": "70000000001@c.us",
        "username": null,
        "name": "Имя контакта",
        "phone": "70000000001",
        "email": null
      },
      "chat": {
        "id": "70000000001@c.us",
        "internalId": 103,
        "fullId": "3f8a4c14ec994946037ec9955436b34b",
        "hash": null,
        "type": "private",
        "phone": "70000000001",
        "username": null,
        "email": null,
        "name": "Имя контакта",
        "image": "https://download.samplelib.com/jpeg/sample-green-400x300.jpg",
        "lastTime": 1727595908,
        "automations": {
          "bots": {
            "active": true
          },
          "autoResponses": {
            "active": true
          },
          "triggers": {
            "active": true
          }
        },
        "link": null,
        "tags": null,
        "responsible": null,
        "producer": null,
        "accomplices": null,
        "auditors": null,
        "status": null,
        "level": null,
        "responsiblePin": false,
        "process": null,
        "timeLastInMessage": 1727595908,
        "unreadMessages": 1,
        "lastRead": null,
        "advert": null,
        "secondLink": null,
        "subtype": null,
        "inviteLink": null,
        "lastMessage": {
          "type": "call_log",
          "previewText": "[Call - miss]",
          "previewTextLang": null
        },
        "comment": null,
        "consentSendMessage": null,
        "archive": false
      },
      "fromApp": null,
      "utm": null,
      "created": null,
      "forwarded": false,
      "edited": false
    }
  ],
  "meta": {
    "type": "message",
    "licenseId": 1,
    "messengerType": "grWhatsApp"
  }
}

Пример шаблонного сообщения (доступно для мессенджеров: WhatsApp, caWhatsApp, vkNotify)

{
  "data": [
    {
      "id": "wamid.HBgLNzk2MTQ5MDIwMzcVAgARGBJCRUI5NkYzRTVGMzM0NTJCQUUA",
      "internalId": 6455,
      "groupId": null,
      "fromApi": true,
      "fromMe": true,
      "side": "out",
      "time": 1727700907,
      "type": "template",
      "subtype": null,
      "message": {
        "text": "Hello World\nThis is test template text.",
        "textLang": null,
        "caption": "",
        "file": null,
        "location": null,
        "template": {
          "id": "2952652771550190",
          "params": []
        },
        "html": ""
      },
      "quotedMessage": null,
      "fromUser": {
        "id": "70000000000",
        "username": null,
        "name": null,
        "phone": "70000000000",
        "email": null
      },
      "chat": {
        "id": "70000000001",
        "internalId": 241,
        "fullId": "bafb7a957d9da889b22d3dcc76afe5ac",
        "hash": null,
        "type": "private",
        "phone": "70000000001",
        "username": null,
        "email": null,
        "name": "Contact name",
        "image": null,
        "lastTime": 1727700907,
        "automations": {
          "bots": {
            "active": true
          },
          "autoResponses": {
            "active": true
          },
          "triggers": {
            "active": true
          }
        },
        "link": null,
        "tags": null,
        "responsible": null,
        "producer": null,
        "accomplices": null,
        "auditors": null,
        "status": null,
        "level": null,
        "responsiblePin": false,
        "process": null,
        "timeLastInMessage": 1726564355,
        "unreadMessages": 1,
        "lastRead": null,
        "advert": null,
        "secondLink": null,
        "subtype": null,
        "inviteLink": null,
        "lastMessage": {
          "type": "template",
          "previewText": "Hello World\nThis is test template text.",
          "previewTextLang": null
        },
        "comment": null,
        "consentSendMessage": null,
        "archive": false
      },
      "fromApp": {
        "id": "app_25095_1",
        "tracking": null,
        "sender": "employee"
      },
      "utm": null,
      "created": {
        "id": 25095
      },
      "forwarded": false,
      "edited": false
    }
  ],
  "meta": {
    "type": "message",
    "licenseId": 1,
    "messengerType": "caWhatsApp"
  }
}
Оставить заявку на услуги интегратора