Incoming events processing (events-get)

This command is used to request and retrieve a list of incoming events, such as:

  • incoming messages (action = message)
  • message read/update (action = ack)
  • incoming media file (action = media)
  • message sent (action = sent) - this event appears only for asynchronous sending
  • error (action = error)
  • WhatsApp disconnect and session removal (action = disconnect)

To retrieve the event list, send a POST request to:

https://whatsgate.org/api/v1/events-get

The request body accepts the following object:

{
  "WhatsappID" : "XXXXXXXXXXXXX",
  "date" : "YYYY-MM-DD HH:MM:SS",
  "action" : "message",
  "page_cnt" : "10",
  "page" : "1"
}

All fields in this object are optional, meaning an empty object is enough to get the full list of events. Fields WhatsappID and action are filters, and date limits events by date. The date is typically used like this: after reading events, take the date of the last event and pass it in the next request as date to fetch only newer events.

  • WhatsappID - filter by WhatsApp identifier; uses exact match and returns events for the specified session. If omitted, the system returns events for all sessions, including deleted ones.
  • date - limits events by the specified date. A common pattern is to reuse the latest received event date in the next request to get fresh events only.
  • action - event type filter. Can be one of:
    • message - incoming message.
    • ack - message status update.
    • media - incoming media file.
    • sent - message sent (only when sending asynchronously)
    • error - error
    • disconnect - WhatsApp disconnect and session deletion
    • create - outgoing message
  • page_cnt - maximum number of events per response page. Default is 10, maximum is 100.
  • page - response page number. Default is 1

Successful response object

{
  "result": "OK",
  "pages" : 1,
  "elements" : 2,
  "page" : 1,
  "data" : [
     // 
  ]
}
  • result - contains “OK” when the request succeeds
  • pages - number of pages for the given filters
  • elements - number of matching elements (event count)
  • page - current page number
  • data - contains an array of objects representing events.