W2A

Events

See how you will receive updates from whatsapp

There's a lib for nodejs here: Click here

All requests we make to your webhook, will contain 3 headers to verify, be carefull to check those to confirm the sender.
First, will be a `whats2api` set as true
Second will be `userId` which is your user's id
And finally, the `connectionId` which is the connection id which originated the event

All events will be a POST request to your webhook, and will contain a body with a MAP of events, where the keys are the event name, and the value will be a object containing the data.


Example

Here's a message upsert, where you should create, or update it.

{
  "chats.update": [
    {
      "id": "[email protected]",
      "conversationTimestamp": 1702765134,
      "unreadCount": 1
    }
  ],
  "messages.upsert": {
    "messages": [
      {
        "key": {
          "remoteJid": "[email protected]",
          "fromMe": false,
          "id": "SOME_ID"
        },
        "messageTimestamp": 1702765134,
        "pushName": "Artur",
        "broadcast": false,
        "message": {
          "extendedTextMessage": {
            "text": "Hi you there on W2API",
            "contextInfo": {
              "ephemeralSettingTimestamp": "1702671628",
              "disappearingMode": {
                "initiator": "CHANGED_IN_CHAT",
                "trigger": "CHAT_SETTING"
              }
            },
            "inviteLinkGroupTypeV2": "DEFAULT"
          },
          "messageContextInfo": {
            "deviceListMetadata": {
              "senderKeyHash": "SOME_HASH",
              "senderTimestamp": "1702313814",
              "recipientKeyHash": "ANOTHER_HASH",
              "recipientTimestamp": "1702739964"
            },
            "deviceListMetadataVersion": 2
          }
        }
      }
    ],
    "type": "notify"
  },
  "contacts.update": [
    {
      "id": "[email protected]",
      "notify": "A NAME"
    }
  ]
}

List of events

Here are the most important events and the ones you should look into.

  • connection.update: connection state has been updated -- WS closed, opened, connecting etc.
  • creds.update: credentials updated -- some metadata, keys or something
  • messaging-history.set: history sync, everything is reverse chronologically sorted
  • chats.upsert: upsert chats
  • chats.update: update the given chats
  • chats.delete: delete chats with given ID
  • labels.association: labels association
  • labels.edit: edit label
  • presence.update: presence of contact in a chat updated
  • contacts.upsert: upsert contacts
  • contacts.update: update the given contacts
  • messages.delete: delete messages
  • messages.update: update messages
  • messages.media-update: update media messages
  • messages.upsert: add/update messages
  • messages.reaction: message reaction
  • message-receipt.update: update message receipt
  • groups.upsert: upsert groups
  • groups.update: update the given groups
  • group-participants.update: apply an action to participants in a group
  • blocklist.set: set blocklist
  • blocklist.update: update blocklist
  • call: receive an update on a call