API & Documentation

Message

To send a message to the webhook, a reply from webhook will be sent to in the same json format as the request.

https://whapi.io/api/send

Content-Type
application/json

time
*UNIX Timestamp
type
text
value
content

{
  "app": {
    "id": "6812345xxx",
    "time": 1638634976,
    "data": {
      "recipient": {
        "id": "68213652xxx"
      },
      "message": [
        {
          "time": 1638634976,
          "type": "text",
          "value": "Hello World!"
        }
      ]
    }
  }
}

time
*UNIX Timestamp
type
image, audio, video, or document
value
url (the value is always url)

{
  "app": {
    "id": "6812345xxx",
    "time": 1638634976,
    "data": {
      "recipient": {
        "id": "68213652xxx"
      },
      "message": [
        {
          "time": 1638634976,
          "type": "audio",
          "value": "https://transfer.sh/get/lKDEC/rec.wav"
        }
      ]
    }
  }
}

time
*UNIX Timestamp
type
location
lng
Logitude GPS coordinates
lat
Latitude GPS coordinates

{
  "app": {
    "id": "6812345xxx",
    "time": 1638634976,
    "data": {
      "recipient": {
        "id": "68213652xxx"
      },
      "message": [
        {
          "time": 1638634976,
          "type": "location",
          "lng": "-6.175392999999987",
          "lat": "106.82702099999997"
        }
      ]
    }
  }
}

Webhook

To receive a webhook message you need to configure the webhook url on each devices configuration.

1. Go to Home > Choose Device > Setting.

2. Click button Update at webhook row.

3. Fill out the webhook form with your webhook url and click Set Webhook

All incoming messages will be sent to the webhook, in the following format

{
  "app": {
    "id":"6284xxxx",
    "time": 1638634976,
    "data": {
      "sender": {
        "id":"628213xxxx"
      },
      "message": [
        {
          "id": "5e85776253925533642f48a7",
          "time": 1638634976,
          "type": "text",
          "value": "Hello world!"
        },
        {
          "id": "5e85776253925533642f48a8",
          "time": 1638634976,
          "type": "image",
          "value": "https://whapi.io/assets/img/whapi.io.png"
        }
      ]
    }
  }
}

Whapi will send a user profile if the profile hasn't been sent in the past 1 day, in the following format

{
  "app": {
    "id":"6284xxxx",
    "time": 1638634976,
    "data": {
      "profile": {
        "firstname": "Firstname",
        "lastname": "Lastname",
        "profilepic": "https://pps.whatsapp.net/v/profile_image.jpg"
      },
      "sender": {
        "id":"628213xxxx"
      },
      "message": [
        {
          "id": "5e85776253925533642f48a7",
          "time": 1638634976,
          "type": "text",
          "value": "Hello world!"
        }
      ]
    }
  }
}